Skip to contentSkip to conversation

NFSv4.x: Fail client initialisation if state manager thread can't run

PATCH In review [email protected] 2 participants 2 messages Dec 6, 2022 – Dec 9, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 NFSv4.x: Fail client initialisation if state manager thread can't run

From: Trond Myklebust <[email protected]>

If the state manager thread fails to start, then we should just mark the client initialisation as failed so that other processes or threads don't get stuck in nfs_wait_client_init_complete().

Fixes 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification")
---
 fs/nfs/nfs4state.c | 2 ++
 1 file changed, 2 insertions(+)
fs/nfs/nfs4state.c +2 -0
index 7c1f43507813..5720196141e1 100644
@@ -1230,6 +1230,8 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)
 	if (IS_ERR(task)) {
 		printk(KERN_ERR "%s: kthread_run: %ld\n",
 			__func__, PTR_ERR(task));
+		if (!nfs_client_init_is_complete(clp))
+			nfs_mark_client_ready(clp, PTR_ERR(task));
 		nfs4_clear_state_manager_bit(clp);
 		clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
 		nfs_put_client(clp);
Signature · 1 line
2.38.1
#1 lore raw

NFSv4.0 do not have this bug, maybe the subject shoud begin with "NFS4.1".

Quoted 27 lines · 在 2022/12/7 3:02, [email protected] 写道:

From: Trond Myklebust <[email protected]>

If the state manager thread fails to start, then we should just mark the client initialisation as failed so that other processes or threads don't get stuck in nfs_wait_client_init_complete().

Fixes 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification")
---
  fs/nfs/nfs4state.c | 2 ++
  1 file changed, 2 insertions(+)
fs/nfs/nfs4state.c +2 -0
index 7c1f43507813..5720196141e1 100644
@@ -1230,6 +1230,8 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)
  	if (IS_ERR(task)) {
  		printk(KERN_ERR "%s: kthread_run: %ld\n",
  			__func__, PTR_ERR(task));
+		if (!nfs_client_init_is_complete(clp))
+			nfs_mark_client_ready(clp, PTR_ERR(task));
  		nfs4_clear_state_manager_bit(clp);
  		clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
  		nfs_put_client(clp);