[PATCH] NFS: Cache invalidation fixup
authorTrond Myklebust <[email protected]>
Sat, 21 Oct 2006 17:24:24 +0000 (10:24 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 Oct 2006 20:35:06 +0000 (13:35 -0700)
If someone has renamed a directory on the server, triggering the d_move
code in d_materialise_unique(), then we need to invalidate the cached
directory information in the source parent directory.

Signed-off-by: Trond Myklebust <[email protected]>
Cc: Miklos Szeredi <[email protected]>
Cc: Maneesh Soni <[email protected]>
Cc: Dipankar Sarma <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/nfs/dir.c

index 27b5a1051b1c91d70bae33ba259a766903b44e16..b34cd16f472fef71c798c0470f98cbb33f6ea10c 100644 (file)
@@ -936,8 +936,14 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
 no_entry:
        res = d_materialise_unique(dentry, inode);
        if (res != NULL) {
+               struct dentry *parent;
                if (IS_ERR(res))
                        goto out_unlock;
+               /* Was a directory renamed! */
+               parent = dget_parent(res);
+               if (!IS_ROOT(parent))
+                       nfs_mark_for_revalidate(parent->d_inode);
+               dput(parent);
                dentry = res;
        }
        nfs_renew_times(dentry);