History

NFSv4: Fix revalidation of dentries with delegations

If a dentry was not initially looked up while we were holding a delegation, then we do still need to revalidate that it still holds the same name. If there are multiple hard links to the same file, then all the hard links need validation.

Trond Myklebust committed 6 years ago

Commit efeda801 parent cf5b4054 files · +115 −23Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/nfs_fs.h+6−20
@@ -337,35 +337,17 @@ static inline int nfs_server_capable(struct inode *inode, int cap) · 336 unmodified lines
337337 return NFS_SERVER(inode)->caps & cap;
338338 }
339339
340−static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
341−{
342− dentry->d_time = verf;
343−}
344−
345340 /**
346341 * nfs_save_change_attribute - Returns the inode attribute change cookie
347342 * @dir - pointer to parent directory inode
348− * The "change attribute" is updated every time we finish an operation
349− * that will result in a metadata change on the server.
343+ * The "cache change attribute" is updated when we need to revalidate
344+ * our dentry cache after a directory was seen to change on the server.
350345 */
351346 static inline unsigned long nfs_save_change_attribute(struct inode *dir)
352347 {
353348 return NFS_I(dir)->cache_change_attribute;
354349 }
355350
356−/**
357− * nfs_verify_change_attribute - Detects NFS remote directory changes
358− * @dir - pointer to parent directory inode
359− * @chattr - previously saved change attribute
360− * Return "false" if the verifiers doesn't match the change attribute.
361− * This would usually indicate that the directory contents have changed on
362− * the server, and that any dentries need revalidating.
363− */
364−static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr)
365−{
366− return chattr == NFS_I(dir)->cache_change_attribute;
367−}
368−
369351 /*
370352 * linux/fs/nfs/inode.c
371353 */
@@ -495,6 +477,10 @@ extern const struct file_operations nfs_dir_operations; · 123 unmodified lines
495477 extern const struct dentry_operations nfs_dentry_operations;
496478
497479 extern void nfs_force_lookup_revalidate(struct inode *dir);
480+extern void nfs_set_verifier(struct dentry * dentry, unsigned long verf);
481+#if IS_ENABLED(CONFIG_NFS_V4)
482+extern void nfs_clear_verifier_delegated(struct inode *inode);
483+#endif /* IS_ENABLED(CONFIG_NFS_V4) */
498484 extern struct dentry *nfs_add_or_obtain(struct dentry *dentry,
499485 struct nfs_fh *fh, struct nfs_fattr *fattr,
500486 struct nfs4_label *label);