Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: chuck.lever@oracle.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/4] nfsd: don't kill nfsd_files because of lease break error
Date: Wed, 18 Jan 2023 12:54:36 -0500	[thread overview]
Message-ID: <951265d3954621086aa00d27c275e1d50d3e9586.camel@kernel.org> (raw)
In-Reply-To: <20230105121512.21484-4-jlayton@kernel.org>

On Thu, 2023-01-05 at 07:15 -0500, Jeff Layton wrote:
> An error from break_lease is non-fatal, so we needn't destroy the
> nfsd_file in that case. Just put the reference like we normally would
> and return the error.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nfsd/filecache.c | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index a67b22579c6e..f0ca9501edb2 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -1113,7 +1113,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  	nf = nfsd_file_alloc(&key, may_flags);
>  	if (!nf) {
>  		status = nfserr_jukebox;
> -		goto out_status;
> +		goto out;
>  	}
>  
>  	ret = rhashtable_lookup_insert_key(&nfsd_file_rhash_tbl,
> @@ -1122,13 +1122,11 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  	if (likely(ret == 0))
>  		goto open_file;
>  
> -	nfsd_file_slab_free(&nf->nf_rcu);
> -	nf = NULL;
>  	if (ret == -EEXIST)
>  		goto retry;
>  	trace_nfsd_file_insert_err(rqstp, key.inode, may_flags, ret);
>  	status = nfserr_jukebox;
> -	goto out_status;
> +	goto construction_err;
>  
>  wait_for_construction:
>  	wait_on_bit(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE);
> @@ -1138,28 +1136,24 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  		trace_nfsd_file_cons_err(rqstp, key.inode, may_flags, nf);
>  		if (!open_retry) {
>  			status = nfserr_jukebox;
> -			goto out;
> +			goto construction_err;
>  		}
>  		open_retry = false;
> -		if (refcount_dec_and_test(&nf->nf_ref))
> -			nfsd_file_free(nf);
>  		goto retry;
>  	}
> -
>  	this_cpu_inc(nfsd_file_cache_hits);
>  
>  	status = nfserrno(nfsd_open_break_lease(file_inode(nf->nf_file), may_flags));
> +	if (status != nfs_ok) {
> +		nfsd_file_put(nf);
> +		nf = NULL;
> +	}
> +
>  out:
>  	if (status == nfs_ok) {
>  		this_cpu_inc(nfsd_file_acquisitions);
>  		*pnf = nf;
> -	} else {
> -		if (refcount_dec_and_test(&nf->nf_ref))
> -			nfsd_file_free(nf);
> -		nf = NULL;
>  	}
> -
> -out_status:
>  	put_cred(key.cred);
>  	trace_nfsd_file_acquire(rqstp, key.inode, may_flags, nf, status);
>  	return status;
> @@ -1189,6 +1183,13 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  	if (status != nfs_ok)
>  		nfsd_file_unhash(nf);
>  	clear_and_wake_up_bit(NFSD_FILE_PENDING, &nf->nf_flags);
> +	if (status == nfs_ok)
> +		goto out;
> +
> +construction_err:
> +	if (refcount_dec_and_test(&nf->nf_ref))
> +		nfsd_file_free(nf);
> +	nf = NULL;
>  	goto out;
>  }
>  

Chuck, ping?

You never responded to this patch and I don't see it in your tree. Any
thoughts?
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2023-01-18 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 12:15 [PATCH 0/4] nfsd: filecache cleanups and optimizations Jeff Layton
2023-01-05 12:15 ` [PATCH 1/4] nfsd: don't open-code clear_and_wake_up_bit Jeff Layton
2023-01-05 12:15 ` [PATCH 2/4] nfsd: NFSD_FILE_KEY_INODE only needs to find GC'ed entries Jeff Layton
2023-01-05 14:18   ` Chuck Lever III
2023-01-05 14:29     ` Jeff Layton
2023-01-05 14:32       ` Chuck Lever III
2023-01-05 12:15 ` [PATCH 3/4] nfsd: don't kill nfsd_files because of lease break error Jeff Layton
2023-01-18 17:54   ` Jeff Layton [this message]
2023-01-18 18:45     ` Chuck Lever III
2023-01-05 12:15 ` [PATCH 4/4] nfsd: add some comments to nfsd_file_do_acquire Jeff Layton
2023-01-12  3:04 ` [PATCH 0/4] nfsd: filecache cleanups and optimizations Chuck Lever III

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=951265d3954621086aa00d27c275e1d50d3e9586.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.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