summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2009-12-15 16:45:44 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 07:19:57 -0800
commit36b6413ef301d30f60037e497ecb902897895473 (patch)
tree6f1e4ce514d691b02d2506fed5780e5b4dc0f6b1
parentc4cd70b3e3e95cc2201a00edf6deb52327d73c6b (diff)
autofs4: use helper function for need mount check
Define simple helper function for checking if we need to trigger a mount. Signed-off-by: Ian Kent <raven@themaw.net> Cc: Sage Weil <sage@newdream.net> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Andreas Dilger <adilger@sun.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Yehuda Saheh <yehuda@newdream.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/autofs4/root.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2954ac5fec7..f6e8ca9ea56 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -104,6 +104,14 @@ static void autofs4_del_active(struct dentry *dentry)
return;
}
+static unsigned int autofs4_need_mount(unsigned int flags)
+{
+ unsigned int res = 0;
+ if (flags & (TRIGGER_FLAGS | TRIGGER_INTENTS))
+ res = 1;
+ return res;
+}
+
static int autofs4_dir_open(struct inode *inode, struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
@@ -168,7 +176,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
}
/* Trigger mount for path component or follow link */
} else if (dentry->d_flags & DCACHE_AUTOFS_PENDING ||
- flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) ||
+ autofs4_need_mount(flags) ||
current->link_count) {
DPRINTK("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);
@@ -234,7 +242,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
autofs4_expire_wait(dentry);
/* We trigger a mount for almost all flags */
- lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS);
+ lookup_type = autofs4_need_mount(nd->flags);
if (!(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING))
goto follow;