--- linux-2.6.5-7.141/fs/namei.c.orig 2005-04-01 18:03:37.788262784 +0300 +++ linux-2.6.5-7.141/fs/namei.c 2005-04-01 18:05:43.058218856 +0300 @@ -719,10 +719,12 @@ goto out_dput; if (inode->i_op->follow_link) { + int save_flags = nd->flags; mntget(next.mnt); nd->flags |= LOOKUP_LINK_NOTLAST; err = do_follow_link(next.dentry, nd); - nd->flags &= ~LOOKUP_LINK_NOTLAST; + if (!(save_flags & LOOKUP_LINK_NOTLAST)) + nd->flags &= ~LOOKUP_LINK_NOTLAST; dput(next.dentry); mntput(next.mnt); if (err)