Thread (14 messages) 14 messages, 2 authors, 2025-01-22
STALE522d

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

From: NeilBrown <hidden>
Date: 2024-12-06 02:19:52
Subsystem: filesystems (vfs and infrastructure), nfs, sunrpc, and lockd clients, the rest · Maintainers: Alexander Viro, Christian Brauner, Trond Myklebust, Anna Schumaker, Linus Torvalds

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 <redacted>
---
 fs/nfs/nfs4proc.c  | 1 +
 fs/nfs/nfs4state.c | 1 +
 2 files changed, 2 insertions(+)
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;
 		}
-- 
2.47.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help