linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFSv4: Fix a nfs4_state_manager() race
@ 2023-09-17 23:05 trondmy
  2023-09-17 23:05 ` [PATCH 2/2] NFSv4: Fix a state manager thread deadlock regression trondmy
  2023-09-18  1:17 ` [PATCH 1/2] NFSv4: Fix a nfs4_state_manager() race NeilBrown
  0 siblings, 2 replies; 19+ messages in thread
From: trondmy @ 2023-09-17 23:05 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: linux-nfs, Neil Brown

From: Trond Myklebust <trond.myklebust@hammerspace.com>

If the NFS4CLNT_RUN_MANAGER flag got set just before we cleared
NFS4CLNT_MANAGER_RUNNING, then we might have won the race against
nfs4_schedule_state_manager(), and are responsible for handling the
recovery situation.

Fixes: aeabb3c96186 ("NFSv4: Fix a NFSv4 state manager deadlock")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4state.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index e079987af4a3..0bc160fbabec 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -2703,6 +2703,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
 		nfs4_end_drain_session(clp);
 		nfs4_clear_state_manager_bit(clp);
 
+		if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
+		    !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING,
+				      &clp->cl_state)) {
+			memflags = memalloc_nofs_save();
+			continue;
+		}
+
 		if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
 			if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
 				nfs_client_return_marked_delegations(clp);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-09-26 14:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-17 23:05 [PATCH 1/2] NFSv4: Fix a nfs4_state_manager() race trondmy
2023-09-17 23:05 ` [PATCH 2/2] NFSv4: Fix a state manager thread deadlock regression trondmy
2023-09-18  1:25   ` NeilBrown
2023-09-18  2:27     ` Trond Myklebust
2023-09-20 19:38   ` Anna Schumaker
2023-09-21  0:15     ` Trond Myklebust
2023-09-22 17:22       ` Olga Kornievskaia
2023-09-22 19:05         ` Trond Myklebust
2023-09-22 21:00           ` Olga Kornievskaia
2023-09-22 21:06             ` Trond Myklebust
2023-09-24 17:08               ` Trond Myklebust
2023-09-26 14:55                 ` Anna Schumaker
2023-09-26 14:31               ` Olga Kornievskaia
2023-09-25 22:28           ` NeilBrown
2023-09-25 22:44             ` Trond Myklebust
2023-09-25 23:04               ` NeilBrown
2023-09-25 23:20                 ` Trond Myklebust
2023-09-18  1:17 ` [PATCH 1/2] NFSv4: Fix a nfs4_state_manager() race NeilBrown
2023-09-18  2:20   ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).