Index: linux-2.6.10/fs/namei.c =================================================================== --- linux-2.6.10.orig/fs/namei.c 2005-03-31 17:12:26.403006808 +0800 +++ linux-2.6.10/fs/namei.c 2005-03-31 17:20:37.388365688 +0800 @@ -783,8 +783,11 @@ goto out_dput; if (inode->i_op->follow_link) { + int saved_flags = nd->flags; mntget(next.mnt); + nd->flags |= LOOKUP_LINK_NOTLAST; err = do_follow_link(next.dentry, nd); + nd->flags = saved_flags; dput(next.dentry); mntput(next.mnt); if (err) @@ -830,7 +833,9 @@ if (err < 0) break; } + nd->flags |= LOOKUP_LAST; err = do_lookup(nd, &this, &next, atomic); + nd->flags &= ~LOOKUP_LAST; if (err) break; follow_mount(&next.mnt, &next.dentry); @@ -876,10 +881,14 @@ */ if (nd->dentry && nd->dentry->d_sb && (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { - err = -ESTALE; + nd->flags |= LOOKUP_LAST; + err = !nd->dentry->d_op->d_revalidate(nd->dentry, nd); + nd->flags &= ~LOOKUP_LAST; /* Note: we do not d_invalidate() */ - if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd)) + if (err) { + err = -ESTALE; break; + } } return_base: return 0; @@ -1446,7 +1455,9 @@ dir = nd->dentry; nd->flags &= ~LOOKUP_PARENT; down(&dir->d_inode->i_sem); + nd->flags |= LOOKUP_LAST; dentry = __lookup_hash(&nd->last, nd->dentry, nd); + nd->flags &= ~LOOKUP_LAST; do_last: error = PTR_ERR(dentry); @@ -1559,7 +1570,9 @@ } dir = nd->dentry; down(&dir->d_inode->i_sem); + nd->flags |= LOOKUP_LAST; dentry = __lookup_hash(&nd->last, nd->dentry, nd); + nd->flags &= ~LOOKUP_LAST; putname(nd->last.name); goto do_last; } Index: linux-2.6.10/include/linux/namei.h =================================================================== --- linux-2.6.10.orig/include/linux/namei.h 2005-03-31 17:10:14.746021712 +0800 +++ linux-2.6.10/include/linux/namei.h 2005-03-31 17:21:41.178668088 +0800 @@ -73,7 +73,9 @@ #define LOOKUP_PARENT 16 #define LOOKUP_NOALT 32 #define LOOKUP_ATOMIC 64 - +#define LOOKUP_LAST 128 +#define LOOKUP_LINK_NOTLAST 256 ++ /* * Intent data */