diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 74d66b641169..72856e5f23a3 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -1947,7 +1947,7 @@ static int bch_btree_check_thread(void *arg) */ atomic_set(&check_state->enough, 1); /* Update check_state->enough earlier */ - smp_mb(); + smp_mb__after_atomic(); goto out; } skip_nr--; @@ -1972,7 +1972,7 @@ static int bch_btree_check_thread(void *arg) out: info->result = ret; /* update check_state->started among all CPUs */ - smp_mb(); + smp_mb__before_atomic(); if (atomic_dec_and_test(&check_state->started)) wake_up(&check_state->wait); @@ -2031,7 +2031,7 @@ int bch_btree_check(struct cache_set *c) */ for (i = 0; i < check_state->total_threads; i++) { /* fetch latest check_state->enough earlier */ - smp_mb(); + smp_mb__before_atomic(); if (atomic_read(&check_state->enough)) break; diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 72ba6d015786..3f7641fb28d5 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -854,7 +854,7 @@ static int bch_dirty_init_thread(void *arg) else { atomic_set(&state->enough, 1); /* Update state->enough earlier */ - smp_mb(); + smp_mb__after_atomic(); goto out; } skip_nr--; @@ -873,7 +873,7 @@ static int bch_dirty_init_thread(void *arg) out: /* In order to wake up state->wait in time */ - smp_mb(); + smp_mb__before_atomic(); if (atomic_dec_and_test(&state->started)) wake_up(&state->wait); @@ -932,7 +932,7 @@ void bch_sectors_dirty_init(struct bcache_device *d) for (i = 0; i < state->total_threads; i++) { /* Fetch latest state->enough earlier */ - smp_mb(); + smp_mb__before_atomic(); if (atomic_read(&state->enough)) break;