diff mbox series

[09/11] nfs: add memory barrier before calling wake_up_var on cl_state

Message ID 20241206021830.3526922-10-neilb@suse.de (mailing list archive)
State New
Headers show
Series nfs: improve use of wake_up_bit and wake_up_var | expand

Commit Message

NeilBrown Dec. 6, 2024, 2:15 a.m. UTC
After setting NFS4CLNT_RUN_MANAGER we need a full memory barrier before
it is safe to call wake_up_var().  As that setting is "atomic" it is
sufficient to use smp_mb__after_atomic().

Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/nfs/nfs4proc.c  | 1 +
 fs/nfs/nfs4state.c | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 405f17e6e0b4..37c8aa1f3e1b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -10847,6 +10847,7 @@  static void nfs4_disable_swap(struct inode *inode)
 
 	set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
 	clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
+	smp_mb__after_atomic();
 	wake_up_var(&clp->cl_state);
 }
 
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 556b521f17eb..189d7b57cb74 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1207,6 +1207,7 @@  void nfs4_schedule_state_manager(struct nfs_client *clp)
 		swapon = !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE,
 					   &clp->cl_state);
 		if (!swapon) {
+			smp_mb__after_atomic();
 			wake_up_var(&clp->cl_state);
 			return;
 		}