aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-iopoll.c4
-rw-r--r--crypto/chainiv.c2
-rw-r--r--drivers/base/power/domain.c2
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c4
-rw-r--r--drivers/cpuidle/coupled.c2
-rw-r--r--drivers/firewire/ohci.c2
-rw-r--r--drivers/gpu/drm/drm_irq.c10
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c2
-rw-r--r--drivers/md/bcache/bcache.h2
-rw-r--r--drivers/md/bcache/closure.h2
-rw-r--r--drivers/md/dm-bufio.c8
-rw-r--r--drivers/md/dm-snap.c4
-rw-r--r--drivers/md/dm.c2
-rw-r--r--drivers/md/raid5.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c6
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c6
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c18
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c26
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c8
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c8
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c6
-rw-r--r--drivers/net/ethernet/chelsio/cxgb/cxgb2.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/sge.c6
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/sge.c2
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c8
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c8
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c6
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c2
-rw-r--r--drivers/pci/xen-pcifront.c4
-rw-r--r--drivers/scsi/isci/remote_device.c2
-rw-r--r--drivers/target/loopback/tcm_loop.c4
-rw-r--r--drivers/target/target_core_alua.c26
-rw-r--r--drivers/target/target_core_device.c6
-rw-r--r--drivers/target/target_core_iblock.c2
-rw-r--r--drivers/target/target_core_pr.c56
-rw-r--r--drivers/target/target_core_transport.c16
-rw-r--r--drivers/target/target_core_ua.c10
-rw-r--r--drivers/tty/n_tty.c2
-rw-r--r--drivers/tty/serial/mxs-auart.c4
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.c4
-rw-r--r--drivers/usb/serial/usb_wwan.c2
-rw-r--r--drivers/vhost/scsi.c2
-rw-r--r--drivers/w1/w1_family.c4
-rw-r--r--drivers/xen/xen-pciback/pciback_ops.c4
-rw-r--r--fs/btrfs/btrfs_inode.h2
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/btrfs/inode.c6
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/ext4/resize.c2
-rw-r--r--fs/gfs2/glock.c8
-rw-r--r--fs/gfs2/glops.c2
-rw-r--r--fs/gfs2/lock_dlm.c4
-rw-r--r--fs/gfs2/recovery.c2
-rw-r--r--fs/gfs2/sys.c4
-rw-r--r--fs/jbd2/commit.c6
-rw-r--r--fs/nfs/dir.c12
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/nfs/nfs4filelayoutdev.c4
-rw-r--r--fs/nfs/nfs4state.c4
-rw-r--r--fs/nfs/pagelist.c6
-rw-r--r--fs/nfs/pnfs.c2
-rw-r--r--fs/nfs/pnfs.h2
-rw-r--r--fs/nfs/write.c4
-rw-r--r--fs/ubifs/lpt_commit.c4
-rw-r--r--fs/ubifs/tnc_commit.c4
-rw-r--r--include/asm-generic/bitops/atomic.h2
-rw-r--r--include/asm-generic/bitops/lock.h2
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/sched.h6
-rw-r--r--include/linux/sunrpc/sched.h8
-rw-r--r--include/linux/sunrpc/xprt.h8
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--kernel/debug/debug_core.c4
-rw-r--r--kernel/futex.c4
-rw-r--r--kernel/kmod.c2
-rw-r--r--kernel/rcu/tree.c22
-rw-r--r--kernel/rcu/tree_plugin.h8
-rw-r--r--kernel/sched/cpupri.c6
-rw-r--r--kernel/sched/wait.c2
-rw-r--r--mm/backing-dev.c2
-rw-r--r--mm/filemap.c4
-rw-r--r--net/atm/pppoatm.c2
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/link_watch.c2
-rw-r--r--net/ipv4/inetpeer.c2
-rw-r--r--net/ipv4/tcp_output.c4
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/rds/ib_recv.c4
-rw-r--r--net/rds/iw_recv.c4
-rw-r--r--net/rds/send.c6
-rw-r--r--net/rds/tcp_send.c2
-rw-r--r--net/sunrpc/auth.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
-rw-r--r--net/sunrpc/backchannel_rqst.c4
-rw-r--r--net/sunrpc/xprt.c4
-rw-r--r--net/sunrpc/xprtsock.c16
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--sound/pci/bt87x.c4
106 files changed, 284 insertions, 288 deletions
diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c
index c11d24e379e2..f8c6a11b13f0 100644
--- a/block/blk-iopoll.c
+++ b/block/blk-iopoll.c
@@ -49,7 +49,7 @@ EXPORT_SYMBOL(blk_iopoll_sched);
49void __blk_iopoll_complete(struct blk_iopoll *iop) 49void __blk_iopoll_complete(struct blk_iopoll *iop)
50{ 50{
51 list_del(&iop->list); 51 list_del(&iop->list);
52 smp_mb__before_clear_bit(); 52 smp_mb__before_atomic();
53 clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); 53 clear_bit_unlock(IOPOLL_F_SCHED, &iop->state);
54} 54}
55EXPORT_SYMBOL(__blk_iopoll_complete); 55EXPORT_SYMBOL(__blk_iopoll_complete);
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(blk_iopoll_disable);
161void blk_iopoll_enable(struct blk_iopoll *iop) 161void blk_iopoll_enable(struct blk_iopoll *iop)
162{ 162{
163 BUG_ON(!test_bit(IOPOLL_F_SCHED, &iop->state)); 163 BUG_ON(!test_bit(IOPOLL_F_SCHED, &iop->state));
164 smp_mb__before_clear_bit(); 164 smp_mb__before_atomic();
165 clear_bit_unlock(IOPOLL_F_SCHED, &iop->state); 165 clear_bit_unlock(IOPOLL_F_SCHED, &iop->state);
166} 166}
167EXPORT_SYMBOL(blk_iopoll_enable); 167EXPORT_SYMBOL(blk_iopoll_enable);
diff --git a/crypto/chainiv.c b/crypto/chainiv.c
index 834d8dd3d4fc..9c294c8f9a07 100644
--- a/crypto/chainiv.c
+++ b/crypto/chainiv.c
@@ -126,7 +126,7 @@ static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx)
126 int err = ctx->err; 126 int err = ctx->err;
127 127
128 if (!ctx->queue.qlen) { 128 if (!ctx->queue.qlen) {
129 smp_mb__before_clear_bit(); 129 smp_mb__before_atomic();
130 clear_bit(CHAINIV_STATE_INUSE, &ctx->state); 130 clear_bit(CHAINIV_STATE_INUSE, &ctx->state);
131 131
132 if (!ctx->queue.qlen || 132 if (!ctx->queue.qlen ||
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ae098a261fcd..eee55c1e5fde 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -105,7 +105,7 @@ static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
105static void genpd_sd_counter_inc(struct generic_pm_domain *genpd) 105static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
106{ 106{
107 atomic_inc(&genpd->sd_count); 107 atomic_inc(&genpd->sd_count);
108 smp_mb__after_atomic_inc(); 108 smp_mb__after_atomic();
109} 109}
110 110
111static void genpd_acquire_lock(struct generic_pm_domain *genpd) 111static void genpd_acquire_lock(struct generic_pm_domain *genpd)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 59c5abe32f06..4fd8d6c1c3d2 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -224,9 +224,9 @@ static int get_slot(struct mtip_port *port)
224 */ 224 */
225static inline void release_slot(struct mtip_port *port, int tag) 225static inline void release_slot(struct mtip_port *port, int tag)
226{ 226{
227 smp_mb__before_clear_bit(); 227 smp_mb__before_atomic();
228 clear_bit(tag, port->allocated); 228 clear_bit(tag, port->allocated);
229 smp_mb__after_clear_bit(); 229 smp_mb__after_atomic();
230} 230}
231 231
232/* 232/*
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index cb6654bfad77..73fe2f8d7f96 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -159,7 +159,7 @@ void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a)
159{ 159{
160 int n = dev->coupled->online_count; 160 int n = dev->coupled->online_count;
161 161
162 smp_mb__before_atomic_inc(); 162 smp_mb__before_atomic();
163 atomic_inc(a); 163 atomic_inc(a);
164 164
165 while (atomic_read(a) < n) 165 while (atomic_read(a) < n)
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 8db663219560..995dd42a2627 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3498,7 +3498,7 @@ static int ohci_flush_iso_completions(struct fw_iso_context *base)
3498 } 3498 }
3499 3499
3500 clear_bit_unlock(0, &ctx->flushing_completions); 3500 clear_bit_unlock(0, &ctx->flushing_completions);
3501 smp_mb__after_clear_bit(); 3501 smp_mb__after_atomic();
3502 } 3502 }
3503 3503
3504 tasklet_enable(&ctx->context.tasklet); 3504 tasklet_enable(&ctx->context.tasklet);
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index c2676b5908d9..ec5c3f4cdd01 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -156,7 +156,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
156 */ 156 */
157 if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { 157 if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
158 atomic_inc(&dev->vblank[crtc].count); 158 atomic_inc(&dev->vblank[crtc].count);
159 smp_mb__after_atomic_inc(); 159 smp_mb__after_atomic();
160 } 160 }
161 161
162 /* Invalidate all timestamps while vblank irq's are off. */ 162 /* Invalidate all timestamps while vblank irq's are off. */
@@ -864,9 +864,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
864 vblanktimestamp(dev, crtc, tslot) = t_vblank; 864 vblanktimestamp(dev, crtc, tslot) = t_vblank;
865 } 865 }
866 866
867 smp_mb__before_atomic_inc(); 867 smp_mb__before_atomic();
868 atomic_add(diff, &dev->vblank[crtc].count); 868 atomic_add(diff, &dev->vblank[crtc].count);
869 smp_mb__after_atomic_inc(); 869 smp_mb__after_atomic();
870} 870}
871 871
872/** 872/**
@@ -1330,9 +1330,9 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
1330 /* Increment cooked vblank count. This also atomically commits 1330 /* Increment cooked vblank count. This also atomically commits
1331 * the timestamp computed above. 1331 * the timestamp computed above.
1332 */ 1332 */
1333 smp_mb__before_atomic_inc(); 1333 smp_mb__before_atomic();
1334 atomic_inc(&dev->vblank[crtc].count); 1334 atomic_inc(&dev->vblank[crtc].count);
1335 smp_mb__after_atomic_inc(); 1335 smp_mb__after_atomic();
1336 } else { 1336 } else {
1337 DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", 1337 DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",
1338 crtc, (int) diff_ns); 1338 crtc, (int) diff_ns);
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 7753249b3a95..5409bfafff63 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2147,7 +2147,7 @@ static void i915_error_work_func(struct work_struct *work)
2147 * updates before 2147 * updates before
2148 * the counter increment. 2148 * the counter increment.
2149 */ 2149 */
2150 smp_mb__before_atomic_inc(); 2150 smp_mb__before_atomic();
2151 atomic_inc(&dev_priv->gpu_error.reset_counter); 2151 atomic_inc(&dev_priv->gpu_error.reset_counter);
2152 2152
2153 kobject_uevent_env(&dev->primary->kdev->kobj, 2153 kobject_uevent_env(&dev->primary->kdev->kobj,
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index 82c9c5d35251..d2ebcf323094 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -828,7 +828,7 @@ static inline bool cached_dev_get(struct cached_dev *dc)
828 return false; 828 return false;
829 829
830 /* Paired with the mb in cached_dev_attach */ 830 /* Paired with the mb in cached_dev_attach */
831 smp_mb__after_atomic_inc(); 831 smp_mb__after_atomic();
832 return true; 832 return true;
833} 833}
834 834
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h
index 7ef7461912be..a08e3eeac3c5 100644
--- a/drivers/md/bcache/closure.h
+++ b/drivers/md/bcache/closure.h
@@ -243,7 +243,7 @@ static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
243 cl->fn = fn; 243 cl->fn = fn;
244 cl->wq = wq; 244 cl->wq = wq;
245 /* between atomic_dec() in closure_put() */ 245 /* between atomic_dec() in closure_put() */
246 smp_mb__before_atomic_dec(); 246 smp_mb__before_atomic();
247} 247}
248 248
249static inline void closure_queue(struct closure *cl) 249static inline void closure_queue(struct closure *cl)
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 66c5d130c8c2..4e84095833db 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -607,9 +607,9 @@ static void write_endio(struct bio *bio, int error)
607 607
608 BUG_ON(!test_bit(B_WRITING, &b->state)); 608 BUG_ON(!test_bit(B_WRITING, &b->state));
609 609
610 smp_mb__before_clear_bit(); 610 smp_mb__before_atomic();
611 clear_bit(B_WRITING, &b->state); 611 clear_bit(B_WRITING, &b->state);
612 smp_mb__after_clear_bit(); 612 smp_mb__after_atomic();
613 613
614 wake_up_bit(&b->state, B_WRITING); 614 wake_up_bit(&b->state, B_WRITING);
615} 615}
@@ -997,9 +997,9 @@ static void read_endio(struct bio *bio, int error)
997 997
998 BUG_ON(!test_bit(B_READING, &b->state)); 998 BUG_ON(!test_bit(B_READING, &b->state));
999 999
1000 smp_mb__before_clear_bit(); 1000 smp_mb__before_atomic();
1001 clear_bit(B_READING, &b->state); 1001 clear_bit(B_READING, &b->state);
1002 smp_mb__after_clear_bit(); 1002 smp_mb__after_atomic();
1003 1003
1004 wake_up_bit(&b->state, B_READING); 1004 wake_up_bit(&b->state, B_READING);
1005} 1005}
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index ebddef5237e4..8e0caed0bf74 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -642,7 +642,7 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
642 struct dm_snapshot *s = pe->snap; 642 struct dm_snapshot *s = pe->snap;
643 643
644 mempool_free(pe, s->pending_pool); 644 mempool_free(pe, s->pending_pool);
645 smp_mb__before_atomic_dec(); 645 smp_mb__before_atomic();
646 atomic_dec(&s->pending_exceptions_count); 646 atomic_dec(&s->pending_exceptions_count);
647} 647}
648 648
@@ -783,7 +783,7 @@ static int init_hash_tables(struct dm_snapshot *s)
783static void merge_shutdown(struct dm_snapshot *s) 783static void merge_shutdown(struct dm_snapshot *s)
784{ 784{
785 clear_bit_unlock(RUNNING_MERGE, &s->state_bits); 785 clear_bit_unlock(RUNNING_MERGE, &s->state_bits);
786 smp_mb__after_clear_bit(); 786 smp_mb__after_atomic();
787 wake_up_bit(&s->state_bits, RUNNING_MERGE); 787 wake_up_bit(&s->state_bits, RUNNING_MERGE);
788} 788}
789 789
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 455e64916498..2db768e4553f 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2447,7 +2447,7 @@ static void dm_wq_work(struct work_struct *work)
2447static void dm_queue_flush(struct mapped_device *md) 2447static void dm_queue_flush(struct mapped_device *md)
2448{ 2448{
2449 clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); 2449 clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
2450 smp_mb__after_clear_bit(); 2450 smp_mb__after_atomic();
2451 queue_work(md->wq, &md->work); 2451 queue_work(md->wq, &md->work);
2452} 2452}
2453 2453
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ad1b9bea446e..2afef4ec9312 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4400,7 +4400,7 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule)
4400 * STRIPE_ON_UNPLUG_LIST clear but the stripe 4400 * STRIPE_ON_UNPLUG_LIST clear but the stripe
4401 * is still in our list 4401 * is still in our list
4402 */ 4402 */
4403 smp_mb__before_clear_bit(); 4403 smp_mb__before_atomic();
4404 clear_bit(STRIPE_ON_UNPLUG_LIST, &sh->state); 4404 clear_bit(STRIPE_ON_UNPLUG_LIST, &sh->state);
4405 /* 4405 /*
4406 * STRIPE_ON_RELEASE_LIST could be set here. In that 4406 * STRIPE_ON_RELEASE_LIST could be set here. In that
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index de02db802ace..e35580618936 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -399,7 +399,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
399 399
400 /* clear 'streaming' status bit */ 400 /* clear 'streaming' status bit */
401 clear_bit(ADAP_STREAMING, &adap->state_bits); 401 clear_bit(ADAP_STREAMING, &adap->state_bits);
402 smp_mb__after_clear_bit(); 402 smp_mb__after_atomic();
403 wake_up_bit(&adap->state_bits, ADAP_STREAMING); 403 wake_up_bit(&adap->state_bits, ADAP_STREAMING);
404skip_feed_stop: 404skip_feed_stop:
405 405
@@ -550,7 +550,7 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe)
550err: 550err:
551 if (!adap->suspend_resume_active) { 551 if (!adap->suspend_resume_active) {
552 clear_bit(ADAP_INIT, &adap->state_bits); 552 clear_bit(ADAP_INIT, &adap->state_bits);
553 smp_mb__after_clear_bit(); 553 smp_mb__after_atomic();
554 wake_up_bit(&adap->state_bits, ADAP_INIT); 554 wake_up_bit(&adap->state_bits, ADAP_INIT);
555 } 555 }
556 556
@@ -591,7 +591,7 @@ err:
591 if (!adap->suspend_resume_active) { 591 if (!adap->suspend_resume_active) {
592 adap->active_fe = -1; 592 adap->active_fe = -1;
593 clear_bit(ADAP_SLEEP, &adap->state_bits); 593 clear_bit(ADAP_SLEEP, &adap->state_bits);
594 smp_mb__after_clear_bit(); 594 smp_mb__after_atomic();
595 wake_up_bit(&adap->state_bits, ADAP_SLEEP); 595 wake_up_bit(&adap->state_bits, ADAP_SLEEP);
596 } 596 }
597 597
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 9261d5313b5b..dd57c7c5a3da 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2781,7 +2781,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
2781 2781
2782 case LOAD_OPEN: 2782 case LOAD_OPEN:
2783 netif_tx_start_all_queues(bp->dev); 2783 netif_tx_start_all_queues(bp->dev);
2784 smp_mb__after_clear_bit(); 2784 smp_mb__after_atomic();
2785 break; 2785 break;
2786 2786
2787 case LOAD_DIAG: 2787 case LOAD_DIAG:
@@ -4939,9 +4939,9 @@ void bnx2x_update_coalesce_sb_index(struct bnx2x *bp, u8 fw_sb_id,
4939void bnx2x_schedule_sp_rtnl(struct bnx2x *bp, enum sp_rtnl_flag flag, 4939void bnx2x_schedule_sp_rtnl(struct bnx2x *bp, enum sp_rtnl_flag flag,
4940 u32 verbose) 4940 u32 verbose)
4941{ 4941{
4942 smp_mb__before_clear_bit(); 4942 smp_mb__before_atomic();
4943 set_bit(flag, &bp->sp_rtnl_state); 4943 set_bit(flag, &bp->sp_rtnl_state);
4944 smp_mb__after_clear_bit(); 4944 smp_mb__after_atomic();
4945 DP((BNX2X_MSG_SP | verbose), "Scheduling sp_rtnl task [Flag: %d]\n", 4945 DP((BNX2X_MSG_SP | verbose), "Scheduling sp_rtnl task [Flag: %d]\n",
4946 flag); 4946 flag);
4947 schedule_delayed_work(&bp->sp_rtnl_task, 0); 4947 schedule_delayed_work(&bp->sp_rtnl_task, 0);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index a78edaccceee..16391db2e8c9 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -1858,10 +1858,10 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
1858 return; 1858 return;
1859#endif 1859#endif
1860 1860
1861 smp_mb__before_atomic_inc(); 1861 smp_mb__before_atomic();
1862 atomic_inc(&bp->cq_spq_left); 1862 atomic_inc(&bp->cq_spq_left);
1863 /* push the change in bp->spq_left and towards the memory */ 1863 /* push the change in bp->spq_left and towards the memory */
1864 smp_mb__after_atomic_inc(); 1864 smp_mb__after_atomic();
1865 1865
1866 DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left)); 1866 DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left));
1867 1867
@@ -1876,11 +1876,11 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
1876 * sp_state is cleared, and this order prevents 1876 * sp_state is cleared, and this order prevents
1877 * races 1877 * races
1878 */ 1878 */
1879 smp_mb__before_clear_bit(); 1879 smp_mb__before_atomic();
1880 set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state); 1880 set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state);
1881 wmb(); 1881 wmb();
1882 clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); 1882 clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
1883 smp_mb__after_clear_bit(); 1883 smp_mb__after_atomic();
1884 1884
1885 /* schedule the sp task as mcp ack is required */ 1885 /* schedule the sp task as mcp ack is required */
1886 bnx2x_schedule_sp_task(bp); 1886 bnx2x_schedule_sp_task(bp);
@@ -5272,9 +5272,9 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
5272 __clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags); 5272 __clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags);
5273 5273
5274 /* mark latest Q bit */ 5274 /* mark latest Q bit */
5275 smp_mb__before_clear_bit(); 5275 smp_mb__before_atomic();
5276 set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state); 5276 set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
5277 smp_mb__after_clear_bit(); 5277 smp_mb__after_atomic();
5278 5278
5279 /* send Q update ramrod for FCoE Q */ 5279 /* send Q update ramrod for FCoE Q */
5280 rc = bnx2x_queue_state_change(bp, &queue_params); 5280 rc = bnx2x_queue_state_change(bp, &queue_params);
@@ -5500,7 +5500,7 @@ next_spqe:
5500 spqe_cnt++; 5500 spqe_cnt++;
5501 } /* for */ 5501 } /* for */
5502 5502
5503 smp_mb__before_atomic_inc(); 5503 smp_mb__before_atomic();
5504 atomic_add(spqe_cnt, &bp->eq_spq_left); 5504 atomic_add(spqe_cnt, &bp->eq_spq_left);
5505 5505
5506 bp->eq_cons = sw_cons; 5506 bp->eq_cons = sw_cons;
@@ -13869,9 +13869,9 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
13869 case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: { 13869 case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: {
13870 int count = ctl->data.credit.credit_count; 13870 int count = ctl->data.credit.credit_count;
13871 13871
13872 smp_mb__before_atomic_inc(); 13872 smp_mb__before_atomic();
13873 atomic_add(count, &bp->cq_spq_left); 13873 atomic_add(count, &bp->cq_spq_left);
13874 smp_mb__after_atomic_inc(); 13874 smp_mb__after_atomic();
13875 break; 13875 break;
13876 } 13876 }
13877 case DRV_CTL_ULP_REGISTER_CMD: { 13877 case DRV_CTL_ULP_REGISTER_CMD: {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 31297266b743..d725317c4277 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -258,16 +258,16 @@ static bool bnx2x_raw_check_pending(struct bnx2x_raw_obj *o)
258 258
259static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o) 259static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o)
260{ 260{
261 smp_mb__before_clear_bit(); 261 smp_mb__before_atomic();
262 clear_bit(o->state, o->pstate); 262 clear_bit(o->state, o->pstate);
263 smp_mb__after_clear_bit(); 263 smp_mb__after_atomic();
264} 264}
265 265
266static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o) 266static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o)
267{ 267{
268 smp_mb__before_clear_bit(); 268 smp_mb__before_atomic();
269 set_bit(o->state, o->pstate); 269 set_bit(o->state, o->pstate);
270 smp_mb__after_clear_bit(); 270 smp_mb__after_atomic();
271} 271}
272 272
273/** 273/**
@@ -2131,7 +2131,7 @@ static int bnx2x_set_rx_mode_e1x(struct bnx2x *bp,
2131 2131
2132 /* The operation is completed */ 2132 /* The operation is completed */
2133 clear_bit(p->state, p->pstate); 2133 clear_bit(p->state, p->pstate);
2134 smp_mb__after_clear_bit(); 2134 smp_mb__after_atomic();
2135 2135
2136 return 0; 2136 return 0;
2137} 2137}
@@ -3576,16 +3576,16 @@ error_exit1:
3576 3576
3577static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o) 3577static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o)
3578{ 3578{
3579 smp_mb__before_clear_bit(); 3579 smp_mb__before_atomic();
3580 clear_bit(o->sched_state, o->raw.pstate); 3580 clear_bit(o->sched_state, o->raw.pstate);
3581 smp_mb__after_clear_bit(); 3581 smp_mb__after_atomic();
3582} 3582}
3583 3583
3584static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o) 3584static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o)
3585{ 3585{
3586 smp_mb__before_clear_bit(); 3586 smp_mb__before_atomic();
3587 set_bit(o->sched_state, o->raw.pstate); 3587 set_bit(o->sched_state, o->raw.pstate);
3588 smp_mb__after_clear_bit(); 3588 smp_mb__after_atomic();
3589} 3589}
3590 3590
3591static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o) 3591static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o)
@@ -4200,7 +4200,7 @@ int bnx2x_queue_state_change(struct bnx2x *bp,
4200 if (rc) { 4200 if (rc) {
4201 o->next_state = BNX2X_Q_STATE_MAX; 4201 o->next_state = BNX2X_Q_STATE_MAX;
4202 clear_bit(pending_bit, pending); 4202 clear_bit(pending_bit, pending);
4203 smp_mb__after_clear_bit(); 4203 smp_mb__after_atomic();
4204 return rc; 4204 return rc;
4205 } 4205 }
4206 4206
@@ -4288,7 +4288,7 @@ static int bnx2x_queue_comp_cmd(struct bnx2x *bp,
4288 wmb(); 4288 wmb();
4289 4289
4290 clear_bit(cmd, &o->pending); 4290 clear_bit(cmd, &o->pending);
4291 smp_mb__after_clear_bit(); 4291 smp_mb__after_atomic();
4292 4292
4293 return 0; 4293 return 0;
4294} 4294}
@@ -5279,7 +5279,7 @@ static inline int bnx2x_func_state_change_comp(struct bnx2x *bp,
5279 wmb(); 5279 wmb();
5280 5280
5281 clear_bit(cmd, &o->pending); 5281 clear_bit(cmd, &o->pending);
5282 smp_mb__after_clear_bit(); 5282 smp_mb__after_atomic();
5283 5283
5284 return 0; 5284 return 0;
5285} 5285}
@@ -5926,7 +5926,7 @@ int bnx2x_func_state_change(struct bnx2x *bp,
5926 if (rc) { 5926 if (rc) {
5927 o->next_state = BNX2X_F_STATE_MAX; 5927 o->next_state = BNX2X_F_STATE_MAX;
5928 clear_bit(cmd, pending); 5928 clear_bit(cmd, pending);
5929 smp_mb__after_clear_bit(); 5929 smp_mb__after_atomic();
5930 return rc; 5930 return rc;
5931 } 5931 }
5932 5932
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 5c523b32db70..f82ac5ac2336 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1626,9 +1626,9 @@ static
1626void bnx2x_vf_handle_filters_eqe(struct bnx2x *bp, 1626void bnx2x_vf_handle_filters_eqe(struct bnx2x *bp,
1627 struct bnx2x_virtf *vf) 1627 struct bnx2x_virtf *vf)
1628{ 1628{
1629 smp_mb__before_clear_bit(); 1629 smp_mb__before_atomic();
1630 clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); 1630 clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state);
1631 smp_mb__after_clear_bit(); 1631 smp_mb__after_atomic();
1632} 1632}
1633 1633
1634static void bnx2x_vf_handle_rss_update_eqe(struct bnx2x *bp, 1634static void bnx2x_vf_handle_rss_update_eqe(struct bnx2x *bp,
@@ -2960,9 +2960,9 @@ void bnx2x_iov_task(struct work_struct *work)
2960 2960
2961void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) 2961void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag)
2962{ 2962{
2963 smp_mb__before_clear_bit(); 2963 smp_mb__before_atomic();
2964 set_bit(flag, &bp->iov_task_state); 2964 set_bit(flag, &bp->iov_task_state);
2965 smp_mb__after_clear_bit(); 2965 smp_mb__after_atomic();
2966 DP(BNX2X_MSG_IOV, "Scheduling iov task [Flag: %d]\n", flag); 2966 DP(BNX2X_MSG_IOV, "Scheduling iov task [Flag: %d]\n", flag);
2967 queue_delayed_work(bnx2x_iov_wq, &bp->iov_task, 0); 2967 queue_delayed_work(bnx2x_iov_wq, &bp->iov_task, 0);
2968} 2968}
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 09f3fefcbf9c..4dd48d2fa804 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -436,7 +436,7 @@ static int cnic_offld_prep(struct cnic_sock *csk)
436static int cnic_close_prep(struct cnic_sock *csk) 436static int cnic_close_prep(struct cnic_sock *csk)
437{ 437{
438 clear_bit(SK_F_CONNECT_START, &csk->flags); 438 clear_bit(SK_F_CONNECT_START, &csk->flags);
439 smp_mb__after_clear_bit(); 439 smp_mb__after_atomic();
440 440
441 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) { 441 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) {
442 while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) 442 while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags))
@@ -450,7 +450,7 @@ static int cnic_close_prep(struct cnic_sock *csk)
450static int cnic_abort_prep(struct cnic_sock *csk) 450static int cnic_abort_prep(struct cnic_sock *csk)
451{ 451{
452 clear_bit(SK_F_CONNECT_START, &csk->flags); 452 clear_bit(SK_F_CONNECT_START, &csk->flags);
453 smp_mb__after_clear_bit(); 453 smp_mb__after_atomic();
454 454
455 while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags)) 455 while (test_and_set_bit(SK_F_OFFLD_SCHED, &csk->flags))
456 msleep(1); 456 msleep(1);
@@ -3646,7 +3646,7 @@ static int cnic_cm_destroy(struct cnic_sock *csk)
3646 3646
3647 csk_hold(csk); 3647 csk_hold(csk);
3648 clear_bit(SK_F_INUSE, &csk->flags); 3648 clear_bit(SK_F_INUSE, &csk->flags);
3649 smp_mb__after_clear_bit(); 3649 smp_mb__after_atomic();
3650 while (atomic_read(&csk->ref_count) != 1) 3650 while (atomic_read(&csk->ref_count) != 1)
3651 msleep(1); 3651 msleep(1);
3652 cnic_cm_cleanup(csk); 3652 cnic_cm_cleanup(csk);
@@ -4026,7 +4026,7 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)
4026 L4_KCQE_COMPLETION_STATUS_PARITY_ERROR) 4026 L4_KCQE_COMPLETION_STATUS_PARITY_ERROR)
4027 set_bit(SK_F_HW_ERR, &csk->flags); 4027 set_bit(SK_F_HW_ERR, &csk->flags);
4028 4028
4029 smp_mb__before_clear_bit(); 4029 smp_mb__before_atomic();
4030 clear_bit(SK_F_OFFLD_SCHED, &csk->flags); 4030 clear_bit(SK_F_OFFLD_SCHED, &csk->flags);
4031 cnic_cm_upcall(cp, csk, opcode); 4031 cnic_cm_upcall(cp, csk, opcode);
4032 break; 4032 break;
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 675550fe8ee9..3a77f9ead004 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -249,7 +249,7 @@ bnad_tx_complete(struct bnad *bnad, struct bna_tcb *tcb)
249 if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) 249 if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags)))
250 bna_ib_ack(tcb->i_dbell, sent); 250 bna_ib_ack(tcb->i_dbell, sent);
251 251
252 smp_mb__before_clear_bit(); 252 smp_mb__before_atomic();
253 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); 253 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
254 254
255 return sent; 255 return sent;
@@ -1126,7 +1126,7 @@ bnad_tx_cleanup(struct delayed_work *work)
1126 1126
1127 bnad_txq_cleanup(bnad, tcb); 1127 bnad_txq_cleanup(bnad, tcb);
1128 1128
1129 smp_mb__before_clear_bit(); 1129 smp_mb__before_atomic();
1130 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); 1130 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
1131 } 1131 }
1132 1132
@@ -2992,7 +2992,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
2992 sent = bnad_txcmpl_process(bnad, tcb); 2992 sent = bnad_txcmpl_process(bnad, tcb);
2993 if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) 2993 if (likely(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags)))
2994 bna_ib_ack(tcb->i_dbell, sent); 2994 bna_ib_ack(tcb->i_dbell, sent);
2995 smp_mb__before_clear_bit(); 2995 smp_mb__before_atomic();
2996 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags); 2996 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
2997 } else { 2997 } else {
2998 netif_stop_queue(netdev); 2998 netif_stop_queue(netdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
index 0fe7ff750d77..05613a85ce61 100644
--- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
+++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
@@ -281,7 +281,7 @@ static int cxgb_close(struct net_device *dev)
281 if (adapter->params.stats_update_period && 281 if (adapter->params.stats_update_period &&
282 !(adapter->open_device_map & PORT_MASK)) { 282 !(adapter->open_device_map & PORT_MASK)) {
283 /* Stop statistics accumulation. */ 283 /* Stop statistics accumulation. */
284 smp_mb__after_clear_bit(); 284 smp_mb__after_atomic();
285 spin_lock(&adapter->work_lock); /* sync with update task */ 285 spin_lock(&adapter->work_lock); /* sync with update task */
286 spin_unlock(&adapter->work_lock); 286 spin_unlock(&adapter->work_lock);
287 cancel_mac_stats_update(adapter); 287 cancel_mac_stats_update(adapter);
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
index 8b069f96e920..3dfcf600fcc6 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
@@ -1379,7 +1379,7 @@ static inline int check_desc_avail(struct adapter *adap, struct sge_txq *q,
1379 struct sge_qset *qs = txq_to_qset(q, qid); 1379 struct sge_qset *qs = txq_to_qset(q, qid);
1380 1380
1381 set_bit(qid, &qs->txq_stopped); 1381 set_bit(qid, &qs->txq_stopped);
1382 smp_mb__after_clear_bit(); 1382 smp_mb__after_atomic();
1383 1383
1384 if (should_restart_tx(q) && 1384 if (should_restart_tx(q) &&
1385 test_and_clear_bit(qid, &qs->txq_stopped)) 1385 test_and_clear_bit(qid, &qs->txq_stopped))
@@ -1492,7 +1492,7 @@ static void restart_ctrlq(unsigned long data)
1492 1492
1493 if (!skb_queue_empty(&q->sendq)) { 1493 if (!skb_queue_empty(&q->sendq)) {
1494 set_bit(TXQ_CTRL, &qs->txq_stopped); 1494 set_bit(TXQ_CTRL, &qs->txq_stopped);
1495 smp_mb__after_clear_bit(); 1495 smp_mb__after_atomic();
1496 1496
1497 if (should_restart_tx(q) && 1497 if (should_restart_tx(q) &&
1498 test_and_clear_bit(TXQ_CTRL, &qs->txq_stopped)) 1498 test_and_clear_bit(TXQ_CTRL, &qs->txq_stopped))
@@ -1697,7 +1697,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK);
1697 1697
1698 if (unlikely(q->size - q->in_use < ndesc)) { 1698 if (unlikely(q->size - q->in_use < ndesc)) {
1699 set_bit(TXQ_OFLD, &qs->txq_stopped); 1699 set_bit(TXQ_OFLD, &qs->txq_stopped);
1700 smp_mb__after_clear_bit(); 1700 smp_mb__after_atomic();
1701 1701
1702 if (should_restart_tx(q) && 1702 if (should_restart_tx(q) &&
1703 test_and_clear_bit(TXQ_OFLD, &qs->txq_stopped)) 1703 test_and_clear_bit(TXQ_OFLD, &qs->txq_stopped))
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index ca95cf2954eb..e249528c8e60 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2031,7 +2031,7 @@ static void sge_rx_timer_cb(unsigned long data)
2031 struct sge_fl *fl = s->egr_map[id]; 2031 struct sge_fl *fl = s->egr_map[id];
2032 2032
2033 clear_bit(id, s->starving_fl); 2033 clear_bit(id, s->starving_fl);
2034 smp_mb__after_clear_bit(); 2034 smp_mb__after_atomic();
2035 2035
2036 if (fl_starving(fl)) { 2036 if (fl_starving(fl)) {
2037 rxq = container_of(fl, struct sge_eth_rxq, fl); 2037 rxq = container_of(fl, struct sge_eth_rxq, fl);
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index 9cfa4b4bb089..9d88c1d50b49 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -1951,7 +1951,7 @@ static void sge_rx_timer_cb(unsigned long data)
1951 struct sge_fl *fl = s->egr_map[id]; 1951 struct sge_fl *fl = s->egr_map[id];
1952 1952
1953 clear_bit(id, s->starving_fl); 1953 clear_bit(id, s->starving_fl);
1954 smp_mb__after_clear_bit(); 1954 smp_mb__after_atomic();
1955 1955
1956 /* 1956 /*
1957 * Since we are accessing fl without a lock there's a 1957 * Since we are accessing fl without a lock there's a
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 9125d9abf099..d82f092cae90 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1797,9 +1797,9 @@ void stop_gfar(struct net_device *dev)
1797 1797
1798 netif_tx_stop_all_queues(dev); 1798 netif_tx_stop_all_queues(dev);
1799 1799
1800 smp_mb__before_clear_bit(); 1800 smp_mb__before_atomic();
1801 set_bit(GFAR_DOWN, &priv->state); 1801 set_bit(GFAR_DOWN, &priv->state);
1802 smp_mb__after_clear_bit(); 1802 smp_mb__after_atomic();
1803 1803
1804 disable_napi(priv); 1804 disable_napi(priv);
1805 1805
@@ -2042,9 +2042,9 @@ int startup_gfar(struct net_device *ndev)
2042 2042
2043 gfar_init_tx_rx_base(priv); 2043 gfar_init_tx_rx_base(priv);
2044 2044
2045 smp_mb__before_clear_bit(); 2045 smp_mb__before_atomic();
2046 clear_bit(GFAR_DOWN, &priv->state); 2046 clear_bit(GFAR_DOWN, &priv->state);
2047 smp_mb__after_clear_bit(); 2047 smp_mb__after_atomic();
2048 2048
2049 /* Start Rx/Tx DMA and enable the interrupts */ 2049 /* Start Rx/Tx DMA and enable the interrupts */
2050 gfar_start(priv); 2050 gfar_start(priv);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 861b722c2672..1e526c072a44 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4671,7 +4671,7 @@ static void i40e_service_event_complete(struct i40e_pf *pf)
4671 BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state)); 4671 BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state));
4672 4672
4673 /* flush memory to make sure state is correct before next watchog */ 4673 /* flush memory to make sure state is correct before next watchog */
4674 smp_mb__before_clear_bit(); 4674 smp_mb__before_atomic();
4675 clear_bit(__I40E_SERVICE_SCHED, &pf->state); 4675 clear_bit(__I40E_SERVICE_SCHED, &pf->state);
4676} 4676}
4677 4677
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index c4c526b7f99f..2fecc2626de5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -376,7 +376,7 @@ static void ixgbe_service_event_complete(struct ixgbe_adapter *adapter)
376 BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state)); 376 BUG_ON(!test_bit(__IXGBE_SERVICE_SCHED, &adapter->state));
377 377
378 /* flush memory to make sure state is correct before next watchdog */ 378 /* flush memory to make sure state is correct before next watchdog */
379 smp_mb__before_clear_bit(); 379 smp_mb__before_atomic();
380 clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); 380 clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state);
381} 381}
382 382
@@ -4671,7 +4671,7 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter)
4671 if (hw->mac.ops.enable_tx_laser) 4671 if (hw->mac.ops.enable_tx_laser)
4672 hw->mac.ops.enable_tx_laser(hw); 4672 hw->mac.ops.enable_tx_laser(hw);
4673 4673
4674 smp_mb__before_clear_bit(); 4674 smp_mb__before_atomic();
4675 clear_bit(__IXGBE_DOWN, &adapter->state); 4675 clear_bit(__IXGBE_DOWN, &adapter->state);
4676 ixgbe_napi_enable_all(adapter); 4676 ixgbe_napi_enable_all(adapter);
4677 4677
@@ -5567,7 +5567,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
5567 e_dev_err("Cannot enable PCI device from suspend\n"); 5567 e_dev_err("Cannot enable PCI device from suspend\n");
5568 return err; 5568 return err;
5569 } 5569 }
5570 smp_mb__before_clear_bit(); 5570 smp_mb__before_atomic();
5571 clear_bit(__IXGBE_DISABLED, &adapter->state); 5571 clear_bit(__IXGBE_DISABLED, &adapter->state);
5572 pci_set_master(pdev); 5572 pci_set_master(pdev);
5573 5573
@@ -8541,7 +8541,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
8541 e_err(probe, "Cannot re-enable PCI device after reset.\n"); 8541 e_err(probe, "Cannot re-enable PCI device after reset.\n");
8542 result = PCI_ERS_RESULT_DISCONNECT; 8542 result = PCI_ERS_RESULT_DISCONNECT;
8543 } else { 8543 } else {
8544 smp_mb__before_clear_bit(); 8544 smp_mb__before_atomic();
8545 clear_bit(__IXGBE_DISABLED, &adapter->state); 8545 clear_bit(__IXGBE_DISABLED, &adapter->state);
8546 adapter->hw.hw_addr = adapter->io_addr; 8546 adapter->hw.hw_addr = adapter->io_addr;
8547 pci_set_master(pdev); 8547 pci_set_master(pdev);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index d0799e8e31e4..de2793b06305 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1668,7 +1668,7 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1668 1668
1669 spin_unlock_bh(&adapter->mbx_lock); 1669 spin_unlock_bh(&adapter->mbx_lock);
1670 1670
1671 smp_mb__before_clear_bit(); 1671 smp_mb__before_atomic();
1672 clear_bit(__IXGBEVF_DOWN, &adapter->state); 1672 clear_bit(__IXGBEVF_DOWN, &adapter->state);
1673 ixgbevf_napi_enable_all(adapter); 1673 ixgbevf_napi_enable_all(adapter);
1674 1674
@@ -3354,7 +3354,7 @@ static int ixgbevf_resume(struct pci_dev *pdev)
3354 dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); 3354 dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n");
3355 return err; 3355 return err;
3356 } 3356 }
3357 smp_mb__before_clear_bit(); 3357 smp_mb__before_atomic();
3358 clear_bit(__IXGBEVF_DISABLED, &adapter->state); 3358 clear_bit(__IXGBEVF_DISABLED, &adapter->state);
3359 pci_set_master(pdev); 3359 pci_set_master(pdev);
3360 3360
@@ -3712,7 +3712,7 @@ static pci_ers_result_t ixgbevf_io_slot_reset(struct pci_dev *pdev)
3712 return PCI_ERS_RESULT_DISCONNECT; 3712 return PCI_ERS_RESULT_DISCONNECT;
3713 } 3713 }
3714 3714
3715 smp_mb__before_clear_bit(); 3715 smp_mb__before_atomic();
3716 clear_bit(__IXGBEVF_DISABLED, &adapter->state); 3716 clear_bit(__IXGBEVF_DISABLED, &adapter->state);
3717 pci_set_master(pdev); 3717 pci_set_master(pdev);
3718 3718
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index ed88d3913483..e71eae353368 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -543,7 +543,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
543 * wl1271_ps_elp_wakeup cannot be called concurrently. 543 * wl1271_ps_elp_wakeup cannot be called concurrently.
544 */ 544 */
545 clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); 545 clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
546 smp_mb__after_clear_bit(); 546 smp_mb__after_atomic();
547 547
548 ret = wlcore_fw_status(wl, wl->fw_status); 548 ret = wlcore_fw_status(wl, wl->fw_status);
549 if (ret < 0) 549 if (ret < 0)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 179b8edc2262..53df39a22c8a 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -662,9 +662,9 @@ static void pcifront_do_aer(struct work_struct *data)
662 notify_remote_via_evtchn(pdev->evtchn); 662 notify_remote_via_evtchn(pdev->evtchn);
663 663
664 /*in case of we lost an aer request in four lines time_window*/ 664 /*in case of we lost an aer request in four lines time_window*/
665 smp_mb__before_clear_bit(); 665 smp_mb__before_atomic();
666 clear_bit(_PDEVB_op_active, &pdev->flags); 666 clear_bit(_PDEVB_op_active, &pdev->flags);
667 smp_mb__after_clear_bit(); 667 smp_mb__after_atomic();
668 668
669 schedule_pcifront_aer_op(pdev); 669 schedule_pcifront_aer_op(pdev);
670 670
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 96a26f454673..cc51f38b116d 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1541,7 +1541,7 @@ void isci_remote_device_release(struct kref *kref)
1541 clear_bit(IDEV_STOP_PENDING, &idev->flags); 1541 clear_bit(IDEV_STOP_PENDING, &idev->flags);
1542 clear_bit(IDEV_IO_READY, &idev->flags); 1542 clear_bit(IDEV_IO_READY, &idev->flags);
1543 clear_bit(IDEV_GONE, &idev->flags); 1543 clear_bit(IDEV_GONE, &idev->flags);
1544 smp_mb__before_clear_bit(); 1544 smp_mb__before_atomic();
1545 clear_bit(IDEV_ALLOCATED, &idev->flags); 1545 clear_bit(IDEV_ALLOCATED, &idev->flags);
1546 wake_up(&ihost->eventq); 1546 wake_up(&ihost->eventq);
1547} 1547}
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index c886ad1c39fb..73ab75ddaf42 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -951,7 +951,7 @@ static int tcm_loop_port_link(
951 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 951 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
952 952
953 atomic_inc(&tl_tpg->tl_tpg_port_count); 953 atomic_inc(&tl_tpg->tl_tpg_port_count);
954 smp_mb__after_atomic_inc(); 954 smp_mb__after_atomic();
955 /* 955 /*
956 * Add Linux/SCSI struct scsi_device by HCTL 956 * Add Linux/SCSI struct scsi_device by HCTL
957 */ 957 */
@@ -986,7 +986,7 @@ static void tcm_loop_port_unlink(
986 scsi_device_put(sd); 986 scsi_device_put(sd);
987 987
988 atomic_dec(&tl_tpg->tl_tpg_port_count); 988 atomic_dec(&tl_tpg->tl_tpg_port_count);
989 smp_mb__after_atomic_dec(); 989 smp_mb__after_atomic();
990 990
991 pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n"); 991 pr_debug("TCM_Loop_ConfigFS: Port Unlink Successful\n");
992} 992}
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index fcbe6125b73e..0b79b852f4b2 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -393,7 +393,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
393 continue; 393 continue;
394 394
395 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); 395 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
396 smp_mb__after_atomic_inc(); 396 smp_mb__after_atomic();
397 397
398 spin_unlock(&dev->t10_alua.tg_pt_gps_lock); 398 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
399 399
@@ -404,7 +404,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
404 404
405 spin_lock(&dev->t10_alua.tg_pt_gps_lock); 405 spin_lock(&dev->t10_alua.tg_pt_gps_lock);
406 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); 406 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt);
407 smp_mb__after_atomic_dec(); 407 smp_mb__after_atomic();
408 break; 408 break;
409 } 409 }
410 spin_unlock(&dev->t10_alua.tg_pt_gps_lock); 410 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
@@ -990,7 +990,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
990 * TARGET PORT GROUPS command 990 * TARGET PORT GROUPS command
991 */ 991 */
992 atomic_inc(&mem->tg_pt_gp_mem_ref_cnt); 992 atomic_inc(&mem->tg_pt_gp_mem_ref_cnt);
993 smp_mb__after_atomic_inc(); 993 smp_mb__after_atomic();
994 spin_unlock(&tg_pt_gp->tg_pt_gp_lock); 994 spin_unlock(&tg_pt_gp->tg_pt_gp_lock);
995 995
996 spin_lock_bh(&port->sep_alua_lock); 996 spin_lock_bh(&port->sep_alua_lock);
@@ -1020,7 +1020,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
1020 1020
1021 spin_lock(&tg_pt_gp->tg_pt_gp_lock); 1021 spin_lock(&tg_pt_gp->tg_pt_gp_lock);
1022 atomic_dec(&mem->tg_pt_gp_mem_ref_cnt); 1022 atomic_dec(&mem->tg_pt_gp_mem_ref_cnt);
1023 smp_mb__after_atomic_dec(); 1023 smp_mb__after_atomic();
1024 } 1024 }
1025 spin_unlock(&tg_pt_gp->tg_pt_gp_lock); 1025 spin_unlock(&tg_pt_gp->tg_pt_gp_lock);
1026 /* 1026 /*
@@ -1054,7 +1054,7 @@ static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
1054 core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state)); 1054 core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state));
1055 spin_lock(&dev->t10_alua.tg_pt_gps_lock); 1055 spin_lock(&dev->t10_alua.tg_pt_gps_lock);
1056 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); 1056 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt);
1057 smp_mb__after_atomic_dec(); 1057 smp_mb__after_atomic();
1058 spin_unlock(&dev->t10_alua.tg_pt_gps_lock); 1058 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
1059 1059
1060 if (tg_pt_gp->tg_pt_gp_transition_complete) 1060 if (tg_pt_gp->tg_pt_gp_transition_complete)
@@ -1116,7 +1116,7 @@ static int core_alua_do_transition_tg_pt(
1116 */ 1116 */
1117 spin_lock(&dev->t10_alua.tg_pt_gps_lock); 1117 spin_lock(&dev->t10_alua.tg_pt_gps_lock);
1118 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); 1118 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
1119 smp_mb__after_atomic_inc(); 1119 smp_mb__after_atomic();
1120 spin_unlock(&dev->t10_alua.tg_pt_gps_lock); 1120 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
1121 1121
1122 if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) { 1122 if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) {
@@ -1159,7 +1159,7 @@ int core_alua_do_port_transition(
1159 spin_lock(&local_lu_gp_mem->lu_gp_mem_lock); 1159 spin_lock(&local_lu_gp_mem->lu_gp_mem_lock);
1160 lu_gp = local_lu_gp_mem->lu_gp; 1160 lu_gp = local_lu_gp_mem->lu_gp;
1161 atomic_inc(&lu_gp->lu_gp_ref_cnt); 1161 atomic_inc(&lu_gp->lu_gp_ref_cnt);
1162 smp_mb__after_atomic_inc(); 1162 smp_mb__after_atomic();
1163 spin_unlock(&local_lu_gp_mem->lu_gp_mem_lock); 1163 spin_unlock(&local_lu_gp_mem->lu_gp_mem_lock);
1164 /* 1164 /*
1165 * For storage objects that are members of the 'default_lu_gp', 1165 * For storage objects that are members of the 'default_lu_gp',
@@ -1176,7 +1176,7 @@ int core_alua_do_port_transition(
1176 rc = core_alua_do_transition_tg_pt(l_tg_pt_gp, 1176 rc = core_alua_do_transition_tg_pt(l_tg_pt_gp,
1177 new_state, explicit); 1177 new_state, explicit);
1178 atomic_dec(&lu_gp->lu_gp_ref_cnt); 1178 atomic_dec(&lu_gp->lu_gp_ref_cnt);
1179 smp_mb__after_atomic_dec(); 1179 smp_mb__after_atomic();
1180 return rc; 1180 return rc;
1181 } 1181 }
1182 /* 1182 /*
@@ -1190,7 +1190,7 @@ int core_alua_do_port_transition(
1190 1190
1191 dev = lu_gp_mem->lu_gp_mem_dev; 1191 dev = lu_gp_mem->lu_gp_mem_dev;
1192 atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); 1192 atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt);
1193 smp_mb__after_atomic_inc(); 1193 smp_mb__after_atomic();
1194 spin_unlock(&lu_gp->lu_gp_lock); 1194 spin_unlock(&lu_gp->lu_gp_lock);
1195 1195
1196 spin_lock(&dev->t10_alua.tg_pt_gps_lock); 1196 spin_lock(&dev->t10_alua.tg_pt_gps_lock);
@@ -1219,7 +1219,7 @@ int core_alua_do_port_transition(
1219 tg_pt_gp->tg_pt_gp_alua_nacl = NULL; 1219 tg_pt_gp->tg_pt_gp_alua_nacl = NULL;
1220 } 1220 }
1221 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); 1221 atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
1222 smp_mb__after_atomic_inc(); 1222 smp_mb__after_atomic();
1223 spin_unlock(&dev->t10_alua.tg_pt_gps_lock); 1223 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
1224 /* 1224 /*
1225 * core_alua_do_transition_tg_pt() will always return 1225 * core_alua_do_transition_tg_pt() will always return
@@ -1230,7 +1230,7 @@ int core_alua_do_port_transition(
1230 1230
1231 spin_lock(&dev->t10_alua.tg_pt_gps_lock); 1231 spin_lock(&dev->t10_alua.tg_pt_gps_lock);
1232 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); 1232 atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt);
1233 smp_mb__after_atomic_dec(); 1233 smp_mb__after_atomic();
1234 if (rc) 1234 if (rc)
1235 break; 1235 break;
1236 } 1236 }
@@ -1238,7 +1238,7 @@ int core_alua_do_port_transition(
1238 1238
1239 spin_lock(&lu_gp->lu_gp_lock); 1239 spin_lock(&lu_gp->lu_gp_lock);
1240 atomic_dec(&lu_gp_mem->lu_gp_mem_ref_cnt); 1240 atomic_dec(&lu_gp_mem->lu_gp_mem_ref_cnt);
1241 smp_mb__after_atomic_dec(); 1241 smp_mb__after_atomic();
1242 } 1242 }
1243 spin_unlock(&lu_gp->lu_gp_lock); 1243 spin_unlock(&lu_gp->lu_gp_lock);
1244 1244
@@ -1252,7 +1252,7 @@ int core_alua_do_port_transition(
1252 } 1252 }
1253 1253
1254 atomic_dec(&lu_gp->lu_gp_ref_cnt); 1254 atomic_dec(&lu_gp->lu_gp_ref_cnt);
1255 smp_mb__after_atomic_dec(); 1255 smp_mb__after_atomic();
1256 return rc; 1256 return rc;
1257} 1257}
1258 1258
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 65001e133670..72618776ede4 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -225,7 +225,7 @@ struct se_dev_entry *core_get_se_deve_from_rtpi(
225 continue; 225 continue;
226 226
227 atomic_inc(&deve->pr_ref_count); 227 atomic_inc(&deve->pr_ref_count);
228 smp_mb__after_atomic_inc(); 228 smp_mb__after_atomic();
229 spin_unlock_irq(&nacl->device_list_lock); 229 spin_unlock_irq(&nacl->device_list_lock);
230 230
231 return deve; 231 return deve;
@@ -1392,7 +1392,7 @@ int core_dev_add_initiator_node_lun_acl(
1392 spin_lock(&lun->lun_acl_lock); 1392 spin_lock(&lun->lun_acl_lock);
1393 list_add_tail(&lacl->lacl_list, &lun->lun_acl_list); 1393 list_add_tail(&lacl->lacl_list, &lun->lun_acl_list);
1394 atomic_inc(&lun->lun_acl_count); 1394 atomic_inc(&lun->lun_acl_count);
1395 smp_mb__after_atomic_inc(); 1395 smp_mb__after_atomic();
1396 spin_unlock(&lun->lun_acl_lock); 1396 spin_unlock(&lun->lun_acl_lock);
1397 1397
1398 pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for " 1398 pr_debug("%s_TPG[%hu]_LUN[%u->%u] - Added %s ACL for "
@@ -1426,7 +1426,7 @@ int core_dev_del_initiator_node_lun_acl(
1426 spin_lock(&lun->lun_acl_lock); 1426 spin_lock(&lun->lun_acl_lock);
1427 list_del(&lacl->lacl_list); 1427 list_del(&lacl->lacl_list);
1428 atomic_dec(&lun->lun_acl_count); 1428 atomic_dec(&lun->lun_acl_count);
1429 smp_mb__after_atomic_dec(); 1429 smp_mb__after_atomic();
1430 spin_unlock(&lun->lun_acl_lock); 1430 spin_unlock(&lun->lun_acl_lock);
1431 1431
1432 core_disable_device_list_for_node(lun, NULL, lacl->mapped_lun, 1432 core_disable_device_list_for_node(lun, NULL, lacl->mapped_lun,
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 9e0232cca92e..7e6b857c6b3f 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -323,7 +323,7 @@ static void iblock_bio_done(struct bio *bio, int err)
323 * Bump the ib_bio_err_cnt and release bio. 323 * Bump the ib_bio_err_cnt and release bio.
324 */ 324 */
325 atomic_inc(&ibr->ib_bio_err_cnt); 325 atomic_inc(&ibr->ib_bio_err_cnt);
326 smp_mb__after_atomic_inc(); 326 smp_mb__after_atomic();
327 } 327 }
328 328
329 bio_put(bio); 329 bio_put(bio);
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 3013287a2aaa..df357862286e 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -675,7 +675,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
675 spin_lock(&dev->se_port_lock); 675 spin_lock(&dev->se_port_lock);
676 list_for_each_entry_safe(port, port_tmp, &dev->dev_sep_list, sep_list) { 676 list_for_each_entry_safe(port, port_tmp, &dev->dev_sep_list, sep_list) {
677 atomic_inc(&port->sep_tg_pt_ref_cnt); 677 atomic_inc(&port->sep_tg_pt_ref_cnt);
678 smp_mb__after_atomic_inc(); 678 smp_mb__after_atomic();
679 spin_unlock(&dev->se_port_lock); 679 spin_unlock(&dev->se_port_lock);
680 680
681 spin_lock_bh(&port->sep_alua_lock); 681 spin_lock_bh(&port->sep_alua_lock);
@@ -710,7 +710,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
710 continue; 710 continue;
711 711
712 atomic_inc(&deve_tmp->pr_ref_count); 712 atomic_inc(&deve_tmp->pr_ref_count);
713 smp_mb__after_atomic_inc(); 713 smp_mb__after_atomic();
714 spin_unlock_bh(&port->sep_alua_lock); 714 spin_unlock_bh(&port->sep_alua_lock);
715 /* 715 /*
716 * Grab a configfs group dependency that is released 716 * Grab a configfs group dependency that is released
@@ -723,9 +723,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
723 pr_err("core_scsi3_lunacl_depend" 723 pr_err("core_scsi3_lunacl_depend"
724 "_item() failed\n"); 724 "_item() failed\n");
725 atomic_dec(&port->sep_tg_pt_ref_cnt); 725 atomic_dec(&port->sep_tg_pt_ref_cnt);
726 smp_mb__after_atomic_dec(); 726 smp_mb__after_atomic();
727 atomic_dec(&deve_tmp->pr_ref_count); 727 atomic_dec(&deve_tmp->pr_ref_count);
728 smp_mb__after_atomic_dec(); 728 smp_mb__after_atomic();
729 goto out; 729 goto out;
730 } 730 }
731 /* 731 /*
@@ -740,9 +740,9 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
740 sa_res_key, all_tg_pt, aptpl); 740 sa_res_key, all_tg_pt, aptpl);
741 if (!pr_reg_atp) { 741 if (!pr_reg_atp) {
742 atomic_dec(&port->sep_tg_pt_ref_cnt); 742 atomic_dec(&port->sep_tg_pt_ref_cnt);
743 smp_mb__after_atomic_dec(); 743 smp_mb__after_atomic();
744 atomic_dec(&deve_tmp->pr_ref_count); 744 atomic_dec(&deve_tmp->pr_ref_count);
745 smp_mb__after_atomic_dec(); 745 smp_mb__after_atomic();
746 core_scsi3_lunacl_undepend_item(deve_tmp); 746 core_scsi3_lunacl_undepend_item(deve_tmp);
747 goto out; 747 goto out;
748 } 748 }
@@ -755,7 +755,7 @@ static struct t10_pr_registration *__core_scsi3_alloc_registration(
755 755
756 spin_lock(&dev->se_port_lock); 756 spin_lock(&dev->se_port_lock);
757 atomic_dec(&port->sep_tg_pt_ref_cnt); 757 atomic_dec(&port->sep_tg_pt_ref_cnt);
758 smp_mb__after_atomic_dec(); 758 smp_mb__after_atomic();
759 } 759 }
760 spin_unlock(&dev->se_port_lock); 760 spin_unlock(&dev->se_port_lock);
761 761
@@ -1110,7 +1110,7 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg(
1110 continue; 1110 continue;
1111 } 1111 }
1112 atomic_inc(&pr_reg->pr_res_holders); 1112 atomic_inc(&pr_reg->pr_res_holders);
1113 smp_mb__after_atomic_inc(); 1113 smp_mb__after_atomic();
1114 spin_unlock(&pr_tmpl->registration_lock); 1114 spin_unlock(&pr_tmpl->registration_lock);
1115 return pr_reg; 1115 return pr_reg;
1116 } 1116 }
@@ -1125,7 +1125,7 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg(
1125 continue; 1125 continue;
1126 1126
1127 atomic_inc(&pr_reg->pr_res_holders); 1127 atomic_inc(&pr_reg->pr_res_holders);
1128 smp_mb__after_atomic_inc(); 1128 smp_mb__after_atomic();
1129 spin_unlock(&pr_tmpl->registration_lock); 1129 spin_unlock(&pr_tmpl->registration_lock);
1130 return pr_reg; 1130 return pr_reg;
1131 } 1131 }
@@ -1155,7 +1155,7 @@ static struct t10_pr_registration *core_scsi3_locate_pr_reg(
1155static void core_scsi3_put_pr_reg(struct t10_pr_registration *pr_reg) 1155static void core_scsi3_put_pr_reg(struct t10_pr_registration *pr_reg)
1156{ 1156{
1157 atomic_dec(&pr_reg->pr_res_holders); 1157 atomic_dec(&pr_reg->pr_res_holders);
1158 smp_mb__after_atomic_dec(); 1158 smp_mb__after_atomic();
1159} 1159}
1160 1160
1161static int core_scsi3_check_implicit_release( 1161static int core_scsi3_check_implicit_release(
@@ -1349,7 +1349,7 @@ static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg)
1349 &tpg->tpg_group.cg_item); 1349 &tpg->tpg_group.cg_item);
1350 1350
1351 atomic_dec(&tpg->tpg_pr_ref_count); 1351 atomic_dec(&tpg->tpg_pr_ref_count);
1352 smp_mb__after_atomic_dec(); 1352 smp_mb__after_atomic();
1353} 1353}
1354 1354
1355static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) 1355static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl)
@@ -1369,7 +1369,7 @@ static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl)
1369 1369
1370 if (nacl->dynamic_node_acl) { 1370 if (nacl->dynamic_node_acl) {
1371 atomic_dec(&nacl->acl_pr_ref_count); 1371 atomic_dec(&nacl->acl_pr_ref_count);
1372 smp_mb__after_atomic_dec(); 1372 smp_mb__after_atomic();
1373 return; 1373 return;
1374 } 1374 }
1375 1375
@@ -1377,7 +1377,7 @@ static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl)
1377 &nacl->acl_group.cg_item); 1377 &nacl->acl_group.cg_item);
1378 1378
1379 atomic_dec(&nacl->acl_pr_ref_count); 1379 atomic_dec(&nacl->acl_pr_ref_count);
1380 smp_mb__after_atomic_dec(); 1380 smp_mb__after_atomic();
1381} 1381}
1382 1382
1383static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) 1383static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve)
@@ -1408,7 +1408,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve)
1408 */ 1408 */
1409 if (!lun_acl) { 1409 if (!lun_acl) {
1410 atomic_dec(&se_deve->pr_ref_count); 1410 atomic_dec(&se_deve->pr_ref_count);
1411 smp_mb__after_atomic_dec(); 1411 smp_mb__after_atomic();
1412 return; 1412 return;
1413 } 1413 }
1414 nacl = lun_acl->se_lun_nacl; 1414 nacl = lun_acl->se_lun_nacl;
@@ -1418,7 +1418,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve)
1418 &lun_acl->se_lun_group.cg_item); 1418 &lun_acl->se_lun_group.cg_item);
1419 1419
1420 atomic_dec(&se_deve->pr_ref_count); 1420 atomic_dec(&se_deve->pr_ref_count);
1421 smp_mb__after_atomic_dec(); 1421 smp_mb__after_atomic();
1422} 1422}
1423 1423
1424static sense_reason_t 1424static sense_reason_t
@@ -1552,14 +1552,14 @@ core_scsi3_decode_spec_i_port(
1552 continue; 1552 continue;
1553 1553
1554 atomic_inc(&tmp_tpg->tpg_pr_ref_count); 1554 atomic_inc(&tmp_tpg->tpg_pr_ref_count);
1555 smp_mb__after_atomic_inc(); 1555 smp_mb__after_atomic();
1556 spin_unlock(&dev->se_port_lock); 1556 spin_unlock(&dev->se_port_lock);
1557 1557
1558 if (core_scsi3_tpg_depend_item(tmp_tpg)) { 1558 if (core_scsi3_tpg_depend_item(tmp_tpg)) {
1559 pr_err(" core_scsi3_tpg_depend_item()" 1559 pr_err(" core_scsi3_tpg_depend_item()"
1560 " for tmp_tpg\n"); 1560 " for tmp_tpg\n");
1561 atomic_dec(&tmp_tpg->tpg_pr_ref_count); 1561 atomic_dec(&tmp_tpg->tpg_pr_ref_count);
1562 smp_mb__after_atomic_dec(); 1562 smp_mb__after_atomic();
1563 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1563 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
1564 goto out_unmap; 1564 goto out_unmap;
1565 } 1565 }
@@ -1573,7 +1573,7 @@ core_scsi3_decode_spec_i_port(
1573 tmp_tpg, i_str); 1573 tmp_tpg, i_str);
1574 if (dest_node_acl) { 1574 if (dest_node_acl) {
1575 atomic_inc(&dest_node_acl->acl_pr_ref_count); 1575 atomic_inc(&dest_node_acl->acl_pr_ref_count);
1576 smp_mb__after_atomic_inc(); 1576 smp_mb__after_atomic();
1577 } 1577 }
1578 spin_unlock_irq(&tmp_tpg->acl_node_lock); 1578 spin_unlock_irq(&tmp_tpg->acl_node_lock);
1579 1579
@@ -1587,7 +1587,7 @@ core_scsi3_decode_spec_i_port(
1587 pr_err("configfs_depend_item() failed" 1587 pr_err("configfs_depend_item() failed"
1588 " for dest_node_acl->acl_group\n"); 1588 " for dest_node_acl->acl_group\n");
1589 atomic_dec(&dest_node_acl->acl_pr_ref_count); 1589 atomic_dec(&dest_node_acl->acl_pr_ref_count);
1590 smp_mb__after_atomic_dec(); 1590 smp_mb__after_atomic();
1591 core_scsi3_tpg_undepend_item(tmp_tpg); 1591 core_scsi3_tpg_undepend_item(tmp_tpg);
1592 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1592 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
1593 goto out_unmap; 1593 goto out_unmap;
@@ -1647,7 +1647,7 @@ core_scsi3_decode_spec_i_port(
1647 pr_err("core_scsi3_lunacl_depend_item()" 1647 pr_err("core_scsi3_lunacl_depend_item()"
1648 " failed\n"); 1648 " failed\n");
1649 atomic_dec(&dest_se_deve->pr_ref_count); 1649 atomic_dec(&dest_se_deve->pr_ref_count);
1650 smp_mb__after_atomic_dec(); 1650 smp_mb__after_atomic();
1651 core_scsi3_nodeacl_undepend_item(dest_node_acl); 1651 core_scsi3_nodeacl_undepend_item(dest_node_acl);
1652 core_scsi3_tpg_undepend_item(dest_tpg); 1652 core_scsi3_tpg_undepend_item(dest_tpg);
1653 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1653 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
@@ -3168,14 +3168,14 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
3168 continue; 3168 continue;
3169 3169
3170 atomic_inc(&dest_se_tpg->tpg_pr_ref_count); 3170 atomic_inc(&dest_se_tpg->tpg_pr_ref_count);
3171 smp_mb__after_atomic_inc(); 3171 smp_mb__after_atomic();
3172 spin_unlock(&dev->se_port_lock); 3172 spin_unlock(&dev->se_port_lock);
3173 3173
3174 if (core_scsi3_tpg_depend_item(dest_se_tpg)) { 3174 if (core_scsi3_tpg_depend_item(dest_se_tpg)) {
3175 pr_err("core_scsi3_tpg_depend_item() failed" 3175 pr_err("core_scsi3_tpg_depend_item() failed"
3176 " for dest_se_tpg\n"); 3176 " for dest_se_tpg\n");
3177 atomic_dec(&dest_se_tpg->tpg_pr_ref_count); 3177 atomic_dec(&dest_se_tpg->tpg_pr_ref_count);
3178 smp_mb__after_atomic_dec(); 3178 smp_mb__after_atomic();
3179 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 3179 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
3180 goto out_put_pr_reg; 3180 goto out_put_pr_reg;
3181 } 3181 }
@@ -3273,7 +3273,7 @@ after_iport_check:
3273 initiator_str); 3273 initiator_str);
3274 if (dest_node_acl) { 3274 if (dest_node_acl) {
3275 atomic_inc(&dest_node_acl->acl_pr_ref_count); 3275 atomic_inc(&dest_node_acl->acl_pr_ref_count);
3276 smp_mb__after_atomic_inc(); 3276 smp_mb__after_atomic();
3277 } 3277 }
3278 spin_unlock_irq(&dest_se_tpg->acl_node_lock); 3278 spin_unlock_irq(&dest_se_tpg->acl_node_lock);
3279 3279
@@ -3289,7 +3289,7 @@ after_iport_check:
3289 pr_err("core_scsi3_nodeacl_depend_item() for" 3289 pr_err("core_scsi3_nodeacl_depend_item() for"
3290 " dest_node_acl\n"); 3290 " dest_node_acl\n");
3291 atomic_dec(&dest_node_acl->acl_pr_ref_count); 3291 atomic_dec(&dest_node_acl->acl_pr_ref_count);
3292 smp_mb__after_atomic_dec(); 3292 smp_mb__after_atomic();
3293 dest_node_acl = NULL; 3293 dest_node_acl = NULL;
3294 ret = TCM_INVALID_PARAMETER_LIST; 3294 ret = TCM_INVALID_PARAMETER_LIST;
3295 goto out; 3295 goto out;
@@ -3314,7 +3314,7 @@ after_iport_check:
3314 if (core_scsi3_lunacl_depend_item(dest_se_deve)) { 3314 if (core_scsi3_lunacl_depend_item(dest_se_deve)) {
3315 pr_err("core_scsi3_lunacl_depend_item() failed\n"); 3315 pr_err("core_scsi3_lunacl_depend_item() failed\n");
3316 atomic_dec(&dest_se_deve->pr_ref_count); 3316 atomic_dec(&dest_se_deve->pr_ref_count);
3317 smp_mb__after_atomic_dec(); 3317 smp_mb__after_atomic();
3318 dest_se_deve = NULL; 3318 dest_se_deve = NULL;
3319 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 3319 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
3320 goto out; 3320 goto out;
@@ -3880,7 +3880,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
3880 add_desc_len = 0; 3880 add_desc_len = 0;
3881 3881
3882 atomic_inc(&pr_reg->pr_res_holders); 3882 atomic_inc(&pr_reg->pr_res_holders);
3883 smp_mb__after_atomic_inc(); 3883 smp_mb__after_atomic();
3884 spin_unlock(&pr_tmpl->registration_lock); 3884 spin_unlock(&pr_tmpl->registration_lock);
3885 /* 3885 /*
3886 * Determine expected length of $FABRIC_MOD specific 3886 * Determine expected length of $FABRIC_MOD specific
@@ -3894,7 +3894,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
3894 " out of buffer: %d\n", cmd->data_length); 3894 " out of buffer: %d\n", cmd->data_length);
3895 spin_lock(&pr_tmpl->registration_lock); 3895 spin_lock(&pr_tmpl->registration_lock);
3896 atomic_dec(&pr_reg->pr_res_holders); 3896 atomic_dec(&pr_reg->pr_res_holders);
3897 smp_mb__after_atomic_dec(); 3897 smp_mb__after_atomic();
3898 break; 3898 break;
3899 } 3899 }
3900 /* 3900 /*
@@ -3956,7 +3956,7 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
3956 3956
3957 spin_lock(&pr_tmpl->registration_lock); 3957 spin_lock(&pr_tmpl->registration_lock);
3958 atomic_dec(&pr_reg->pr_res_holders); 3958 atomic_dec(&pr_reg->pr_res_holders);
3959 smp_mb__after_atomic_dec(); 3959 smp_mb__after_atomic();
3960 /* 3960 /*
3961 * Set the ADDITIONAL DESCRIPTOR LENGTH 3961 * Set the ADDITIONAL DESCRIPTOR LENGTH
3962 */ 3962 */
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index d4b98690a736..4badca1cd625 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -736,7 +736,7 @@ void target_qf_do_work(struct work_struct *work)
736 list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) { 736 list_for_each_entry_safe(cmd, cmd_tmp, &qf_cmd_list, se_qf_node) {
737 list_del(&cmd->se_qf_node); 737 list_del(&cmd->se_qf_node);
738 atomic_dec(&dev->dev_qf_count); 738 atomic_dec(&dev->dev_qf_count);
739 smp_mb__after_atomic_dec(); 739 smp_mb__after_atomic();
740 740
741 pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue" 741 pr_debug("Processing %s cmd: %p QUEUE_FULL in work queue"
742 " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd, 742 " context: %s\n", cmd->se_tfo->get_fabric_name(), cmd,
@@ -1148,7 +1148,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd)
1148 * Dormant to Active status. 1148 * Dormant to Active status.
1149 */ 1149 */
1150 cmd->se_ordered_id = atomic_inc_return(&dev->dev_ordered_id); 1150 cmd->se_ordered_id = atomic_inc_return(&dev->dev_ordered_id);
1151 smp_mb__after_atomic_inc(); 1151 smp_mb__after_atomic();
1152 pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n", 1152 pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n",
1153 cmd->se_ordered_id, cmd->sam_task_attr, 1153 cmd->se_ordered_id, cmd->sam_task_attr,
1154 dev->transport->name); 1154 dev->transport->name);
@@ -1705,7 +1705,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
1705 return false; 1705 return false;
1706 case MSG_ORDERED_TAG: 1706 case MSG_ORDERED_TAG:
1707 atomic_inc(&dev->dev_ordered_sync); 1707 atomic_inc(&dev->dev_ordered_sync);
1708 smp_mb__after_atomic_inc(); 1708 smp_mb__after_atomic();
1709 1709
1710 pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, " 1710 pr_debug("Added ORDERED for CDB: 0x%02x to ordered list, "
1711 " se_ordered_id: %u\n", 1711 " se_ordered_id: %u\n",
@@ -1723,7 +1723,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
1723 * For SIMPLE and UNTAGGED Task Attribute commands 1723 * For SIMPLE and UNTAGGED Task Attribute commands
1724 */ 1724 */
1725 atomic_inc(&dev->simple_cmds); 1725 atomic_inc(&dev->simple_cmds);
1726 smp_mb__after_atomic_inc(); 1726 smp_mb__after_atomic();
1727 break; 1727 break;
1728 } 1728 }
1729 1729
@@ -1828,7 +1828,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
1828 1828
1829 if (cmd->sam_task_attr == MSG_SIMPLE_TAG) { 1829 if (cmd->sam_task_attr == MSG_SIMPLE_TAG) {
1830 atomic_dec(&dev->simple_cmds); 1830 atomic_dec(&dev->simple_cmds);
1831 smp_mb__after_atomic_dec(); 1831 smp_mb__after_atomic();
1832 dev->dev_cur_ordered_id++; 1832 dev->dev_cur_ordered_id++;
1833 pr_debug("Incremented dev->dev_cur_ordered_id: %u for" 1833 pr_debug("Incremented dev->dev_cur_ordered_id: %u for"
1834 " SIMPLE: %u\n", dev->dev_cur_ordered_id, 1834 " SIMPLE: %u\n", dev->dev_cur_ordered_id,
@@ -1840,7 +1840,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
1840 cmd->se_ordered_id); 1840 cmd->se_ordered_id);
1841 } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { 1841 } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) {
1842 atomic_dec(&dev->dev_ordered_sync); 1842 atomic_dec(&dev->dev_ordered_sync);
1843 smp_mb__after_atomic_dec(); 1843 smp_mb__after_atomic();
1844 1844
1845 dev->dev_cur_ordered_id++; 1845 dev->dev_cur_ordered_id++;
1846 pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" 1846 pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:"
@@ -1899,7 +1899,7 @@ static void transport_handle_queue_full(
1899 spin_lock_irq(&dev->qf_cmd_lock); 1899 spin_lock_irq(&dev->qf_cmd_lock);
1900 list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list); 1900 list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list);
1901 atomic_inc(&dev->dev_qf_count); 1901 atomic_inc(&dev->dev_qf_count);
1902 smp_mb__after_atomic_inc(); 1902 smp_mb__after_atomic();
1903 spin_unlock_irq(&cmd->se_dev->qf_cmd_lock); 1903 spin_unlock_irq(&cmd->se_dev->qf_cmd_lock);
1904 1904
1905 schedule_work(&cmd->se_dev->qf_work_queue); 1905 schedule_work(&cmd->se_dev->qf_work_queue);
@@ -2875,7 +2875,7 @@ void transport_send_task_abort(struct se_cmd *cmd)
2875 if (cmd->se_tfo->write_pending_status(cmd) != 0) { 2875 if (cmd->se_tfo->write_pending_status(cmd) != 0) {
2876 cmd->transport_state |= CMD_T_ABORTED; 2876 cmd->transport_state |= CMD_T_ABORTED;
2877 cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; 2877 cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS;
2878 smp_mb__after_atomic_inc(); 2878 smp_mb__after_atomic();
2879 return; 2879 return;
2880 } 2880 }
2881 } 2881 }
diff --git a/drivers/target/target_core_ua.c b/drivers/target/target_core_ua.c
index 505519b10cb7..101858e245b3 100644
--- a/drivers/target/target_core_ua.c
+++ b/drivers/target/target_core_ua.c
@@ -162,7 +162,7 @@ int core_scsi3_ua_allocate(
162 spin_unlock_irq(&nacl->device_list_lock); 162 spin_unlock_irq(&nacl->device_list_lock);
163 163
164 atomic_inc(&deve->ua_count); 164 atomic_inc(&deve->ua_count);
165 smp_mb__after_atomic_inc(); 165 smp_mb__after_atomic();
166 return 0; 166 return 0;
167 } 167 }
168 list_add_tail(&ua->ua_nacl_list, &deve->ua_list); 168 list_add_tail(&ua->ua_nacl_list, &deve->ua_list);
@@ -175,7 +175,7 @@ int core_scsi3_ua_allocate(
175 asc, ascq); 175 asc, ascq);
176 176
177 atomic_inc(&deve->ua_count); 177 atomic_inc(&deve->ua_count);
178 smp_mb__after_atomic_inc(); 178 smp_mb__after_atomic();
179 return 0; 179 return 0;
180} 180}
181 181
@@ -190,7 +190,7 @@ void core_scsi3_ua_release_all(
190 kmem_cache_free(se_ua_cache, ua); 190 kmem_cache_free(se_ua_cache, ua);
191 191
192 atomic_dec(&deve->ua_count); 192 atomic_dec(&deve->ua_count);
193 smp_mb__after_atomic_dec(); 193 smp_mb__after_atomic();
194 } 194 }
195 spin_unlock(&deve->ua_lock); 195 spin_unlock(&deve->ua_lock);
196} 196}
@@ -251,7 +251,7 @@ void core_scsi3_ua_for_check_condition(
251 kmem_cache_free(se_ua_cache, ua); 251 kmem_cache_free(se_ua_cache, ua);
252 252
253 atomic_dec(&deve->ua_count); 253 atomic_dec(&deve->ua_count);
254 smp_mb__after_atomic_dec(); 254 smp_mb__after_atomic();
255 } 255 }
256 spin_unlock(&deve->ua_lock); 256 spin_unlock(&deve->ua_lock);
257 spin_unlock_irq(&nacl->device_list_lock); 257 spin_unlock_irq(&nacl->device_list_lock);
@@ -310,7 +310,7 @@ int core_scsi3_ua_clear_for_request_sense(
310 kmem_cache_free(se_ua_cache, ua); 310 kmem_cache_free(se_ua_cache, ua);
311 311
312 atomic_dec(&deve->ua_count); 312 atomic_dec(&deve->ua_count);
313 smp_mb__after_atomic_dec(); 313 smp_mb__after_atomic();
314 } 314 }
315 spin_unlock(&deve->ua_lock); 315 spin_unlock(&deve->ua_lock);
316 spin_unlock_irq(&nacl->device_list_lock); 316 spin_unlock_irq(&nacl->device_list_lock);
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 41fe8a047d37..746ae80b972f 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2041,7 +2041,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
2041 2041
2042 if (found) 2042 if (found)
2043 clear_bit(eol, ldata->read_flags); 2043 clear_bit(eol, ldata->read_flags);
2044 smp_mb__after_clear_bit(); 2044 smp_mb__after_atomic();
2045 ldata->read_tail += c; 2045 ldata->read_tail += c;
2046 2046
2047 if (found) { 2047 if (found) {
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index aa97fd845b4d..4b5b3c2fe328 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -200,7 +200,7 @@ static void dma_tx_callback(void *param)
200 200
201 /* clear the bit used to serialize the DMA tx. */ 201 /* clear the bit used to serialize the DMA tx. */
202 clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); 202 clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags);
203 smp_mb__after_clear_bit(); 203 smp_mb__after_atomic();
204 204
205 /* wake up the possible processes. */ 205 /* wake up the possible processes. */
206 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 206 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -275,7 +275,7 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s)
275 mxs_auart_dma_tx(s, i); 275 mxs_auart_dma_tx(s, i);
276 } else { 276 } else {
277 clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags); 277 clear_bit(MXS_AUART_DMA_TX_SYNC, &s->flags);
278 smp_mb__after_clear_bit(); 278 smp_mb__after_atomic();
279 } 279 }
280 return; 280 return;
281 } 281 }
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index f058c0368d61..819875c7e394 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -1851,7 +1851,7 @@ static int usbg_port_link(struct se_portal_group *se_tpg, struct se_lun *lun)
1851 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); 1851 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
1852 1852
1853 atomic_inc(&tpg->tpg_port_count); 1853 atomic_inc(&tpg->tpg_port_count);
1854 smp_mb__after_atomic_inc(); 1854 smp_mb__after_atomic();
1855 return 0; 1855 return 0;
1856} 1856}
1857 1857
@@ -1861,7 +1861,7 @@ static void usbg_port_unlink(struct se_portal_group *se_tpg,
1861 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); 1861 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
1862 1862
1863 atomic_dec(&tpg->tpg_port_count); 1863 atomic_dec(&tpg->tpg_port_count);
1864 smp_mb__after_atomic_dec(); 1864 smp_mb__after_atomic();
1865} 1865}
1866 1866
1867static int usbg_check_stop_free(struct se_cmd *se_cmd) 1867static int usbg_check_stop_free(struct se_cmd *se_cmd)
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 640fe0173236..f1ec1680e822 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -325,7 +325,7 @@ static void usb_wwan_outdat_callback(struct urb *urb)
325 325
326 for (i = 0; i < N_OUT_URB; ++i) { 326 for (i = 0; i < N_OUT_URB; ++i) {
327 if (portdata->out_urbs[i] == urb) { 327 if (portdata->out_urbs[i] == urb) {
328 smp_mb__before_clear_bit(); 328 smp_mb__before_atomic();
329 clear_bit(i, &portdata->out_busy); 329 clear_bit(i, &portdata->out_busy);
330 break; 330 break;
331 } 331 }
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index cf50ce93975b..aeb513108448 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1255,7 +1255,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1255 tpg->tv_tpg_vhost_count++; 1255 tpg->tv_tpg_vhost_count++;
1256 tpg->vhost_scsi = vs; 1256 tpg->vhost_scsi = vs;
1257 vs_tpg[tpg->tport_tpgt] = tpg; 1257 vs_tpg[tpg->tport_tpgt] = tpg;
1258 smp_mb__after_atomic_inc(); 1258 smp_mb__after_atomic();
1259 match = true; 1259 match = true;
1260 } 1260 }
1261 mutex_unlock(&tpg->tv_tpg_mutex); 1261 mutex_unlock(&tpg->tv_tpg_mutex);
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index 3bff6b37b472..3651ec801f45 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -139,9 +139,9 @@ void w1_family_get(struct w1_family *f)
139 139
140void __w1_family_get(struct w1_family *f) 140void __w1_family_get(struct w1_family *f)
141{ 141{
142 smp_mb__before_atomic_inc(); 142 smp_mb__before_atomic();
143 atomic_inc(&f->refcnt); 143 atomic_inc(&f->refcnt);
144 smp_mb__after_atomic_inc(); 144 smp_mb__after_atomic();
145} 145}
146 146
147EXPORT_SYMBOL(w1_unregister_family); 147EXPORT_SYMBOL(w1_unregister_family);
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index 607e41460c0d..c4a0666de6f5 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -348,9 +348,9 @@ void xen_pcibk_do_op(struct work_struct *data)
348 notify_remote_via_irq(pdev->evtchn_irq); 348 notify_remote_via_irq(pdev->evtchn_irq);
349 349
350 /* Mark that we're done. */ 350 /* Mark that we're done. */
351 smp_mb__before_clear_bit(); /* /after/ clearing PCIF_active */ 351 smp_mb__before_atomic(); /* /after/ clearing PCIF_active */
352 clear_bit(_PDEVF_op_active, &pdev->flags); 352 clear_bit(_PDEVF_op_active, &pdev->flags);
353 smp_mb__after_clear_bit(); /* /before/ final check for work */ 353 smp_mb__after_atomic(); /* /before/ final check for work */
354 354
355 /* Check to see if the driver domain tried to start another request in 355 /* Check to see if the driver domain tried to start another request in
356 * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. 356 * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active.
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index c9a24444ec9a..2256e9cceec5 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -279,7 +279,7 @@ static inline void btrfs_inode_block_unlocked_dio(struct inode *inode)
279 279
280static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) 280static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode)
281{ 281{
282 smp_mb__before_clear_bit(); 282 smp_mb__before_atomic();
283 clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, 283 clear_bit(BTRFS_INODE_READDIO_NEED_LOCK,
284 &BTRFS_I(inode)->runtime_flags); 284 &BTRFS_I(inode)->runtime_flags);
285} 285}
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 3955e475ceec..f29a54e454d4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3458,7 +3458,7 @@ static int lock_extent_buffer_for_io(struct extent_buffer *eb,
3458static void end_extent_buffer_writeback(struct extent_buffer *eb) 3458static void end_extent_buffer_writeback(struct extent_buffer *eb)
3459{ 3459{
3460 clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags); 3460 clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
3461 smp_mb__after_clear_bit(); 3461 smp_mb__after_atomic();
3462 wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK); 3462 wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK);
3463} 3463}
3464 3464
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5f805bc944fa..5a3b8371772e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7126,7 +7126,7 @@ static void btrfs_end_dio_bio(struct bio *bio, int err)
7126 * before atomic variable goto zero, we must make sure 7126 * before atomic variable goto zero, we must make sure
7127 * dip->errors is perceived to be set. 7127 * dip->errors is perceived to be set.
7128 */ 7128 */
7129 smp_mb__before_atomic_dec(); 7129 smp_mb__before_atomic();
7130 } 7130 }
7131 7131
7132 /* if there are more bios still pending for this dio, just exit */ 7132 /* if there are more bios still pending for this dio, just exit */
@@ -7306,7 +7306,7 @@ out_err:
7306 * before atomic variable goto zero, we must 7306 * before atomic variable goto zero, we must
7307 * make sure dip->errors is perceived to be set. 7307 * make sure dip->errors is perceived to be set.
7308 */ 7308 */
7309 smp_mb__before_atomic_dec(); 7309 smp_mb__before_atomic();
7310 if (atomic_dec_and_test(&dip->pending_bios)) 7310 if (atomic_dec_and_test(&dip->pending_bios))
7311 bio_io_error(dip->orig_bio); 7311 bio_io_error(dip->orig_bio);
7312 7312
@@ -7449,7 +7449,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
7449 return 0; 7449 return 0;
7450 7450
7451 atomic_inc(&inode->i_dio_count); 7451 atomic_inc(&inode->i_dio_count);
7452 smp_mb__after_atomic_inc(); 7452 smp_mb__after_atomic();
7453 7453
7454 /* 7454 /*
7455 * The generic stuff only does filemap_write_and_wait_range, which 7455 * The generic stuff only does filemap_write_and_wait_range, which
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e79ff6b90cb7..f45040a4bb76 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -642,7 +642,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
642 return -EINVAL; 642 return -EINVAL;
643 643
644 atomic_inc(&root->will_be_snapshoted); 644 atomic_inc(&root->will_be_snapshoted);
645 smp_mb__after_atomic_inc(); 645 smp_mb__after_atomic();
646 btrfs_wait_nocow_write(root); 646 btrfs_wait_nocow_write(root);
647 647
648 ret = btrfs_start_delalloc_inodes(root, 0); 648 ret = btrfs_start_delalloc_inodes(root, 0);
diff --git a/fs/buffer.c b/fs/buffer.c
index 9ddb9fc7d923..6a8110c03a47 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -77,7 +77,7 @@ EXPORT_SYMBOL(__lock_buffer);
77void unlock_buffer(struct buffer_head *bh) 77void unlock_buffer(struct buffer_head *bh)
78{ 78{
79 clear_bit_unlock(BH_Lock, &bh->b_state); 79 clear_bit_unlock(BH_Lock, &bh->b_state);
80 smp_mb__after_clear_bit(); 80 smp_mb__after_atomic();
81 wake_up_bit(&bh->b_state, BH_Lock); 81 wake_up_bit(&bh->b_state, BH_Lock);
82} 82}
83EXPORT_SYMBOL(unlock_buffer); 83EXPORT_SYMBOL(unlock_buffer);
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index f3b84cd9de56..08b3c116915b 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -42,7 +42,7 @@ int ext4_resize_begin(struct super_block *sb)
42void ext4_resize_end(struct super_block *sb) 42void ext4_resize_end(struct super_block *sb)
43{ 43{
44 clear_bit_unlock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags); 44 clear_bit_unlock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags);
45 smp_mb__after_clear_bit(); 45 smp_mb__after_atomic();
46} 46}
47 47
48static ext4_group_t ext4_meta_bg_first_group(struct super_block *sb, 48static ext4_group_t ext4_meta_bg_first_group(struct super_block *sb,
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index aec7f73832f0..c355f7320e44 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -277,7 +277,7 @@ static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holde
277static void gfs2_holder_wake(struct gfs2_holder *gh) 277static void gfs2_holder_wake(struct gfs2_holder *gh)
278{ 278{
279 clear_bit(HIF_WAIT, &gh->gh_iflags); 279 clear_bit(HIF_WAIT, &gh->gh_iflags);
280 smp_mb__after_clear_bit(); 280 smp_mb__after_atomic();
281 wake_up_bit(&gh->gh_iflags, HIF_WAIT); 281 wake_up_bit(&gh->gh_iflags, HIF_WAIT);
282} 282}
283 283
@@ -411,7 +411,7 @@ static void gfs2_demote_wake(struct gfs2_glock *gl)
411{ 411{
412 gl->gl_demote_state = LM_ST_EXCLUSIVE; 412 gl->gl_demote_state = LM_ST_EXCLUSIVE;
413 clear_bit(GLF_DEMOTE, &gl->gl_flags); 413 clear_bit(GLF_DEMOTE, &gl->gl_flags);
414 smp_mb__after_clear_bit(); 414 smp_mb__after_atomic();
415 wake_up_bit(&gl->gl_flags, GLF_DEMOTE); 415 wake_up_bit(&gl->gl_flags, GLF_DEMOTE);
416} 416}
417 417
@@ -620,7 +620,7 @@ out:
620 620
621out_sched: 621out_sched:
622 clear_bit(GLF_LOCK, &gl->gl_flags); 622 clear_bit(GLF_LOCK, &gl->gl_flags);
623 smp_mb__after_clear_bit(); 623 smp_mb__after_atomic();
624 gl->gl_lockref.count++; 624 gl->gl_lockref.count++;
625 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 625 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
626 gl->gl_lockref.count--; 626 gl->gl_lockref.count--;
@@ -628,7 +628,7 @@ out_sched:
628 628
629out_unlock: 629out_unlock:
630 clear_bit(GLF_LOCK, &gl->gl_flags); 630 clear_bit(GLF_LOCK, &gl->gl_flags);
631 smp_mb__after_clear_bit(); 631 smp_mb__after_atomic();
632 return; 632 return;
633} 633}
634 634
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 54b66809e818..74d9a3dbf16f 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -221,7 +221,7 @@ static void inode_go_sync(struct gfs2_glock *gl)
221 * Writeback of the data mapping may cause the dirty flag to be set 221 * Writeback of the data mapping may cause the dirty flag to be set
222 * so we have to clear it again here. 222 * so we have to clear it again here.
223 */ 223 */
224 smp_mb__before_clear_bit(); 224 smp_mb__before_atomic();
225 clear_bit(GLF_DIRTY, &gl->gl_flags); 225 clear_bit(GLF_DIRTY, &gl->gl_flags);
226} 226}
227 227
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index c1eb555dc588..91f274de1246 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1134,7 +1134,7 @@ static void gdlm_recover_done(void *arg, struct dlm_slot *slots, int num_slots,
1134 queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0); 1134 queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0);
1135 1135
1136 clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); 1136 clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags);
1137 smp_mb__after_clear_bit(); 1137 smp_mb__after_atomic();
1138 wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY); 1138 wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY);
1139 spin_unlock(&ls->ls_recover_spin); 1139 spin_unlock(&ls->ls_recover_spin);
1140} 1140}
@@ -1271,7 +1271,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
1271 1271
1272 ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); 1272 ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags);
1273 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); 1273 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags);
1274 smp_mb__after_clear_bit(); 1274 smp_mb__after_atomic();
1275 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); 1275 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID);
1276 return 0; 1276 return 0;
1277 1277
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 7ad4094d68c0..fe7a56fb6084 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -587,7 +587,7 @@ fail:
587 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP); 587 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_GAVEUP);
588done: 588done:
589 clear_bit(JDF_RECOVERY, &jd->jd_flags); 589 clear_bit(JDF_RECOVERY, &jd->jd_flags);
590 smp_mb__after_clear_bit(); 590 smp_mb__after_atomic();
591 wake_up_bit(&jd->jd_flags, JDF_RECOVERY); 591 wake_up_bit(&jd->jd_flags, JDF_RECOVERY);
592} 592}
593 593
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index de25d5577e5d..529d9a9eb897 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -333,7 +333,7 @@ static ssize_t block_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
333 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); 333 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags);
334 else if (val == 0) { 334 else if (val == 0) {
335 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); 335 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags);
336 smp_mb__after_clear_bit(); 336 smp_mb__after_atomic();
337 gfs2_glock_thaw(sdp); 337 gfs2_glock_thaw(sdp);
338 } else { 338 } else {
339 ret = -EINVAL; 339 ret = -EINVAL;
@@ -482,7 +482,7 @@ static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
482 rv = jid = -EINVAL; 482 rv = jid = -EINVAL;
483 sdp->sd_lockstruct.ls_jid = jid; 483 sdp->sd_lockstruct.ls_jid = jid;
484 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); 484 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags);
485 smp_mb__after_clear_bit(); 485 smp_mb__after_atomic();
486 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); 486 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID);
487out: 487out:
488 spin_unlock(&sdp->sd_jindex_spin); 488 spin_unlock(&sdp->sd_jindex_spin);
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 5f26139a165a..6fac74349856 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -43,7 +43,7 @@ static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
43 clear_buffer_uptodate(bh); 43 clear_buffer_uptodate(bh);
44 if (orig_bh) { 44 if (orig_bh) {
45 clear_bit_unlock(BH_Shadow, &orig_bh->b_state); 45 clear_bit_unlock(BH_Shadow, &orig_bh->b_state);
46 smp_mb__after_clear_bit(); 46 smp_mb__after_atomic();
47 wake_up_bit(&orig_bh->b_state, BH_Shadow); 47 wake_up_bit(&orig_bh->b_state, BH_Shadow);
48 } 48 }
49 unlock_buffer(bh); 49 unlock_buffer(bh);
@@ -239,7 +239,7 @@ static int journal_submit_data_buffers(journal_t *journal,
239 spin_lock(&journal->j_list_lock); 239 spin_lock(&journal->j_list_lock);
240 J_ASSERT(jinode->i_transaction == commit_transaction); 240 J_ASSERT(jinode->i_transaction == commit_transaction);
241 clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); 241 clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
242 smp_mb__after_clear_bit(); 242 smp_mb__after_atomic();
243 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); 243 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
244 } 244 }
245 spin_unlock(&journal->j_list_lock); 245 spin_unlock(&journal->j_list_lock);
@@ -277,7 +277,7 @@ static int journal_finish_inode_data_buffers(journal_t *journal,
277 } 277 }
278 spin_lock(&journal->j_list_lock); 278 spin_lock(&journal->j_list_lock);
279 clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); 279 clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags);
280 smp_mb__after_clear_bit(); 280 smp_mb__after_atomic();
281 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); 281 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
282 } 282 }
283 283
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index d9f3d067cd15..4a3d4ef76127 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2032,9 +2032,9 @@ static void nfs_access_free_entry(struct nfs_access_entry *entry)
2032{ 2032{
2033 put_rpccred(entry->cred); 2033 put_rpccred(entry->cred);
2034 kfree(entry); 2034 kfree(entry);
2035 smp_mb__before_atomic_dec(); 2035 smp_mb__before_atomic();
2036 atomic_long_dec(&nfs_access_nr_entries); 2036 atomic_long_dec(&nfs_access_nr_entries);
2037 smp_mb__after_atomic_dec(); 2037 smp_mb__after_atomic();
2038} 2038}
2039 2039
2040static void nfs_access_free_list(struct list_head *head) 2040static void nfs_access_free_list(struct list_head *head)
@@ -2082,9 +2082,9 @@ nfs_access_cache_scan(struct shrinker *shrink, struct shrink_control *sc)
2082 else { 2082 else {
2083remove_lru_entry: 2083remove_lru_entry:
2084 list_del_init(&nfsi->access_cache_inode_lru); 2084 list_del_init(&nfsi->access_cache_inode_lru);
2085 smp_mb__before_clear_bit(); 2085 smp_mb__before_atomic();
2086 clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags); 2086 clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags);
2087 smp_mb__after_clear_bit(); 2087 smp_mb__after_atomic();
2088 } 2088 }
2089 spin_unlock(&inode->i_lock); 2089 spin_unlock(&inode->i_lock);
2090 } 2090 }
@@ -2232,9 +2232,9 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set)
2232 nfs_access_add_rbtree(inode, cache); 2232 nfs_access_add_rbtree(inode, cache);
2233 2233
2234 /* Update accounting */ 2234 /* Update accounting */
2235 smp_mb__before_atomic_inc(); 2235 smp_mb__before_atomic();
2236 atomic_long_inc(&nfs_access_nr_entries); 2236 atomic_long_inc(&nfs_access_nr_entries);
2237 smp_mb__after_atomic_inc(); 2237 smp_mb__after_atomic();
2238 2238
2239 /* Add inode to global LRU list */ 2239 /* Add inode to global LRU list */
2240 if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) { 2240 if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) {
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 0c438973f3c8..e6f7398d2b3c 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1085,7 +1085,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
1085 trace_nfs_invalidate_mapping_exit(inode, ret); 1085 trace_nfs_invalidate_mapping_exit(inode, ret);
1086 1086
1087 clear_bit_unlock(NFS_INO_INVALIDATING, bitlock); 1087 clear_bit_unlock(NFS_INO_INVALIDATING, bitlock);
1088 smp_mb__after_clear_bit(); 1088 smp_mb__after_atomic();
1089 wake_up_bit(bitlock, NFS_INO_INVALIDATING); 1089 wake_up_bit(bitlock, NFS_INO_INVALIDATING);
1090out: 1090out:
1091 return ret; 1091 return ret;
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index efac602edb37..b9c61efe9660 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -789,9 +789,9 @@ static void nfs4_wait_ds_connect(struct nfs4_pnfs_ds *ds)
789 789
790static void nfs4_clear_ds_conn_bit(struct nfs4_pnfs_ds *ds) 790static void nfs4_clear_ds_conn_bit(struct nfs4_pnfs_ds *ds)
791{ 791{
792 smp_mb__before_clear_bit(); 792 smp_mb__before_atomic();
793 clear_bit(NFS4DS_CONNECTING, &ds->ds_state); 793 clear_bit(NFS4DS_CONNECTING, &ds->ds_state);
794 smp_mb__after_clear_bit(); 794 smp_mb__after_atomic();
795 wake_up_bit(&ds->ds_state, NFS4DS_CONNECTING); 795 wake_up_bit(&ds->ds_state, NFS4DS_CONNECTING);
796} 796}
797 797
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 2349518eef2c..c0583b9bef71 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1140,9 +1140,9 @@ static int nfs4_run_state_manager(void *);
1140 1140
1141static void nfs4_clear_state_manager_bit(struct nfs_client *clp) 1141static void nfs4_clear_state_manager_bit(struct nfs_client *clp)
1142{ 1142{
1143 smp_mb__before_clear_bit(); 1143 smp_mb__before_atomic();
1144 clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); 1144 clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
1145 smp_mb__after_clear_bit(); 1145 smp_mb__after_atomic();
1146 wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING); 1146 wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING);
1147 rpc_wake_up(&clp->cl_rpcwaitq); 1147 rpc_wake_up(&clp->cl_rpcwaitq);
1148} 1148}
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 2ffebf2081ce..03ed984ab4d8 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -95,7 +95,7 @@ nfs_iocounter_dec(struct nfs_io_counter *c)
95{ 95{
96 if (atomic_dec_and_test(&c->io_count)) { 96 if (atomic_dec_and_test(&c->io_count)) {
97 clear_bit(NFS_IO_INPROGRESS, &c->flags); 97 clear_bit(NFS_IO_INPROGRESS, &c->flags);
98 smp_mb__after_clear_bit(); 98 smp_mb__after_atomic();
99 wake_up_bit(&c->flags, NFS_IO_INPROGRESS); 99 wake_up_bit(&c->flags, NFS_IO_INPROGRESS);
100 } 100 }
101} 101}
@@ -193,9 +193,9 @@ void nfs_unlock_request(struct nfs_page *req)
193 printk(KERN_ERR "NFS: Invalid unlock attempted\n"); 193 printk(KERN_ERR "NFS: Invalid unlock attempted\n");
194 BUG(); 194 BUG();
195 } 195 }
196 smp_mb__before_clear_bit(); 196 smp_mb__before_atomic();
197 clear_bit(PG_BUSY, &req->wb_flags); 197 clear_bit(PG_BUSY, &req->wb_flags);
198 smp_mb__after_clear_bit(); 198 smp_mb__after_atomic();
199 wake_up_bit(&req->wb_flags, PG_BUSY); 199 wake_up_bit(&req->wb_flags, PG_BUSY);
200} 200}
201 201
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index cb53d450ae32..fd9536e494bc 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1810,7 +1810,7 @@ static void pnfs_clear_layoutcommitting(struct inode *inode)
1810 unsigned long *bitlock = &NFS_I(inode)->flags; 1810 unsigned long *bitlock = &NFS_I(inode)->flags;
1811 1811
1812 clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock); 1812 clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock);
1813 smp_mb__after_clear_bit(); 1813 smp_mb__after_atomic();
1814 wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING); 1814 wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING);
1815} 1815}
1816 1816
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 023793909778..c3058a076596 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -275,7 +275,7 @@ pnfs_get_lseg(struct pnfs_layout_segment *lseg)
275{ 275{
276 if (lseg) { 276 if (lseg) {
277 atomic_inc(&lseg->pls_refcount); 277 atomic_inc(&lseg->pls_refcount);
278 smp_mb__after_atomic_inc(); 278 smp_mb__after_atomic();
279 } 279 }
280 return lseg; 280 return lseg;
281} 281}
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 9a3b6a4cd6b9..ffb9459f180b 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -405,7 +405,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
405 nfs_pageio_complete(&pgio); 405 nfs_pageio_complete(&pgio);
406 406
407 clear_bit_unlock(NFS_INO_FLUSHING, bitlock); 407 clear_bit_unlock(NFS_INO_FLUSHING, bitlock);
408 smp_mb__after_clear_bit(); 408 smp_mb__after_atomic();
409 wake_up_bit(bitlock, NFS_INO_FLUSHING); 409 wake_up_bit(bitlock, NFS_INO_FLUSHING);
410 410
411 if (err < 0) 411 if (err < 0)
@@ -1458,7 +1458,7 @@ static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
1458static void nfs_commit_clear_lock(struct nfs_inode *nfsi) 1458static void nfs_commit_clear_lock(struct nfs_inode *nfsi)
1459{ 1459{
1460 clear_bit(NFS_INO_COMMIT, &nfsi->flags); 1460 clear_bit(NFS_INO_COMMIT, &nfsi->flags);
1461 smp_mb__after_clear_bit(); 1461 smp_mb__after_atomic();
1462 wake_up_bit(&nfsi->flags, NFS_INO_COMMIT); 1462 wake_up_bit(&nfsi->flags, NFS_INO_COMMIT);
1463} 1463}
1464 1464
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 4b826abb1528..45d4e96a6bac 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -460,9 +460,9 @@ static int write_cnodes(struct ubifs_info *c)
460 * important. 460 * important.
461 */ 461 */
462 clear_bit(DIRTY_CNODE, &cnode->flags); 462 clear_bit(DIRTY_CNODE, &cnode->flags);
463 smp_mb__before_clear_bit(); 463 smp_mb__before_atomic();
464 clear_bit(COW_CNODE, &cnode->flags); 464 clear_bit(COW_CNODE, &cnode->flags);
465 smp_mb__after_clear_bit(); 465 smp_mb__after_atomic();
466 offs += len; 466 offs += len;
467 dbg_chk_lpt_sz(c, 1, len); 467 dbg_chk_lpt_sz(c, 1, len);
468 cnode = cnode->cnext; 468 cnode = cnode->cnext;
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 52a6559275c4..3600994f8411 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -895,9 +895,9 @@ static int write_index(struct ubifs_info *c)
895 * the reason for the second barrier. 895 * the reason for the second barrier.
896 */ 896 */
897 clear_bit(DIRTY_ZNODE, &znode->flags); 897 clear_bit(DIRTY_ZNODE, &znode->flags);
898 smp_mb__before_clear_bit(); 898 smp_mb__before_atomic();
899 clear_bit(COW_ZNODE, &znode->flags); 899 clear_bit(COW_ZNODE, &znode->flags);
900 smp_mb__after_clear_bit(); 900 smp_mb__after_atomic();
901 901
902 /* 902 /*
903 * We have marked the znode as clean but have not updated the 903 * We have marked the znode as clean but have not updated the
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index 9ae6c34dc191..49673510b484 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -80,7 +80,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr)
80 * 80 *
81 * clear_bit() is atomic and may not be reordered. However, it does 81 * clear_bit() is atomic and may not be reordered. However, it does
82 * not contain a memory barrier, so if it is used for locking purposes, 82 * not contain a memory barrier, so if it is used for locking purposes,
83 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() 83 * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic()
84 * in order to ensure changes are visible on other processors. 84 * in order to ensure changes are visible on other processors.
85 */ 85 */
86static inline void clear_bit(int nr, volatile unsigned long *addr) 86static inline void clear_bit(int nr, volatile unsigned long *addr)
diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h
index 308a9e22c802..c30266e94806 100644
--- a/include/asm-generic/bitops/lock.h
+++ b/include/asm-generic/bitops/lock.h
@@ -20,7 +20,7 @@
20 */ 20 */
21#define clear_bit_unlock(nr, addr) \ 21#define clear_bit_unlock(nr, addr) \
22do { \ 22do { \
23 smp_mb__before_clear_bit(); \ 23 smp_mb__before_atomic(); \
24 clear_bit(nr, addr); \ 24 clear_bit(nr, addr); \
25} while (0) 25} while (0)
26 26
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c40302f909ce..7cbf837a279c 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -278,7 +278,7 @@ static inline void get_bh(struct buffer_head *bh)
278 278
279static inline void put_bh(struct buffer_head *bh) 279static inline void put_bh(struct buffer_head *bh)
280{ 280{
281 smp_mb__before_atomic_dec(); 281 smp_mb__before_atomic();
282 atomic_dec(&bh->b_count); 282 atomic_dec(&bh->b_count);
283} 283}
284 284
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9f3c275e053e..ec274e0f4ed2 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -649,7 +649,7 @@ static inline void hd_ref_init(struct hd_struct *part)
649static inline void hd_struct_get(struct hd_struct *part) 649static inline void hd_struct_get(struct hd_struct *part)
650{ 650{
651 atomic_inc(&part->ref); 651 atomic_inc(&part->ref);
652 smp_mb__after_atomic_inc(); 652 smp_mb__after_atomic();
653} 653}
654 654
655static inline int hd_struct_try_get(struct hd_struct *part) 655static inline int hd_struct_try_get(struct hd_struct *part)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c7bfac1c4a7b..157111043281 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -453,7 +453,7 @@ static inline int tasklet_trylock(struct tasklet_struct *t)
453 453
454static inline void tasklet_unlock(struct tasklet_struct *t) 454static inline void tasklet_unlock(struct tasklet_struct *t)
455{ 455{
456 smp_mb__before_clear_bit(); 456 smp_mb__before_atomic();
457 clear_bit(TASKLET_STATE_RUN, &(t)->state); 457 clear_bit(TASKLET_STATE_RUN, &(t)->state);
458} 458}
459 459
@@ -501,7 +501,7 @@ static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
501static inline void tasklet_disable_nosync(struct tasklet_struct *t) 501static inline void tasklet_disable_nosync(struct tasklet_struct *t)
502{ 502{
503 atomic_inc(&t->count); 503 atomic_inc(&t->count);
504 smp_mb__after_atomic_inc(); 504 smp_mb__after_atomic();
505} 505}
506 506
507static inline void tasklet_disable(struct tasklet_struct *t) 507static inline void tasklet_disable(struct tasklet_struct *t)
@@ -513,13 +513,13 @@ static inline void tasklet_disable(struct tasklet_struct *t)
513 513
514static inline void tasklet_enable(struct tasklet_struct *t) 514static inline void tasklet_enable(struct tasklet_struct *t)
515{ 515{
516 smp_mb__before_atomic_dec(); 516 smp_mb__before_atomic();
517 atomic_dec(&t->count); 517 atomic_dec(&t->count);
518} 518}
519 519
520static inline void tasklet_hi_enable(struct tasklet_struct *t) 520static inline void tasklet_hi_enable(struct tasklet_struct *t)
521{ 521{
522 smp_mb__before_atomic_dec(); 522 smp_mb__before_atomic();
523 atomic_dec(&t->count); 523 atomic_dec(&t->count);
524} 524}
525 525
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7ed3a3aa6604..616415a4fee4 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -493,7 +493,7 @@ static inline void napi_disable(struct napi_struct *n)
493static inline void napi_enable(struct napi_struct *n) 493static inline void napi_enable(struct napi_struct *n)
494{ 494{
495 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 495 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
496 smp_mb__before_clear_bit(); 496 smp_mb__before_atomic();
497 clear_bit(NAPI_STATE_SCHED, &n->state); 497 clear_bit(NAPI_STATE_SCHED, &n->state);
498} 498}
499 499
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 25f54c79f757..010cde3b44cb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2782,10 +2782,8 @@ static inline bool __must_check current_set_polling_and_test(void)
2782 /* 2782 /*
2783 * Polling state must be visible before we test NEED_RESCHED, 2783 * Polling state must be visible before we test NEED_RESCHED,
2784 * paired by resched_task() 2784 * paired by resched_task()
2785 *
2786 * XXX: assumes set/clear bit are identical barrier wise.
2787 */ 2785 */
2788 smp_mb__after_clear_bit(); 2786 smp_mb__after_atomic();
2789 2787
2790 return unlikely(tif_need_resched()); 2788 return unlikely(tif_need_resched());
2791} 2789}
@@ -2803,7 +2801,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2803 * Polling state must be visible before we test NEED_RESCHED, 2801 * Polling state must be visible before we test NEED_RESCHED,
2804 * paired by resched_task() 2802 * paired by resched_task()
2805 */ 2803 */
2806 smp_mb__after_clear_bit(); 2804 smp_mb__after_atomic();
2807 2805
2808 return unlikely(tif_need_resched()); 2806 return unlikely(tif_need_resched());
2809} 2807}
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 3a847de83fab..ad7dbe2cfecd 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -142,18 +142,18 @@ struct rpc_task_setup {
142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
143#define rpc_clear_running(t) \ 143#define rpc_clear_running(t) \
144 do { \ 144 do { \
145 smp_mb__before_clear_bit(); \ 145 smp_mb__before_atomic(); \
146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ 146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \
147 smp_mb__after_clear_bit(); \ 147 smp_mb__after_atomic(); \
148 } while (0) 148 } while (0)
149 149
150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
152#define rpc_clear_queued(t) \ 152#define rpc_clear_queued(t) \
153 do { \ 153 do { \
154 smp_mb__before_clear_bit(); \ 154 smp_mb__before_atomic(); \
155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ 155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \
156 smp_mb__after_clear_bit(); \ 156 smp_mb__after_atomic(); \
157 } while (0) 157 } while (0)
158 158
159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3e5efb2b236e..3876f0f1dfd3 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -379,9 +379,9 @@ static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt)
379 379
380static inline void xprt_clear_connecting(struct rpc_xprt *xprt) 380static inline void xprt_clear_connecting(struct rpc_xprt *xprt)
381{ 381{
382 smp_mb__before_clear_bit(); 382 smp_mb__before_atomic();
383 clear_bit(XPRT_CONNECTING, &xprt->state); 383 clear_bit(XPRT_CONNECTING, &xprt->state);
384 smp_mb__after_clear_bit(); 384 smp_mb__after_atomic();
385} 385}
386 386
387static inline int xprt_connecting(struct rpc_xprt *xprt) 387static inline int xprt_connecting(struct rpc_xprt *xprt)
@@ -411,9 +411,9 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt)
411 411
412static inline void xprt_clear_binding(struct rpc_xprt *xprt) 412static inline void xprt_clear_binding(struct rpc_xprt *xprt)
413{ 413{
414 smp_mb__before_clear_bit(); 414 smp_mb__before_atomic();
415 clear_bit(XPRT_BINDING, &xprt->state); 415 clear_bit(XPRT_BINDING, &xprt->state);
416 smp_mb__after_clear_bit(); 416 smp_mb__after_atomic();
417} 417}
418 418
419static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) 419static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 1e98b5530425..6f8ab7da27c4 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -191,7 +191,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
191 * pairs with task_work_add()->set_notify_resume() after 191 * pairs with task_work_add()->set_notify_resume() after
192 * hlist_add_head(task->task_works); 192 * hlist_add_head(task->task_works);
193 */ 193 */
194 smp_mb__after_clear_bit(); 194 smp_mb__after_atomic();
195 if (unlikely(current->task_works)) 195 if (unlikely(current->task_works))
196 task_work_run(); 196 task_work_run();
197} 197}
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 5679d927562b..624a8a54806d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1204,7 +1204,7 @@ static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp)
1204/* put back the conn without restarting its timer */ 1204/* put back the conn without restarting its timer */
1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1206{ 1206{
1207 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic();
1208 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1209} 1209}
1210void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
@@ -1408,7 +1408,7 @@ static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1408 1408
1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest) 1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1410{ 1410{
1411 smp_mb__before_atomic_dec(); 1411 smp_mb__before_atomic();
1412 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1413} 1413}
1414 1414
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 2956c8da1605..1adf62b39b96 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -534,7 +534,7 @@ return_normal:
534 kgdb_info[cpu].exception_state &= 534 kgdb_info[cpu].exception_state &=
535 ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); 535 ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE);
536 kgdb_info[cpu].enter_kgdb--; 536 kgdb_info[cpu].enter_kgdb--;
537 smp_mb__before_atomic_dec(); 537 smp_mb__before_atomic();
538 atomic_dec(&slaves_in_kgdb); 538 atomic_dec(&slaves_in_kgdb);
539 dbg_touch_watchdogs(); 539 dbg_touch_watchdogs();
540 local_irq_restore(flags); 540 local_irq_restore(flags);
@@ -662,7 +662,7 @@ kgdb_restore:
662 kgdb_info[cpu].exception_state &= 662 kgdb_info[cpu].exception_state &=
663 ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); 663 ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE);
664 kgdb_info[cpu].enter_kgdb--; 664 kgdb_info[cpu].enter_kgdb--;
665 smp_mb__before_atomic_dec(); 665 smp_mb__before_atomic();
666 atomic_dec(&masters_in_kgdb); 666 atomic_dec(&masters_in_kgdb);
667 /* Free kgdb_active */ 667 /* Free kgdb_active */
668 atomic_set(&kgdb_active, -1); 668 atomic_set(&kgdb_active, -1);
diff --git a/kernel/futex.c b/kernel/futex.c
index 5f589279e462..b991ec05b8f9 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -267,7 +267,7 @@ static inline void futex_get_mm(union futex_key *key)
267 * get_futex_key() implies a full barrier. This is relied upon 267 * get_futex_key() implies a full barrier. This is relied upon
268 * as full barrier (B), see the ordering comment above. 268 * as full barrier (B), see the ordering comment above.
269 */ 269 */
270 smp_mb__after_atomic_inc(); 270 smp_mb__after_atomic();
271} 271}
272 272
273/* 273/*
@@ -280,7 +280,7 @@ static inline void hb_waiters_inc(struct futex_hash_bucket *hb)
280 /* 280 /*
281 * Full barrier (A), see the ordering comment above. 281 * Full barrier (A), see the ordering comment above.
282 */ 282 */
283 smp_mb__after_atomic_inc(); 283 smp_mb__after_atomic();
284#endif 284#endif
285} 285}
286 286
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 6b375af4958d..0ac67a5861c5 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -498,7 +498,7 @@ int __usermodehelper_disable(enum umh_disable_depth depth)
498static void helper_lock(void) 498static void helper_lock(void)
499{ 499{
500 atomic_inc(&running_helpers); 500 atomic_inc(&running_helpers);
501 smp_mb__after_atomic_inc(); 501 smp_mb__after_atomic();
502} 502}
503 503
504static void helper_unlock(void) 504static void helper_unlock(void)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 0c47e300210a..88b4a1dcb58c 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -387,9 +387,9 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval,
387 } 387 }
388 rcu_prepare_for_idle(smp_processor_id()); 388 rcu_prepare_for_idle(smp_processor_id());
389 /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ 389 /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */
390 smp_mb__before_atomic_inc(); /* See above. */ 390 smp_mb__before_atomic(); /* See above. */
391 atomic_inc(&rdtp->dynticks); 391 atomic_inc(&rdtp->dynticks);
392 smp_mb__after_atomic_inc(); /* Force ordering with next sojourn. */ 392 smp_mb__after_atomic(); /* Force ordering with next sojourn. */
393 WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); 393 WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1);
394 394
395 /* 395 /*
@@ -507,10 +507,10 @@ void rcu_irq_exit(void)
507static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval, 507static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval,
508 int user) 508 int user)
509{ 509{
510 smp_mb__before_atomic_inc(); /* Force ordering w/previous sojourn. */ 510 smp_mb__before_atomic(); /* Force ordering w/previous sojourn. */
511 atomic_inc(&rdtp->dynticks); 511 atomic_inc(&rdtp->dynticks);
512 /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ 512 /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */
513 smp_mb__after_atomic_inc(); /* See above. */ 513 smp_mb__after_atomic(); /* See above. */
514 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); 514 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1));
515 rcu_cleanup_after_idle(smp_processor_id()); 515 rcu_cleanup_after_idle(smp_processor_id());
516 trace_rcu_dyntick(TPS("End"), oldval, rdtp->dynticks_nesting); 516 trace_rcu_dyntick(TPS("End"), oldval, rdtp->dynticks_nesting);
@@ -635,10 +635,10 @@ void rcu_nmi_enter(void)
635 (atomic_read(&rdtp->dynticks) & 0x1)) 635 (atomic_read(&rdtp->dynticks) & 0x1))
636 return; 636 return;
637 rdtp->dynticks_nmi_nesting++; 637 rdtp->dynticks_nmi_nesting++;
638 smp_mb__before_atomic_inc(); /* Force delay from prior write. */ 638 smp_mb__before_atomic(); /* Force delay from prior write. */
639 atomic_inc(&rdtp->dynticks); 639 atomic_inc(&rdtp->dynticks);
640 /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */ 640 /* CPUs seeing atomic_inc() must see later RCU read-side crit sects */
641 smp_mb__after_atomic_inc(); /* See above. */ 641 smp_mb__after_atomic(); /* See above. */
642 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1)); 642 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks) & 0x1));
643} 643}
644 644
@@ -657,9 +657,9 @@ void rcu_nmi_exit(void)
657 --rdtp->dynticks_nmi_nesting != 0) 657 --rdtp->dynticks_nmi_nesting != 0)
658 return; 658 return;
659 /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */ 659 /* CPUs seeing atomic_inc() must see prior RCU read-side crit sects */
660 smp_mb__before_atomic_inc(); /* See above. */ 660 smp_mb__before_atomic(); /* See above. */
661 atomic_inc(&rdtp->dynticks); 661 atomic_inc(&rdtp->dynticks);
662 smp_mb__after_atomic_inc(); /* Force delay to next write. */ 662 smp_mb__after_atomic(); /* Force delay to next write. */
663 WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1); 663 WARN_ON_ONCE(atomic_read(&rdtp->dynticks) & 0x1);
664} 664}
665 665
@@ -2790,7 +2790,7 @@ void synchronize_sched_expedited(void)
2790 s = atomic_long_read(&rsp->expedited_done); 2790 s = atomic_long_read(&rsp->expedited_done);
2791 if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { 2791 if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) {
2792 /* ensure test happens before caller kfree */ 2792 /* ensure test happens before caller kfree */
2793 smp_mb__before_atomic_inc(); /* ^^^ */ 2793 smp_mb__before_atomic(); /* ^^^ */
2794 atomic_long_inc(&rsp->expedited_workdone1); 2794 atomic_long_inc(&rsp->expedited_workdone1);
2795 return; 2795 return;
2796 } 2796 }
@@ -2808,7 +2808,7 @@ void synchronize_sched_expedited(void)
2808 s = atomic_long_read(&rsp->expedited_done); 2808 s = atomic_long_read(&rsp->expedited_done);
2809 if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) { 2809 if (ULONG_CMP_GE((ulong)s, (ulong)firstsnap)) {
2810 /* ensure test happens before caller kfree */ 2810 /* ensure test happens before caller kfree */
2811 smp_mb__before_atomic_inc(); /* ^^^ */ 2811 smp_mb__before_atomic(); /* ^^^ */
2812 atomic_long_inc(&rsp->expedited_workdone2); 2812 atomic_long_inc(&rsp->expedited_workdone2);
2813 return; 2813 return;
2814 } 2814 }
@@ -2837,7 +2837,7 @@ void synchronize_sched_expedited(void)
2837 s = atomic_long_read(&rsp->expedited_done); 2837 s = atomic_long_read(&rsp->expedited_done);
2838 if (ULONG_CMP_GE((ulong)s, (ulong)snap)) { 2838 if (ULONG_CMP_GE((ulong)s, (ulong)snap)) {
2839 /* ensure test happens before caller kfree */ 2839 /* ensure test happens before caller kfree */
2840 smp_mb__before_atomic_inc(); /* ^^^ */ 2840 smp_mb__before_atomic(); /* ^^^ */
2841 atomic_long_inc(&rsp->expedited_done_lost); 2841 atomic_long_inc(&rsp->expedited_done_lost);
2842 break; 2842 break;
2843 } 2843 }
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 962d1d589929..56db2f853e43 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2523,9 +2523,9 @@ static void rcu_sysidle_enter(struct rcu_dynticks *rdtp, int irq)
2523 /* Record start of fully idle period. */ 2523 /* Record start of fully idle period. */
2524 j = jiffies; 2524 j = jiffies;
2525 ACCESS_ONCE(rdtp->dynticks_idle_jiffies) = j; 2525 ACCESS_ONCE(rdtp->dynticks_idle_jiffies) = j;
2526 smp_mb__before_atomic_inc(); 2526 smp_mb__before_atomic();
2527 atomic_inc(&rdtp->dynticks_idle); 2527 atomic_inc(&rdtp->dynticks_idle);
2528 smp_mb__after_atomic_inc(); 2528 smp_mb__after_atomic();
2529 WARN_ON_ONCE(atomic_read(&rdtp->dynticks_idle) & 0x1); 2529 WARN_ON_ONCE(atomic_read(&rdtp->dynticks_idle) & 0x1);
2530} 2530}
2531 2531
@@ -2590,9 +2590,9 @@ static void rcu_sysidle_exit(struct rcu_dynticks *rdtp, int irq)
2590 } 2590 }
2591 2591
2592 /* Record end of idle period. */ 2592 /* Record end of idle period. */
2593 smp_mb__before_atomic_inc(); 2593 smp_mb__before_atomic();
2594 atomic_inc(&rdtp->dynticks_idle); 2594 atomic_inc(&rdtp->dynticks_idle);
2595 smp_mb__after_atomic_inc(); 2595 smp_mb__after_atomic();
2596 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks_idle) & 0x1)); 2596 WARN_ON_ONCE(!(atomic_read(&rdtp->dynticks_idle) & 0x1));
2597 2597
2598 /* 2598 /*
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 8b836b376d91..746bc9344969 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -165,7 +165,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri)
165 * do a write memory barrier, and then update the count, to 165 * do a write memory barrier, and then update the count, to
166 * make sure the vector is visible when count is set. 166 * make sure the vector is visible when count is set.
167 */ 167 */
168 smp_mb__before_atomic_inc(); 168 smp_mb__before_atomic();
169 atomic_inc(&(vec)->count); 169 atomic_inc(&(vec)->count);
170 do_mb = 1; 170 do_mb = 1;
171 } 171 }
@@ -185,14 +185,14 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri)
185 * the new priority vec. 185 * the new priority vec.
186 */ 186 */
187 if (do_mb) 187 if (do_mb)
188 smp_mb__after_atomic_inc(); 188 smp_mb__after_atomic();
189 189
190 /* 190 /*
191 * When removing from the vector, we decrement the counter first 191 * When removing from the vector, we decrement the counter first
192 * do a memory barrier and then clear the mask. 192 * do a memory barrier and then clear the mask.
193 */ 193 */
194 atomic_dec(&(vec)->count); 194 atomic_dec(&(vec)->count);
195 smp_mb__after_atomic_inc(); 195 smp_mb__after_atomic();
196 cpumask_clear_cpu(cpu, vec->mask); 196 cpumask_clear_cpu(cpu, vec->mask);
197 } 197 }
198 198
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 7d50f794e248..0ffa20ae657b 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -394,7 +394,7 @@ EXPORT_SYMBOL(__wake_up_bit);
394 * 394 *
395 * In order for this to function properly, as it uses waitqueue_active() 395 * In order for this to function properly, as it uses waitqueue_active()
396 * internally, some kind of memory barrier must be done prior to calling 396 * internally, some kind of memory barrier must be done prior to calling
397 * this. Typically, this will be smp_mb__after_clear_bit(), but in some 397 * this. Typically, this will be smp_mb__after_atomic(), but in some
398 * cases where bitflags are manipulated non-atomically under a lock, one 398 * cases where bitflags are manipulated non-atomically under a lock, one
399 * may need to use a less regular barrier, such fs/inode.c's smp_mb(), 399 * may need to use a less regular barrier, such fs/inode.c's smp_mb(),
400 * because spin_unlock() does not guarantee a memory barrier. 400 * because spin_unlock() does not guarantee a memory barrier.
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 09d9591b7708..1706cbbdf5f0 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -557,7 +557,7 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int sync)
557 bit = sync ? BDI_sync_congested : BDI_async_congested; 557 bit = sync ? BDI_sync_congested : BDI_async_congested;
558 if (test_and_clear_bit(bit, &bdi->state)) 558 if (test_and_clear_bit(bit, &bdi->state))
559 atomic_dec(&nr_bdi_congested[sync]); 559 atomic_dec(&nr_bdi_congested[sync]);
560 smp_mb__after_clear_bit(); 560 smp_mb__after_atomic();
561 if (waitqueue_active(wqh)) 561 if (waitqueue_active(wqh))
562 wake_up(wqh); 562 wake_up(wqh);
563} 563}
diff --git a/mm/filemap.c b/mm/filemap.c
index a82fbe4c9e8e..c73535c914cc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -740,7 +740,7 @@ void unlock_page(struct page *page)
740{ 740{
741 VM_BUG_ON_PAGE(!PageLocked(page), page); 741 VM_BUG_ON_PAGE(!PageLocked(page), page);
742 clear_bit_unlock(PG_locked, &page->flags); 742 clear_bit_unlock(PG_locked, &page->flags);
743 smp_mb__after_clear_bit(); 743 smp_mb__after_atomic();
744 wake_up_page(page, PG_locked); 744 wake_up_page(page, PG_locked);
745} 745}
746EXPORT_SYMBOL(unlock_page); 746EXPORT_SYMBOL(unlock_page);
@@ -757,7 +757,7 @@ void end_page_writeback(struct page *page)
757 if (!test_clear_page_writeback(page)) 757 if (!test_clear_page_writeback(page))
758 BUG(); 758 BUG();
759 759
760 smp_mb__after_clear_bit(); 760 smp_mb__after_atomic();
761 wake_up_page(page, PG_writeback); 761 wake_up_page(page, PG_writeback);
762} 762}
763EXPORT_SYMBOL(end_page_writeback); 763EXPORT_SYMBOL(end_page_writeback);
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 8c93267ce969..c4e09846d1de 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -252,7 +252,7 @@ static int pppoatm_may_send(struct pppoatm_vcc *pvcc, int size)
252 * we need to ensure there's a memory barrier after it. The bit 252 * we need to ensure there's a memory barrier after it. The bit
253 * *must* be set before we do the atomic_inc() on pvcc->inflight. 253 * *must* be set before we do the atomic_inc() on pvcc->inflight.
254 * There's no smp_mb__after_set_bit(), so it's this or abuse 254 * There's no smp_mb__after_set_bit(), so it's this or abuse
255 * smp_mb__after_clear_bit(). 255 * smp_mb__after_atomic().
256 */ 256 */
257 test_and_set_bit(BLOCKED, &pvcc->blocked); 257 test_and_set_bit(BLOCKED, &pvcc->blocked);
258 258
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 49774912cb01..74014420b3c7 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -45,7 +45,7 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
45 return; 45 return;
46 46
47 clear_bit(HCI_INQUIRY, &hdev->flags); 47 clear_bit(HCI_INQUIRY, &hdev->flags);
48 smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ 48 smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */
49 wake_up_bit(&hdev->flags, HCI_INQUIRY); 49 wake_up_bit(&hdev->flags, HCI_INQUIRY);
50 50
51 hci_conn_check_pending(hdev); 51 hci_conn_check_pending(hdev);
@@ -1768,7 +1768,7 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1768 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) 1768 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
1769 return; 1769 return;
1770 1770
1771 smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ 1771 smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */
1772 wake_up_bit(&hdev->flags, HCI_INQUIRY); 1772 wake_up_bit(&hdev->flags, HCI_INQUIRY);
1773 1773
1774 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) 1774 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
diff --git a/net/core/dev.c b/net/core/dev.c
index 5b3042e69f85..e14f1cba591a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1326,7 +1326,7 @@ static int __dev_close_many(struct list_head *head)
1326 * dev->stop() will invoke napi_disable() on all of it's 1326 * dev->stop() will invoke napi_disable() on all of it's
1327 * napi_struct instances on this device. 1327 * napi_struct instances on this device.
1328 */ 1328 */
1329 smp_mb__after_clear_bit(); /* Commit netif_running(). */ 1329 smp_mb__after_atomic(); /* Commit netif_running(). */
1330 } 1330 }
1331 1331
1332 dev_deactivate_many(head); 1332 dev_deactivate_many(head);
@@ -3343,7 +3343,7 @@ static void net_tx_action(struct softirq_action *h)
3343 3343
3344 root_lock = qdisc_lock(q); 3344 root_lock = qdisc_lock(q);
3345 if (spin_trylock(root_lock)) { 3345 if (spin_trylock(root_lock)) {
3346 smp_mb__before_clear_bit(); 3346 smp_mb__before_atomic();
3347 clear_bit(__QDISC_STATE_SCHED, 3347 clear_bit(__QDISC_STATE_SCHED,
3348 &q->state); 3348 &q->state);
3349 qdisc_run(q); 3349 qdisc_run(q);
@@ -3353,7 +3353,7 @@ static void net_tx_action(struct softirq_action *h)
3353 &q->state)) { 3353 &q->state)) {
3354 __netif_reschedule(q); 3354 __netif_reschedule(q);
3355 } else { 3355 } else {
3356 smp_mb__before_clear_bit(); 3356 smp_mb__before_atomic();
3357 clear_bit(__QDISC_STATE_SCHED, 3357 clear_bit(__QDISC_STATE_SCHED,
3358 &q->state); 3358 &q->state);
3359 } 3359 }
@@ -4244,7 +4244,7 @@ void __napi_complete(struct napi_struct *n)
4244 BUG_ON(n->gro_list); 4244 BUG_ON(n->gro_list);
4245 4245
4246 list_del(&n->poll_list); 4246 list_del(&n->poll_list);
4247 smp_mb__before_clear_bit(); 4247 smp_mb__before_atomic();
4248 clear_bit(NAPI_STATE_SCHED, &n->state); 4248 clear_bit(NAPI_STATE_SCHED, &n->state);
4249} 4249}
4250EXPORT_SYMBOL(__napi_complete); 4250EXPORT_SYMBOL(__napi_complete);
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 9c3a839322ba..bd0767e6b2b3 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -147,7 +147,7 @@ static void linkwatch_do_dev(struct net_device *dev)
147 * Make sure the above read is complete since it can be 147 * Make sure the above read is complete since it can be
148 * rewritten as soon as we clear the bit below. 148 * rewritten as soon as we clear the bit below.
149 */ 149 */
150 smp_mb__before_clear_bit(); 150 smp_mb__before_atomic();
151 151
152 /* We are about to handle this device, 152 /* We are about to handle this device,
153 * so new events can be accepted 153 * so new events can be accepted
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 48f424465112..56cd458a1b8c 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -522,7 +522,7 @@ EXPORT_SYMBOL_GPL(inet_getpeer);
522void inet_putpeer(struct inet_peer *p) 522void inet_putpeer(struct inet_peer *p)
523{ 523{
524 p->dtime = (__u32)jiffies; 524 p->dtime = (__u32)jiffies;
525 smp_mb__before_atomic_dec(); 525 smp_mb__before_atomic();
526 atomic_dec(&p->refcnt); 526 atomic_dec(&p->refcnt);
527} 527}
528EXPORT_SYMBOL_GPL(inet_putpeer); 528EXPORT_SYMBOL_GPL(inet_putpeer);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 025e25093984..366cf06587b8 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1930,10 +1930,8 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
1930 /* It is possible TX completion already happened 1930 /* It is possible TX completion already happened
1931 * before we set TSQ_THROTTLED, so we must 1931 * before we set TSQ_THROTTLED, so we must
1932 * test again the condition. 1932 * test again the condition.
1933 * We abuse smp_mb__after_clear_bit() because
1934 * there is no smp_mb__after_set_bit() yet
1935 */ 1933 */
1936 smp_mb__after_clear_bit(); 1934 smp_mb__after_atomic();
1937 if (atomic_read(&sk->sk_wmem_alloc) > limit) 1935 if (atomic_read(&sk->sk_wmem_alloc) > limit)
1938 break; 1936 break;
1939 } 1937 }
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 75421f2ba8be..1f4f954c4b47 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -914,7 +914,7 @@ void nf_conntrack_free(struct nf_conn *ct)
914 nf_ct_ext_destroy(ct); 914 nf_ct_ext_destroy(ct);
915 nf_ct_ext_free(ct); 915 nf_ct_ext_free(ct);
916 kmem_cache_free(net->ct.nf_conntrack_cachep, ct); 916 kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
917 smp_mb__before_atomic_dec(); 917 smp_mb__before_atomic();
918 atomic_dec(&net->ct.count); 918 atomic_dec(&net->ct.count);
919} 919}
920EXPORT_SYMBOL_GPL(nf_conntrack_free); 920EXPORT_SYMBOL_GPL(nf_conntrack_free);
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index b7ebe23cdedf..d67de453c35a 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -598,7 +598,7 @@ static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq,
598{ 598{
599 atomic64_set(&ic->i_ack_next, seq); 599 atomic64_set(&ic->i_ack_next, seq);
600 if (ack_required) { 600 if (ack_required) {
601 smp_mb__before_clear_bit(); 601 smp_mb__before_atomic();
602 set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); 602 set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags);
603 } 603 }
604} 604}
@@ -606,7 +606,7 @@ static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq,
606static u64 rds_ib_get_ack(struct rds_ib_connection *ic) 606static u64 rds_ib_get_ack(struct rds_ib_connection *ic)
607{ 607{
608 clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); 608 clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags);
609 smp_mb__after_clear_bit(); 609 smp_mb__after_atomic();
610 610
611 return atomic64_read(&ic->i_ack_next); 611 return atomic64_read(&ic->i_ack_next);
612} 612}
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c
index 45033358358e..aa8bf6786008 100644
--- a/net/rds/iw_recv.c
+++ b/net/rds/iw_recv.c
@@ -429,7 +429,7 @@ static void rds_iw_set_ack(struct rds_iw_connection *ic, u64 seq,
429{ 429{
430 atomic64_set(&ic->i_ack_next, seq); 430 atomic64_set(&ic->i_ack_next, seq);
431 if (ack_required) { 431 if (ack_required) {
432 smp_mb__before_clear_bit(); 432 smp_mb__before_atomic();
433 set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); 433 set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags);
434 } 434 }
435} 435}
@@ -437,7 +437,7 @@ static void rds_iw_set_ack(struct rds_iw_connection *ic, u64 seq,
437static u64 rds_iw_get_ack(struct rds_iw_connection *ic) 437static u64 rds_iw_get_ack(struct rds_iw_connection *ic)
438{ 438{
439 clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); 439 clear_bit(IB_ACK_REQUESTED, &ic->i_ack_flags);
440 smp_mb__after_clear_bit(); 440 smp_mb__after_atomic();
441 441
442 return atomic64_read(&ic->i_ack_next); 442 return atomic64_read(&ic->i_ack_next);
443} 443}
diff --git a/net/rds/send.c b/net/rds/send.c
index a82fb660ec00..23718160d71e 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -107,7 +107,7 @@ static int acquire_in_xmit(struct rds_connection *conn)
107static void release_in_xmit(struct rds_connection *conn) 107static void release_in_xmit(struct rds_connection *conn)
108{ 108{
109 clear_bit(RDS_IN_XMIT, &conn->c_flags); 109 clear_bit(RDS_IN_XMIT, &conn->c_flags);
110 smp_mb__after_clear_bit(); 110 smp_mb__after_atomic();
111 /* 111 /*
112 * We don't use wait_on_bit()/wake_up_bit() because our waking is in a 112 * We don't use wait_on_bit()/wake_up_bit() because our waking is in a
113 * hot path and finding waiters is very rare. We don't want to walk 113 * hot path and finding waiters is very rare. We don't want to walk
@@ -661,7 +661,7 @@ void rds_send_drop_acked(struct rds_connection *conn, u64 ack,
661 661
662 /* order flag updates with spin locks */ 662 /* order flag updates with spin locks */
663 if (!list_empty(&list)) 663 if (!list_empty(&list))
664 smp_mb__after_clear_bit(); 664 smp_mb__after_atomic();
665 665
666 spin_unlock_irqrestore(&conn->c_lock, flags); 666 spin_unlock_irqrestore(&conn->c_lock, flags);
667 667
@@ -691,7 +691,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
691 } 691 }
692 692
693 /* order flag updates with the rs lock */ 693 /* order flag updates with the rs lock */
694 smp_mb__after_clear_bit(); 694 smp_mb__after_atomic();
695 695
696 spin_unlock_irqrestore(&rs->rs_lock, flags); 696 spin_unlock_irqrestore(&rs->rs_lock, flags);
697 697
diff --git a/net/rds/tcp_send.c b/net/rds/tcp_send.c
index 81cf5a4c5e40..53b17ca0dff5 100644
--- a/net/rds/tcp_send.c
+++ b/net/rds/tcp_send.c
@@ -93,7 +93,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
93 rm->m_ack_seq = tc->t_last_sent_nxt + 93 rm->m_ack_seq = tc->t_last_sent_nxt +
94 sizeof(struct rds_header) + 94 sizeof(struct rds_header) +
95 be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1; 95 be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1;
96 smp_mb__before_clear_bit(); 96 smp_mb__before_atomic();
97 set_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags); 97 set_bit(RDS_MSG_HAS_ACK_SEQ, &rm->m_flags);
98 tc->t_last_expected_una = rm->m_ack_seq + 1; 98 tc->t_last_expected_una = rm->m_ack_seq + 1;
99 99
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 5285ead196c0..247e973544bf 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -296,7 +296,7 @@ static void
296rpcauth_unhash_cred_locked(struct rpc_cred *cred) 296rpcauth_unhash_cred_locked(struct rpc_cred *cred)
297{ 297{
298 hlist_del_rcu(&cred->cr_hash); 298 hlist_del_rcu(&cred->cr_hash);
299 smp_mb__before_clear_bit(); 299 smp_mb__before_atomic();
300 clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); 300 clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags);
301} 301}
302 302
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 36e431ee1c90..b6e440baccc3 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -143,7 +143,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
143 gss_get_ctx(ctx); 143 gss_get_ctx(ctx);
144 rcu_assign_pointer(gss_cred->gc_ctx, ctx); 144 rcu_assign_pointer(gss_cred->gc_ctx, ctx);
145 set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); 145 set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
146 smp_mb__before_clear_bit(); 146 smp_mb__before_atomic();
147 clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); 147 clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags);
148} 148}
149 149
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 3513d559bc45..9761a0da964d 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -244,10 +244,10 @@ void xprt_free_bc_request(struct rpc_rqst *req)
244 dprintk("RPC: free backchannel req=%p\n", req); 244 dprintk("RPC: free backchannel req=%p\n", req);
245 245
246 req->rq_connect_cookie = xprt->connect_cookie - 1; 246 req->rq_connect_cookie = xprt->connect_cookie - 1;
247 smp_mb__before_clear_bit(); 247 smp_mb__before_atomic();
248 WARN_ON_ONCE(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); 248 WARN_ON_ONCE(!test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
249 clear_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); 249 clear_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
250 smp_mb__after_clear_bit(); 250 smp_mb__after_atomic();
251 251
252 if (!xprt_need_to_requeue(xprt)) { 252 if (!xprt_need_to_requeue(xprt)) {
253 /* 253 /*
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index d173f79947c6..89d051de6b3e 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -230,9 +230,9 @@ static void xprt_clear_locked(struct rpc_xprt *xprt)
230{ 230{
231 xprt->snd_task = NULL; 231 xprt->snd_task = NULL;
232 if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) { 232 if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) {
233 smp_mb__before_clear_bit(); 233 smp_mb__before_atomic();
234 clear_bit(XPRT_LOCKED, &xprt->state); 234 clear_bit(XPRT_LOCKED, &xprt->state);
235 smp_mb__after_clear_bit(); 235 smp_mb__after_atomic();
236 } else 236 } else
237 queue_work(rpciod_workqueue, &xprt->task_cleanup); 237 queue_work(rpciod_workqueue, &xprt->task_cleanup);
238} 238}
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 25a3dcf15cae..402a7e9a16b7 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -893,11 +893,11 @@ static void xs_close(struct rpc_xprt *xprt)
893 xs_reset_transport(transport); 893 xs_reset_transport(transport);
894 xprt->reestablish_timeout = 0; 894 xprt->reestablish_timeout = 0;
895 895
896 smp_mb__before_clear_bit(); 896 smp_mb__before_atomic();
897 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); 897 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
898 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 898 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
899 clear_bit(XPRT_CLOSING, &xprt->state); 899 clear_bit(XPRT_CLOSING, &xprt->state);
900 smp_mb__after_clear_bit(); 900 smp_mb__after_atomic();
901 xprt_disconnect_done(xprt); 901 xprt_disconnect_done(xprt);
902} 902}
903 903
@@ -1497,12 +1497,12 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt)
1497 1497
1498static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) 1498static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt)
1499{ 1499{
1500 smp_mb__before_clear_bit(); 1500 smp_mb__before_atomic();
1501 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); 1501 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
1502 clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state); 1502 clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
1503 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 1503 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
1504 clear_bit(XPRT_CLOSING, &xprt->state); 1504 clear_bit(XPRT_CLOSING, &xprt->state);
1505 smp_mb__after_clear_bit(); 1505 smp_mb__after_atomic();
1506} 1506}
1507 1507
1508static void xs_sock_mark_closed(struct rpc_xprt *xprt) 1508static void xs_sock_mark_closed(struct rpc_xprt *xprt)
@@ -1556,10 +1556,10 @@ static void xs_tcp_state_change(struct sock *sk)
1556 xprt->connect_cookie++; 1556 xprt->connect_cookie++;
1557 xprt->reestablish_timeout = 0; 1557 xprt->reestablish_timeout = 0;
1558 set_bit(XPRT_CLOSING, &xprt->state); 1558 set_bit(XPRT_CLOSING, &xprt->state);
1559 smp_mb__before_clear_bit(); 1559 smp_mb__before_atomic();
1560 clear_bit(XPRT_CONNECTED, &xprt->state); 1560 clear_bit(XPRT_CONNECTED, &xprt->state);
1561 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 1561 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
1562 smp_mb__after_clear_bit(); 1562 smp_mb__after_atomic();
1563 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); 1563 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1564 break; 1564 break;
1565 case TCP_CLOSE_WAIT: 1565 case TCP_CLOSE_WAIT:
@@ -1578,9 +1578,9 @@ static void xs_tcp_state_change(struct sock *sk)
1578 case TCP_LAST_ACK: 1578 case TCP_LAST_ACK:
1579 set_bit(XPRT_CLOSING, &xprt->state); 1579 set_bit(XPRT_CLOSING, &xprt->state);
1580 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout); 1580 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1581 smp_mb__before_clear_bit(); 1581 smp_mb__before_atomic();
1582 clear_bit(XPRT_CONNECTED, &xprt->state); 1582 clear_bit(XPRT_CONNECTED, &xprt->state);
1583 smp_mb__after_clear_bit(); 1583 smp_mb__after_atomic();
1584 break; 1584 break;
1585 case TCP_CLOSE: 1585 case TCP_CLOSE:
1586 xs_tcp_cancel_linger_timeout(xprt); 1586 xs_tcp_cancel_linger_timeout(xprt);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index bb7e8ba821f4..749f80c21e22 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1207,7 +1207,7 @@ restart:
1207 sk->sk_state = TCP_ESTABLISHED; 1207 sk->sk_state = TCP_ESTABLISHED;
1208 sock_hold(newsk); 1208 sock_hold(newsk);
1209 1209
1210 smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */ 1210 smp_mb__after_atomic(); /* sock_hold() does an atomic_inc() */
1211 unix_peer(sk) = newsk; 1211 unix_peer(sk) = newsk;
1212 1212
1213 unix_state_unlock(sk); 1213 unix_state_unlock(sk);
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 8546711d12f9..70951fd9b354 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -443,7 +443,7 @@ static int snd_bt87x_pcm_open(struct snd_pcm_substream *substream)
443 443
444_error: 444_error:
445 clear_bit(0, &chip->opened); 445 clear_bit(0, &chip->opened);
446 smp_mb__after_clear_bit(); 446 smp_mb__after_atomic();
447 return err; 447 return err;
448} 448}
449 449
@@ -458,7 +458,7 @@ static int snd_bt87x_close(struct snd_pcm_substream *substream)
458 458
459 chip->substream = NULL; 459 chip->substream = NULL;
460 clear_bit(0, &chip->opened); 460 clear_bit(0, &chip->opened);
461 smp_mb__after_clear_bit(); 461 smp_mb__after_atomic();
462 return 0; 462 return 0;
463} 463}
464 464