Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: trondmy@kernel.org, Omar Sandoval <osandov@osandov.com>
Cc: Chris Mason <clm@meta.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
Date: Sun, 06 Apr 2025 09:16:07 -0400	[thread overview]
Message-ID: <a5c66e082a0b8669c89bb487027da7fac66fa5b6.camel@kernel.org> (raw)
In-Reply-To: <cdb06dc8d5ab3e65db78a78a9ac5969453efe0b5.1743930506.git.trond.myklebust@hammerspace.com>

On Sun, 2025-04-06 at 11:11 +0200, trondmy@kernel.org wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> If we have a fatal ENETDOWN or ENETUNREACH error, then the layoutreturn
> on close code should also handle that as fatal, and free the layouts.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>  fs/nfs/pnfs.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 5f582713bf05..3554046b5bfc 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1659,8 +1659,16 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
>  		break;
>  	case -NFS4ERR_NOMATCHING_LAYOUT:
>  		/* Was there an RPC level error? If not, retry */
> -		if (task->tk_rpc_status == 0)
> +		if (task->tk_rpc_status == 0) {
> +			if ((task->tk_rpc_status == -ENETDOWN ||
> +			     task->tk_rpc_status == -ENETUNREACH) &&
> +			    task->tk_flags & RPC_TASK_NETUNREACH_FATAL) {

You already checked that task->tk_rpc_status is 0, so the inside if
statement will never be true. I think you probably want to get rid if
the outside 

     if (task->tk_rpc_status == 0)

condition?

> +				*ret = 0;
> +				(*respp)->lrs_present = 0;
> +				retval = -EIO;
> +			}
>  			break;
> +		}
>  		/* If the call was not sent, let caller handle it */
>  		if (!RPC_WAS_SENT(task))
>  			return 0;

-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2025-04-06 13:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-06  9:11 [PATCH 0/2] Two more places that need to handle ENETDOWN/ENETUNREACH trondmy
2025-04-06  9:11 ` [PATCH 1/2] NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors trondmy
2025-04-06 13:08   ` Jeff Layton
2025-04-06 15:28     ` Trond Myklebust
2025-04-06  9:11 ` [PATCH 2/2] NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors trondmy
2025-04-06 13:16   ` Jeff Layton [this message]
2025-04-06 15:29     ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5c66e082a0b8669c89bb487027da7fac66fa5b6.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=clm@meta.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=osandov@osandov.com \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox