diff options
author | Ian Kent <raven@themaw.net> | 2009-12-15 19:45:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:19:57 -0500 |
commit | 36b6413ef301d30f60037e497ecb902897895473 (patch) | |
tree | 6f1e4ce514d691b02d2506fed5780e5b4dc0f6b1 | |
parent | c4cd70b3e3e95cc2201a00edf6deb52327d73c6b (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.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 2954ac5fec75..f6e8ca9ea56a 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -104,6 +104,14 @@ static void autofs4_del_active(struct dentry *dentry) | |||
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | 106 | ||
107 | static unsigned int autofs4_need_mount(unsigned int flags) | ||
108 | { | ||
109 | unsigned int res = 0; | ||
110 | if (flags & (TRIGGER_FLAGS | TRIGGER_INTENTS)) | ||
111 | res = 1; | ||
112 | return res; | ||
113 | } | ||
114 | |||
107 | static int autofs4_dir_open(struct inode *inode, struct file *file) | 115 | static int autofs4_dir_open(struct inode *inode, struct file *file) |
108 | { | 116 | { |
109 | struct dentry *dentry = file->f_path.dentry; | 117 | struct dentry *dentry = file->f_path.dentry; |
@@ -168,7 +176,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) | |||
168 | } | 176 | } |
169 | /* Trigger mount for path component or follow link */ | 177 | /* Trigger mount for path component or follow link */ |
170 | } else if (dentry->d_flags & DCACHE_AUTOFS_PENDING || | 178 | } else if (dentry->d_flags & DCACHE_AUTOFS_PENDING || |
171 | flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) || | 179 | autofs4_need_mount(flags) || |
172 | current->link_count) { | 180 | current->link_count) { |
173 | DPRINTK("waiting for mount name=%.*s", | 181 | DPRINTK("waiting for mount name=%.*s", |
174 | dentry->d_name.len, dentry->d_name.name); | 182 | dentry->d_name.len, dentry->d_name.name); |
@@ -234,7 +242,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
234 | autofs4_expire_wait(dentry); | 242 | autofs4_expire_wait(dentry); |
235 | 243 | ||
236 | /* We trigger a mount for almost all flags */ | 244 | /* We trigger a mount for almost all flags */ |
237 | lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS); | 245 | lookup_type = autofs4_need_mount(nd->flags); |
238 | if (!(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING)) | 246 | if (!(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING)) |
239 | goto follow; | 247 | goto follow; |
240 | 248 | ||