public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 2/3] NFS: remove revoked delegation from server's delegation list
       [not found] <20241014035948.2261641-1-sashal@kernel.org>
@ 2024-10-14  3:59 ` Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2024-10-14  3:59 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dai Ngo, Trond Myklebust, Anna Schumaker, Sasha Levin, trondmy,
	anna, linux-nfs

From: Dai Ngo <dai.ngo@oracle.com>

[ Upstream commit 7ef60108069b7e3cc66432304e1dd197d5c0a9b5 ]

After the delegation is returned to the NFS server remove it
from the server's delegations list to reduce the time it takes
to scan this list.

Network trace captured while running the below script shows the
time taken to service the CB_RECALL increases gradually due to
the overhead of traversing the delegation list in
nfs_delegation_find_inode_server.

The NFS server in this test is a Solaris server which issues
CB_RECALL when receiving the all-zero stateid in the SETATTR.

mount=/mnt/data
for i in $(seq 1 20)
do
   echo $i
   mkdir $mount/testtarfile$i
   time  tar -C $mount/testtarfile$i -xf 5000_files.tar
done

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Reviewed-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfs/delegation.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 1eb6c7a142ff0..2354b7d41b468 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -963,6 +963,11 @@ void nfs_delegation_mark_returned(struct inode *inode,
 	}
 
 	nfs_mark_delegation_revoked(delegation);
+	clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags);
+	spin_unlock(&delegation->lock);
+	if (nfs_detach_delegation(NFS_I(inode), delegation, NFS_SERVER(inode)))
+		nfs_put_delegation(delegation);
+	goto out_rcu_unlock;
 
 out_clear_returning:
 	clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-14  3:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241014035948.2261641-1-sashal@kernel.org>
2024-10-14  3:59 ` [PATCH AUTOSEL 5.10 2/3] NFS: remove revoked delegation from server's delegation list Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox