NFSv4/pnfs: Fix barriers in nfs4_mark_deviceid_unavailable()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 26 Feb 2019 19:27:58 +0000 (14:27 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 1 Mar 2019 21:20:16 +0000 (16:20 -0500)
Fix the memory barriers in nfs4_mark_deviceid_unavailable() and
nfs4_test_deviceid_unavailable().

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/pnfs_dev.c

index 7fb59487ee9049cd3705a3837eaf0296a02824d2..ec6b607ff1d70f39d559a013ac46e22d411ac9d0 100644 (file)
@@ -287,7 +287,9 @@ void
 nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node)
 {
        node->timestamp_unavailable = jiffies;
 nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node)
 {
        node->timestamp_unavailable = jiffies;
+       smp_mb__before_atomic();
        set_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
        set_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
+       smp_mb__after_atomic();
 }
 EXPORT_SYMBOL_GPL(nfs4_mark_deviceid_unavailable);
 
 }
 EXPORT_SYMBOL_GPL(nfs4_mark_deviceid_unavailable);
 
@@ -302,6 +304,7 @@ nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node)
                if (time_in_range(node->timestamp_unavailable, start, end))
                        return true;
                clear_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
                if (time_in_range(node->timestamp_unavailable, start, end))
                        return true;
                clear_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
+               smp_mb__after_atomic();
        }
        return false;
 }
        }
        return false;
 }