Commit 1c9f5e06 authored by Al Viro's avatar Al Viro

follow_automount() doesn't need the entire nameidata

Only the address of ->total_link_count and the flags.
And fix an off-by-one is ELOOP detection - make it
consistent with symlink following, where we check if
the pre-increment value has reached 40, rather than
check the post-increment one.

[kudos to Christian Brauner for spotted braino]
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 25e195aa
...@@ -1208,7 +1208,7 @@ EXPORT_SYMBOL(follow_up); ...@@ -1208,7 +1208,7 @@ EXPORT_SYMBOL(follow_up);
* - return -EISDIR to tell follow_managed() to stop and return the path we * - return -EISDIR to tell follow_managed() to stop and return the path we
* were called with. * were called with.
*/ */
static int follow_automount(struct path *path, struct nameidata *nd) static int follow_automount(struct path *path, int *count, unsigned lookup_flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;
...@@ -1223,13 +1223,12 @@ static int follow_automount(struct path *path, struct nameidata *nd) ...@@ -1223,13 +1223,12 @@ static int follow_automount(struct path *path, struct nameidata *nd)
* as being automount points. These will need the attentions * as being automount points. These will need the attentions
* of the daemon to instantiate them before they can be used. * of the daemon to instantiate them before they can be used.
*/ */
if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | if (!(lookup_flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
dentry->d_inode) dentry->d_inode)
return -EISDIR; return -EISDIR;
nd->total_link_count++; if (count && (*count)++ >= MAXSYMLINKS)
if (nd->total_link_count >= 40)
return -ELOOP; return -ELOOP;
return finish_automount(dentry->d_op->d_automount(path), path); return finish_automount(dentry->d_op->d_automount(path), path);
...@@ -1290,7 +1289,8 @@ static int follow_managed(struct path *path, struct nameidata *nd) ...@@ -1290,7 +1289,8 @@ static int follow_managed(struct path *path, struct nameidata *nd)
/* Handle an automount point */ /* Handle an automount point */
if (flags & DCACHE_NEED_AUTOMOUNT) { if (flags & DCACHE_NEED_AUTOMOUNT) {
ret = follow_automount(path, nd); ret = follow_automount(path, &nd->total_link_count,
nd->flags);
if (ret < 0) if (ret < 0)
break; break;
continue; continue;
......
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