diff options
author | Prakash Surya <[email protected]> | 2012-08-23 17:45:31 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-08-24 13:19:06 -0700 |
commit | 15a9e03368d8f186751a432740a5a281f45d712d (patch) | |
tree | 94ad8ef71428ac66e58f816cb993deb5ed8c1aec /module | |
parent | 52cd92022eaf8f105510df708d234012cbe5078d (diff) |
Wrap smp_processor_id in kpreempt_[dis|en]able
After surveying the code, the few places where smp_processor_id is used
were deemed to be safe to use with a preempt enabled kernel. As such, no
core logic had to be changed. These smp_processor_id call sites are simply
are wrapped in kpreempt_disable and kpreempt_enabled to prevent the
Linux kernel from emitting scary warnings.
Signed-off-by: Prakash Surya <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Issue #83
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/fm.c | 8 | ||||
-rw-r--r-- | module/zfs/txg.c | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/module/zfs/fm.c b/module/zfs/fm.c index e4ecfea19..a41d3533b 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -1413,7 +1413,13 @@ fm_ena_generate_cpu(uint64_t timestamp, processorid_t cpuid, uchar_t format) uint64_t fm_ena_generate(uint64_t timestamp, uchar_t format) { - return (fm_ena_generate_cpu(timestamp, getcpuid(), format)); + uint64_t ena; + + kpreempt_disable(); + ena = fm_ena_generate_cpu(timestamp, getcpuid(), format); + kpreempt_enable(); + + return (ena); } uint64_t diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 6e64adf93..1cb3cb61c 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -218,9 +218,19 @@ uint64_t txg_hold_open(dsl_pool_t *dp, txg_handle_t *th) { tx_state_t *tx = &dp->dp_tx; - tx_cpu_t *tc = &tx->tx_cpu[CPU_SEQID]; + tx_cpu_t *tc; uint64_t txg; + /* + * It appears the processor id is simply used as a "random" + * number to index into the array, and there isn't any other + * significance to the chosen tx_cpu. Because.. Why not use + * the current cpu to index into the array? + */ + kpreempt_disable(); + tc = &tx->tx_cpu[CPU_SEQID]; + kpreempt_enable(); + mutex_enter(&tc->tc_lock); txg = tx->tx_open_txg; |