fat: Kill d_invalidate() in vfat_lookup()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thu, 6 Nov 2008 20:53:52 +0000 (12:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Nov 2008 23:41:21 +0000 (15:41 -0800)
d_invalidate() for positive dentry doesn't work in some cases
(vfsmount, nfsd, and maybe others). shrink_dcache_parent() by
d_invalidate() is pointless for vfat usage at all.

So, this kills it, and intead of it uses d_move().

To save old behavior, this returns alias simply for directory (don't
change pwd, etc..). the directory lookup shouldn't be important for
performance.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fat/namei_vfat.c

index d585398f9f6b4309817c534eaf28b03afb01b279..bf326d4356a3347ff9a143328cbef11c01792213 100644 (file)
@@ -745,13 +745,12 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
                 *
                 * Switch to new one for reason of locality if possible.
                 */
-               if (d_invalidate(alias) == 0)
-                       dput(alias);
-               else {
-                       iput(inode);
-                       unlock_super(sb);
-                       return alias;
-               }
+               BUG_ON(d_unhashed(alias));
+               if (!S_ISDIR(inode->i_mode))
+                       d_move(alias, dentry);
+               iput(inode);
+               unlock_super(sb);
+               return alias;
        }
 out:
        unlock_super(sb);