diff mbox series

[v2,1/1] NFSD: fix hang in nfsd4_shutdown_callback

Message ID 1738263687-28256-1-git-send-email-dai.ngo@oracle.com (mailing list archive)
State Under Review
Delegated to: Chuck Lever
Headers show
Series [v2,1/1] NFSD: fix hang in nfsd4_shutdown_callback | expand

Commit Message

Dai Ngo Jan. 30, 2025, 7:01 p.m. UTC
If nfs4_client is in courtesy state then there is no point to retry
the callback. This causes nfsd4_shutdown_callback to hang since
cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP
notifies NFSD that the connection was dropped.

This patch modifies nnfsd4_run_cb_work to skip the RPC call if
nfs4_client is in courtesy state.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/nfs4callback.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jeff Layton Jan. 30, 2025, 7:18 p.m. UTC | #1
On Thu, 2025-01-30 at 11:01 -0800, Dai Ngo wrote:
> If nfs4_client is in courtesy state then there is no point to retry
> the callback. This causes nfsd4_shutdown_callback to hang since
> cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP
> notifies NFSD that the connection was dropped.
> 
> This patch modifies nnfsd4_run_cb_work to skip the RPC call if
> nfs4_client is in courtesy state.
> 
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---
>  fs/nfsd/nfs4callback.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index 50e468bdb8d4..cf6d29828f4e 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -1583,8 +1583,11 @@ nfsd4_run_cb_work(struct work_struct *work)
>  		nfsd4_process_cb_update(cb);
>  
>  	clnt = clp->cl_cb_client;
> -	if (!clnt) {
> -		/* Callback channel broken, or client killed; give up: */
> +	if (!clnt || clp->cl_state == NFSD4_COURTESY) {
> +		/*
> +		 * Callback channel broken, client killed or
> +		 * nfs4_client in courtesy state; give up.
> +		 */
>  		nfsd41_destroy_cb(cb);
>  		return;
>  	}

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Chuck Lever Jan. 30, 2025, 7:32 p.m. UTC | #2
For subsequent postings, please send to all NFSD reviewers listed in the
kernel's MAINTAINERS file. Thanks!


On 1/30/25 2:01 PM, Dai Ngo wrote:
> If nfs4_client is in courtesy state then there is no point to retry
> the callback.

Perhaps this should be amended "there is no point to send the callback."
because this revision of the patch affects first transmissions as well
as retries.


> This causes nfsd4_shutdown_callback to hang since
> cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP
> notifies NFSD that the connection was dropped.
> 
> This patch modifies nnfsd4_run_cb_work to skip the RPC call if
> nfs4_client is in courtesy state.
> 

Fixes: 66af25799940 ("NFSD: add courteous server support for thread with
only delegation")
Cc: stable@vger.kernel.org


> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> ---
>  fs/nfsd/nfs4callback.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index 50e468bdb8d4..cf6d29828f4e 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -1583,8 +1583,11 @@ nfsd4_run_cb_work(struct work_struct *work)
>  		nfsd4_process_cb_update(cb);
>  
>  	clnt = clp->cl_cb_client;
> -	if (!clnt) {
> -		/* Callback channel broken, or client killed; give up: */
> +	if (!clnt || clp->cl_state == NFSD4_COURTESY) {
> +		/*
> +		 * Callback channel broken, client killed or
> +		 * nfs4_client in courtesy state; give up.
> +		 */
>  		nfsd41_destroy_cb(cb);
>  		return;
>  	}
Chuck Lever Jan. 30, 2025, 9:04 p.m. UTC | #3
From: Chuck Lever <chuck.lever@oracle.com>

On Thu, 30 Jan 2025 11:01:27 -0800, Dai Ngo wrote:
> If nfs4_client is in courtesy state then there is no point to retry
> the callback. This causes nfsd4_shutdown_callback to hang since
> cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP
> notifies NFSD that the connection was dropped.
> 
> This patch modifies nnfsd4_run_cb_work to skip the RPC call if
> nfs4_client is in courtesy state.
> 
> [...]

Applied to nfsd-testing, thanks!

[1/1] NFSD: fix hang in nfsd4_shutdown_callback
      commit: c1d827093999bd9c19d81b0af4b3034a55b49d5a

--
Chuck Lever
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 50e468bdb8d4..cf6d29828f4e 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1583,8 +1583,11 @@  nfsd4_run_cb_work(struct work_struct *work)
 		nfsd4_process_cb_update(cb);
 
 	clnt = clp->cl_cb_client;
-	if (!clnt) {
-		/* Callback channel broken, or client killed; give up: */
+	if (!clnt || clp->cl_state == NFSD4_COURTESY) {
+		/*
+		 * Callback channel broken, client killed or
+		 * nfs4_client in courtesy state; give up.
+		 */
 		nfsd41_destroy_cb(cb);
 		return;
 	}