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 3/3] NFS: Avoid unnecessary rescanning of the per-server delegation list
Date: Thu, 22 Aug 2024 08:19:48 -0400	[thread overview]
Message-ID: <3d0ecd19625f99ca2b52ab4a059564bb56e2cd4b.camel@kernel.org> (raw)
In-Reply-To: <3fe20b13641fe569107f1474d17befd8caa0b076.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>
> 
> If the call to nfs_delegation_grab_inode() fails, we will not have
> dropped any locks that require us to rescan the list.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
>  fs/nfs/delegation.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
> index d5edb3b3eeef..20cb2008f9e4 100644
> --- a/fs/nfs/delegation.c
> +++ b/fs/nfs/delegation.c
> @@ -647,6 +647,9 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,
>  				prev = delegation;
>  			continue;
>  		}
> +		inode = nfs_delegation_grab_inode(delegation);
> +		if (inode == NULL)
> +			continue;
>  
>  		if (prev) {
>  			struct inode *tmp = nfs_delegation_grab_inode(prev);
> @@ -657,12 +660,6 @@ static int nfs_server_return_marked_delegations(struct nfs_server *server,
>  			}
>  		}
>  
> -		inode = nfs_delegation_grab_inode(delegation);
> -		if (inode == NULL) {
> -			rcu_read_unlock();
> -			iput(to_put);
> -			goto restart;
> -		}
>  		delegation = nfs_start_delegation_return_locked(NFS_I(inode));
>  		rcu_read_unlock();
>  
> @@ -1184,7 +1181,6 @@ static int nfs_server_reap_unclaimed_delegations(struct nfs_server *server,
>  	struct inode *inode;
>  restart:
>  	rcu_read_lock();
> -restart_locked:
>  	list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
>  		if (test_bit(NFS_DELEGATION_INODE_FREEING,
>  					&delegation->flags) ||
> @@ -1195,7 +1191,7 @@ static int nfs_server_reap_unclaimed_delegations(struct nfs_server *server,
>  			continue;
>  		inode = nfs_delegation_grab_inode(delegation);
>  		if (inode == NULL)
> -			goto restart_locked;
> +			continue;
>  		delegation = nfs_start_delegation_return_locked(NFS_I(inode));
>  		rcu_read_unlock();
>  		if (delegation != NULL) {
> @@ -1318,7 +1314,6 @@ static int nfs_server_reap_expired_delegations(struct nfs_server *server,
>  
>  restart:
>  	rcu_read_lock();
> -restart_locked:
>  	list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
>  		if (test_bit(NFS_DELEGATION_INODE_FREEING,
>  					&delegation->flags) ||
> @@ -1330,7 +1325,7 @@ static int nfs_server_reap_expired_delegations(struct nfs_server *server,
>  			continue;
>  		inode = nfs_delegation_grab_inode(delegation);
>  		if (inode == NULL)
> -			goto restart_locked;
> +			continue;
>  		spin_lock(&delegation->lock);
>  		cred = get_cred_rcu(delegation->cred);
>  		nfs4_stateid_copy(&stateid, &delegation->stateid);

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

  reply	other threads:[~2024-08-22 12:19 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
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 [this message]
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=3d0ecd19625f99ca2b52ab4a059564bb56e2cd4b.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).