NFSv4: Keep delegation post REMOVE in case server supports preserved-unliked
Subsystems (2)
RFC PATCH 1/1 NFSv4: Keep delegation post REMOVE in case server supports preserved-unliked
If the server returns NFS4_OPEN_RESULT_PRESERVE_UNLINKED, it means that the file handle is kept alive for as long as the file is opened (or its delegation is held). Hence, we can skip re-opening the file and returning the delegation in this case.
Signed-off-by Sagi Grimberg <[email protected]>
--- fs/nfs/nfs4proc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +10 -3
@@ -4921,10 +4921,17 @@ static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry)int err;if (inode) { -if (inode->i_nlink ==1 ) -nfs4_inode_return_delegation (inode); -else +/* +* nlink > 1 or server supports NFS_INO_PRESERVE_UNLINKED +* the inode is not going away. we're promised to keep the +* inode alive past REMOVE for as long as any client reference +* remains. So we can keep the delegation around. +*/ +if (inode->i_nlink >1 || +test_bit (NFS_INO_PRESERVE_UNLINKED , &NFS_I (inode)->flags))nfs4_inode_make_writeable (inode); +else +nfs4_inode_return_delegation (inode); } do { err = _nfs4_proc_remove(dir, &dentry->d_name, NF4REG);
Signature · 1 line
2.43.0