Skip to contentSkip to conversation

NFS: remove revoked delegation from server's delegation list

PATCH In review Dai Ngo 2 participants 2 messages Oct 8, 2024

Subsystems (2)
lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH v2 1/1 NFS: remove revoked delegation from server's delegation list

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

---
 fs/nfs/delegation.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/nfs/delegation.c +5 -0
index 20cb2008f9e4..035ba52742a5 100644
@@ -1001,6 +1001,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);
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 40 lines · Dai Ngo

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

---
 fs/nfs/delegation.c | 5 +++++

 1 file changed, 5 insertions(+)
fs/nfs/delegation.c +0 -0
index 20cb2008f9e4..035ba52742a5 100644
@@ -1001,6 +1001,11 @@ void nfs_delegation_mark_returned(struct inode
 *inode,
  	}


  nfs_mark_delegation_revoked(delegation);

fs/nfs/delegation.c +3 -0
+	clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags);
+	spin_unlock(&delegation->lock);
+	if (nfs_detach_delegation(NFS_I(inode), delegation,

NFS_SERVER(inode)))

fs/nfs/delegation.c +2 -0
+		nfs_put_delegation(delegation);
+	goto out_rcu_unlock;
Quoted 3 lines


 out_clear_returning:
  clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags);

OK, I can fix up nfs_revoke_delegation() later. Thanks!

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]