update nd->inode in __do_follow_link() instead of after do_follow_link()
... and note that we only need to do it for LAST_BIND symlinks
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/fs/namei.c b/fs/namei.c
index 549bbe2..9e7b18a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -768,7 +768,8 @@
error = __vfs_follow_link(nd, s);
else if (nd->last_type == LAST_BIND) {
nd->flags |= LOOKUP_JUMPED;
- if (nd->path.dentry->d_inode->i_op->follow_link) {
+ nd->inode = nd->path.dentry->d_inode;
+ if (nd->inode->i_op->follow_link) {
/* stepped on a _really_ weird one */
path_put(&nd->path);
error = -ELOOP;
@@ -1449,7 +1450,6 @@
err = do_follow_link(&next, nd);
if (err)
return err;
- nd->inode = nd->path.dentry->d_inode;
}
err = -ENOTDIR;
if (!nd->inode->i_op->lookup)
@@ -1475,7 +1475,6 @@
err = do_follow_link(&next, nd);
if (err)
return err;
- nd->inode = nd->path.dentry->d_inode;
}
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;