linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: trondmy@kernel.org, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/3] NFSv4: Fix clearing of layout segments in layoutreturn
Date: Thu, 22 Aug 2024 08:07:43 -0400	[thread overview]
Message-ID: <0b6143e4d2f7508f874f238355f2cc74031d1958.camel@kernel.org> (raw)
In-Reply-To: <219bcbc91166e476ef996901ae8f3ddb2278d166.1724263426.git.trond.myklebust@hammerspace.com>

On Wed, 2024-08-21 at 14:05 -0400, trondmy@kernel.org wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> Make sure that we clear the layout segments in cases where we see a
> fatal error, and also in the case where the layout is invalid.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>  fs/nfs/nfs4proc.c | 9 ++++++---
>  fs/nfs/pnfs.c     | 5 ++---
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 8883016c551c..daba7d89a0cf 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -9997,6 +9997,7 @@ static void nfs4_layoutreturn_done(struct
> rpc_task *task, void *calldata)
>  		fallthrough;
>  	default:
>  		task->tk_status = 0;
> +		lrp->res.lrs_present = 0;
>  		fallthrough;
>  	case 0:
>  		break;
> @@ -10010,9 +10011,11 @@ static void nfs4_layoutreturn_done(struct
> rpc_task *task, void *calldata)
>  		task->tk_status = 0;
>  		break;
>  	case -NFS4ERR_DELAY:
> -		if (nfs4_async_handle_error(task, server, NULL,
> NULL) != -EAGAIN)
> -			break;
> -		goto out_restart;
> +		if (nfs4_async_handle_error(task, server, NULL,
> NULL) ==
> +		    -EAGAIN)
> +			goto out_restart;
> +		lrp->res.lrs_present = 0;
> +		break;
>  	}
>  	return;
>  out_restart:
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index aa698481bec8..0d16b383a452 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1284,10 +1284,9 @@ void pnfs_layoutreturn_free_lsegs(struct
> pnfs_layout_hdr *lo,
>  	LIST_HEAD(freeme);
>  
>  	spin_lock(&inode->i_lock);
> -	if (!pnfs_layout_is_valid(lo) ||
> -	    !nfs4_stateid_match_other(&lo->plh_stateid,
> arg_stateid))
> +	if (!nfs4_stateid_match_other(&lo->plh_stateid,
> arg_stateid))
>  		goto out_unlock;
> -	if (stateid) {
> +	if (stateid && pnfs_layout_is_valid(lo)) {
>  		u32 seq = be32_to_cpu(arg_stateid->seqid);
>  
>  		pnfs_mark_matching_lsegs_invalid(lo, &freeme, range,
> seq);

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2024-08-22 12:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 18:05 [PATCH 1/3] NFSv4: Add missing rescheduling points in nfs_client_return_marked_delegations trondmy
2024-08-21 18:05 ` [PATCH 2/3] NFSv4: Fix clearing of layout segments in layoutreturn trondmy
2024-08-22 12:07   ` Jeff Layton [this message]
2024-08-21 18:05 ` [PATCH 3/3] NFS: Avoid unnecessary rescanning of the per-server delegation list trondmy
2024-08-22 12:19   ` Jeff Layton
2024-08-22 11:58 ` [PATCH 1/3] NFSv4: Add missing rescheduling points in nfs_client_return_marked_delegations Jeff Layton

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=0b6143e4d2f7508f874f238355f2cc74031d1958.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anna@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).