public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] NFS: Label the dentry with a verifier in nfs_link(), nfs_symlink()
@ 2021-07-08  2:23 trondmy
  2021-07-08  2:23 ` [PATCH 2/2] NFS: Label the dentry with a verifier in nfs_rmdir() and nfs_unlink() trondmy
  0 siblings, 1 reply; 2+ messages in thread
From: trondmy @ 2021-07-08  2:23 UTC (permalink / raw)
  To: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

After the success of an operation such as link(), or symlink(), we
expect to add the dentry back to the dcache as an ordinary positive
dentry.
However in NFS, unless it is labelled with the appropriate verifier for
the parent directory state, then nfs_lookup_revalidate will end up
discarding that dentry and forcing a new lookup.

The fix is to ensure that we relabel the dentry appropriately on
success.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 1a6d2867fba4..baca036f3890 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2352,6 +2352,8 @@ int nfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
 		return error;
 	}
 
+	nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
+
 	/*
 	 * No big deal if we can't add this page to the page cache here.
 	 * READLINK will get the missing page from the server if needed.
@@ -2385,6 +2387,7 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
 	d_drop(dentry);
 	error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
 	if (error == 0) {
+		nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
 		ihold(inode);
 		d_add(dentry, inode);
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-08  2:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-08  2:23 [PATCH 1/2] NFS: Label the dentry with a verifier in nfs_link(), nfs_symlink() trondmy
2021-07-08  2:23 ` [PATCH 2/2] NFS: Label the dentry with a verifier in nfs_rmdir() and nfs_unlink() trondmy

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