Commit ac278a9c authored by Al Viro's avatar Al Viro Committed by Al Viro

fix LOOKUP_FOLLOW on automount "symlinks"

Make sure that automount "symlinks" are followed regardless of LOOKUP_FOLLOW;
it should have no effect on them.

Cc: stable@kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f8b55f25
...@@ -822,6 +822,17 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -822,6 +822,17 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
/*
* This is a temporary kludge to deal with "automount" symlinks; proper
* solution is to trigger them on follow_mount(), so that do_lookup()
* would DTRT. To be killed before 2.6.34-final.
*/
static inline int follow_on_final(struct inode *inode, unsigned lookup_flags)
{
return inode && unlikely(inode->i_op->follow_link) &&
((lookup_flags & LOOKUP_FOLLOW) || S_ISDIR(inode->i_mode));
}
/* /*
* Name resolution. * Name resolution.
* This is the basic name resolution function, turning a pathname into * This is the basic name resolution function, turning a pathname into
...@@ -942,8 +953,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -942,8 +953,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (err) if (err)
break; break;
inode = next.dentry->d_inode; inode = next.dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW) if (follow_on_final(inode, lookup_flags)) {
&& inode && inode->i_op->follow_link) {
err = do_follow_link(&next, nd); err = do_follow_link(&next, nd);
if (err) if (err)
goto return_err; goto return_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment