Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] NFSv4.x: Fail client initialisation if state manager thread can't run
@ 2022-12-06 19:02 trondmy
  2022-12-09  1:27 ` ChenXiaoSong
  0 siblings, 1 reply; 2+ messages in thread
From: trondmy @ 2022-12-06 19:02 UTC (permalink / raw)
  To: linux-nfs; +Cc: ChenXiaoSong

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

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().

Reported-by: ChenXiaoSong <chenxiaosong2@huawei.com>
Fixes: 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4state.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 7c1f43507813..5720196141e1 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -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);
-- 
2.38.1


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

* Re: [PATCH] NFSv4.x: Fail client initialisation if state manager thread can't run
  2022-12-06 19:02 [PATCH] NFSv4.x: Fail client initialisation if state manager thread can't run trondmy
@ 2022-12-09  1:27 ` ChenXiaoSong
  0 siblings, 0 replies; 2+ messages in thread
From: ChenXiaoSong @ 2022-12-09  1:27 UTC (permalink / raw)
  To: trondmy, linux-nfs

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

在 2022/12/7 3:02, trondmy@kernel.org 写道:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> 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().
> 
> Reported-by: ChenXiaoSong <chenxiaosong2@huawei.com>
> Fixes: 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification")
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>   fs/nfs/nfs4state.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> index 7c1f43507813..5720196141e1 100644
> --- a/fs/nfs/nfs4state.c
> +++ b/fs/nfs/nfs4state.c
> @@ -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);
> 

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

end of thread, other threads:[~2022-12-09  1:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-06 19:02 [PATCH] NFSv4.x: Fail client initialisation if state manager thread can't run trondmy
2022-12-09  1:27 ` ChenXiaoSong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox