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
337 return NFS_SERVER(inode)->caps & cap;337 return NFS_SERVER(inode)->caps & cap;
338}338}
339 339
340static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
341{
342 dentry->d_time = verf;
343}
344
345/**340/**
346 * nfs_save_change_attribute - Returns the inode attribute change cookie341 * nfs_save_change_attribute - Returns the inode attribute change cookie
347 * @dir - pointer to parent directory inode342 * @dir - pointer to parent directory inode
348 * The "change attribute" is updated every time we finish an operation343 * The "cache change attribute" is updated when we need to revalidate
349 * that will result in a metadata change on the server.344 * our dentry cache after a directory was seen to change on the server.
350 */345 */
351static inline unsigned long nfs_save_change_attribute(struct inode *dir)346static inline unsigned long nfs_save_change_attribute(struct inode *dir)
352{347{
353 return NFS_I(dir)->cache_change_attribute;348 return NFS_I(dir)->cache_change_attribute;
354}349}
355 350
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 */
364static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr)
365{
366 return chattr == NFS_I(dir)->cache_change_attribute;
367}
368
369/*351/*
370 * linux/fs/nfs/inode.c352 * linux/fs/nfs/inode.c
371 */353 */
@@ -495,6 +477,10 @@ extern const struct file_operations nfs_dir_operations; · 123 unmodified lines
495extern const struct dentry_operations nfs_dentry_operations;477extern const struct dentry_operations nfs_dentry_operations;
496 478
497extern void nfs_force_lookup_revalidate(struct inode *dir);479extern void nfs_force_lookup_revalidate(struct inode *dir);
480extern void nfs_set_verifier(struct dentry * dentry, unsigned long verf);
481#if IS_ENABLED(CONFIG_NFS_V4)
482extern void nfs_clear_verifier_delegated(struct inode *inode);
483#endif /* IS_ENABLED(CONFIG_NFS_V4) */
498extern struct dentry *nfs_add_or_obtain(struct dentry *dentry,484extern struct dentry *nfs_add_or_obtain(struct dentry *dentry,
499 struct nfs_fh *fh, struct nfs_fattr *fattr,485 struct nfs_fh *fh, struct nfs_fattr *fattr,
500 struct nfs4_label *label);486 struct nfs4_label *label);