blob: bcfb2dc0a61bf56d0e1c4be07612f24454834c08 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* -*- c -*- --------------------------------------------------------------- *
2 *
3 * linux/fs/autofs/root.c
4 *
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
Ian Kent34ca9592006-03-27 01:14:54 -08007 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * This file is part of the Linux kernel and is made available under
10 * the terms of the GNU General Public License, version 2, or at your
11 * option, any later version, incorporated herein by reference.
12 *
13 * ------------------------------------------------------------------------- */
14
Randy Dunlap16f7e0f2006-01-11 12:17:46 -080015#include <linux/capability.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/errno.h>
17#include <linux/stat.h>
18#include <linux/param.h>
19#include <linux/time.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include "autofs_i.h"
21
22static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
23static int autofs4_dir_unlink(struct inode *,struct dentry *);
24static int autofs4_dir_rmdir(struct inode *,struct dentry *);
25static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
26static int autofs4_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long);
27static int autofs4_dir_open(struct inode *inode, struct file *file);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
Ian Kent34ca9592006-03-27 01:14:54 -080029static void *autofs4_follow_link(struct dentry *, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Ian Kent6d5cb922008-07-23 21:30:15 -070031#define TRIGGER_FLAGS (LOOKUP_CONTINUE | LOOKUP_DIRECTORY)
32#define TRIGGER_INTENTS (LOOKUP_OPEN | LOOKUP_CREATE)
33
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -080034const struct file_operations autofs4_root_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 .open = dcache_dir_open,
36 .release = dcache_dir_close,
37 .read = generic_read_dir,
Ian Kentaa55ddf2008-07-23 21:30:29 -070038 .readdir = dcache_readdir,
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 .ioctl = autofs4_root_ioctl,
40};
41
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -080042const struct file_operations autofs4_dir_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 .open = autofs4_dir_open,
Ian Kentff9cd492008-07-23 21:30:24 -070044 .release = dcache_dir_close,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 .read = generic_read_dir,
Ian Kentff9cd492008-07-23 21:30:24 -070046 .readdir = dcache_readdir,
Linus Torvalds1da177e2005-04-16 15:20:36 -070047};
48
Arjan van de Ven754661f2007-02-12 00:55:38 -080049const struct inode_operations autofs4_indirect_root_inode_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 .lookup = autofs4_lookup,
51 .unlink = autofs4_dir_unlink,
52 .symlink = autofs4_dir_symlink,
53 .mkdir = autofs4_dir_mkdir,
54 .rmdir = autofs4_dir_rmdir,
55};
56
Arjan van de Ven754661f2007-02-12 00:55:38 -080057const struct inode_operations autofs4_direct_root_inode_operations = {
Ian Kent34ca9592006-03-27 01:14:54 -080058 .lookup = autofs4_lookup,
Ian Kent871f9432006-03-27 01:14:58 -080059 .unlink = autofs4_dir_unlink,
60 .mkdir = autofs4_dir_mkdir,
61 .rmdir = autofs4_dir_rmdir,
Ian Kent34ca9592006-03-27 01:14:54 -080062 .follow_link = autofs4_follow_link,
63};
64
Arjan van de Ven754661f2007-02-12 00:55:38 -080065const struct inode_operations autofs4_dir_inode_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 .lookup = autofs4_lookup,
67 .unlink = autofs4_dir_unlink,
68 .symlink = autofs4_dir_symlink,
69 .mkdir = autofs4_dir_mkdir,
70 .rmdir = autofs4_dir_rmdir,
71};
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073static int autofs4_dir_open(struct inode *inode, struct file *file)
74{
Josef "Jeff" Sipeka4669ed2006-12-08 02:36:46 -080075 struct dentry *dentry = file->f_path.dentry;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
Ian Kentf360ce32006-03-27 01:14:43 -080077
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 DPRINTK("file=%p dentry=%p %.*s",
79 file, dentry, dentry->d_name.len, dentry->d_name.name);
80
81 if (autofs4_oz_mode(sbi))
82 goto out;
83
Ian Kentff9cd492008-07-23 21:30:24 -070084 /*
85 * An empty directory in an autofs file system is always a
86 * mount point. The daemon must have failed to mount this
87 * during lookup so it doesn't exist. This can happen, for
88 * example, if user space returns an incorrect status for a
89 * mount request. Otherwise we're doing a readdir on the
90 * autofs file system so just let the libfs routines handle
91 * it.
92 */
93 spin_lock(&dcache_lock);
94 if (!d_mountpoint(dentry) && __simple_empty(dentry)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 spin_unlock(&dcache_lock);
Ian Kentff9cd492008-07-23 21:30:24 -070096 return -ENOENT;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 }
Ian Kentff9cd492008-07-23 21:30:24 -070098 spin_unlock(&dcache_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
Ian Kentf360ce32006-03-27 01:14:43 -0800100out:
Ian Kentff9cd492008-07-23 21:30:24 -0700101 return dcache_dir_open(inode, file);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102}
103
Ian Kent862b1102006-03-27 01:14:48 -0800104static int try_to_fill_dentry(struct dentry *dentry, int flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105{
Ian Kent862b1102006-03-27 01:14:48 -0800106 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
Ian Kent718c6042006-03-27 01:14:42 -0800107 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Jeff Moyer9d2de6a2008-05-01 04:35:09 -0700108 int status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 DPRINTK("dentry=%p %.*s ino=%p",
111 dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode);
112
Ian Kent718c6042006-03-27 01:14:42 -0800113 /*
114 * Wait for a pending mount, triggering one if there
115 * isn't one already
116 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 if (dentry->d_inode == NULL) {
118 DPRINTK("waiting for mount name=%.*s",
119 dentry->d_name.len, dentry->d_name.name);
120
121 status = autofs4_wait(sbi, dentry, NFY_MOUNT);
Ian Kent718c6042006-03-27 01:14:42 -0800122
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 DPRINTK("mount done status=%d", status);
124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 /* Turn this into a real negative dentry? */
126 if (status == -ENOENT) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 spin_lock(&dentry->d_lock);
128 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
129 spin_unlock(&dentry->d_lock);
Ian Kent34ca9592006-03-27 01:14:54 -0800130 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 } else if (status) {
132 /* Return a negative dentry, but leave it "pending" */
Ian Kent34ca9592006-03-27 01:14:54 -0800133 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 }
135 /* Trigger mount for path component or follow link */
Ian Kent26e81b32008-07-23 21:30:25 -0700136 } else if (dentry->d_flags & DCACHE_AUTOFS_PENDING ||
137 flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) ||
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 current->link_count) {
139 DPRINTK("waiting for mount name=%.*s",
140 dentry->d_name.len, dentry->d_name.name);
141
142 spin_lock(&dentry->d_lock);
143 dentry->d_flags |= DCACHE_AUTOFS_PENDING;
144 spin_unlock(&dentry->d_lock);
145 status = autofs4_wait(sbi, dentry, NFY_MOUNT);
146
147 DPRINTK("mount done status=%d", status);
148
149 if (status) {
150 spin_lock(&dentry->d_lock);
151 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
152 spin_unlock(&dentry->d_lock);
Ian Kent34ca9592006-03-27 01:14:54 -0800153 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 }
155 }
156
Ian Kente0a7aae2006-03-27 01:14:47 -0800157 /* Initialize expiry counter after successful mount */
158 if (ino)
159 ino->last_used = jiffies;
160
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 spin_lock(&dentry->d_lock);
162 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
163 spin_unlock(&dentry->d_lock);
Jeff Moyer03379042008-05-01 04:35:08 -0700164
Jeff Moyer9d2de6a2008-05-01 04:35:09 -0700165 return 0;
Ian Kent34ca9592006-03-27 01:14:54 -0800166}
167
168/* For autofs direct mounts the follow link triggers the mount */
169static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
170{
171 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
Ian Kenta5370552006-05-15 09:43:51 -0700172 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Ian Kent34ca9592006-03-27 01:14:54 -0800173 int oz_mode = autofs4_oz_mode(sbi);
174 unsigned int lookup_type;
175 int status;
176
177 DPRINTK("dentry=%p %.*s oz_mode=%d nd->flags=%d",
178 dentry, dentry->d_name.len, dentry->d_name.name, oz_mode,
179 nd->flags);
Ian Kent6e60a9a2008-07-23 21:30:27 -0700180 /*
181 * For an expire of a covered direct or offset mount we need
182 * to beeak out of follow_down() at the autofs mount trigger
183 * (d_mounted--), so we can see the expiring flag, and manage
184 * the blocking and following here until the expire is completed.
185 */
186 if (oz_mode) {
187 spin_lock(&sbi->fs_lock);
188 if (ino->flags & AUTOFS_INF_EXPIRING) {
189 spin_unlock(&sbi->fs_lock);
190 /* Follow down to our covering mount. */
191 if (!follow_down(&nd->path.mnt, &nd->path.dentry))
192 goto done;
Ian Kentec6e8c72008-07-23 21:30:28 -0700193 goto follow;
Ian Kent6e60a9a2008-07-23 21:30:27 -0700194 }
195 spin_unlock(&sbi->fs_lock);
Ian Kent34ca9592006-03-27 01:14:54 -0800196 goto done;
Ian Kent6e60a9a2008-07-23 21:30:27 -0700197 }
Ian Kent34ca9592006-03-27 01:14:54 -0800198
Ian Kent6e60a9a2008-07-23 21:30:27 -0700199 /* If an expire request is pending everyone must wait. */
Ian Kent06a35982008-07-23 21:30:28 -0700200 autofs4_expire_wait(dentry);
Ian Kent97e74492008-07-23 21:30:26 -0700201
Ian Kent6e60a9a2008-07-23 21:30:27 -0700202 /* We trigger a mount for almost all flags */
203 lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS);
204 if (!(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING))
Ian Kentec6e8c72008-07-23 21:30:28 -0700205 goto follow;
Ian Kent6e60a9a2008-07-23 21:30:27 -0700206
Ian Kent871f9432006-03-27 01:14:58 -0800207 /*
Ian Kent6e60a9a2008-07-23 21:30:27 -0700208 * If the dentry contains directories then it is an autofs
209 * multi-mount with no root mount offset. So don't try to
210 * mount it again.
Ian Kent871f9432006-03-27 01:14:58 -0800211 */
212 spin_lock(&dcache_lock);
Ian Kent26e81b32008-07-23 21:30:25 -0700213 if (dentry->d_flags & DCACHE_AUTOFS_PENDING ||
214 (!d_mountpoint(dentry) && __simple_empty(dentry))) {
Ian Kent871f9432006-03-27 01:14:58 -0800215 spin_unlock(&dcache_lock);
216
217 status = try_to_fill_dentry(dentry, 0);
218 if (status)
219 goto out_error;
220
Ian Kent6e60a9a2008-07-23 21:30:27 -0700221 goto follow;
Ian Kent871f9432006-03-27 01:14:58 -0800222 }
223 spin_unlock(&dcache_lock);
Ian Kent6e60a9a2008-07-23 21:30:27 -0700224follow:
225 /*
226 * If there is no root mount it must be an autofs
227 * multi-mount with no root offset so we don't need
228 * to follow it.
229 */
230 if (d_mountpoint(dentry)) {
231 if (!autofs4_follow_mount(&nd->path.mnt,
232 &nd->path.dentry)) {
233 status = -ENOENT;
234 goto out_error;
235 }
236 }
Ian Kent871f9432006-03-27 01:14:58 -0800237
Ian Kent34ca9592006-03-27 01:14:54 -0800238done:
239 return NULL;
240
241out_error:
Jan Blunck1d957f92008-02-14 19:34:35 -0800242 path_put(&nd->path);
Ian Kent34ca9592006-03-27 01:14:54 -0800243 return ERR_PTR(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244}
245
246/*
247 * Revalidate is called on every cache lookup. Some of those
248 * cache lookups may actually happen while the dentry is not
249 * yet completely filled in, and revalidate has to delay such
250 * lookups..
251 */
Ian Kent718c6042006-03-27 01:14:42 -0800252static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253{
Ian Kent718c6042006-03-27 01:14:42 -0800254 struct inode *dir = dentry->d_parent->d_inode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
256 int oz_mode = autofs4_oz_mode(sbi);
257 int flags = nd ? nd->flags : 0;
Ian Kentbcdc5e02006-09-27 01:50:44 -0700258 int status = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259
260 /* Pending dentry */
Ian Kent97e74492008-07-23 21:30:26 -0700261 spin_lock(&sbi->fs_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 if (autofs4_ispending(dentry)) {
Ian Kentbcdc5e02006-09-27 01:50:44 -0700263 /* The daemon never causes a mount to trigger */
Ian Kent97e74492008-07-23 21:30:26 -0700264 spin_unlock(&sbi->fs_lock);
265
Ian Kentbcdc5e02006-09-27 01:50:44 -0700266 if (oz_mode)
267 return 1;
268
269 /*
Ian Kent06a35982008-07-23 21:30:28 -0700270 * If the directory has gone away due to an expire
271 * we have been called as ->d_revalidate() and so
272 * we need to return false and proceed to ->lookup().
273 */
274 if (autofs4_expire_wait(dentry) == -EAGAIN)
275 return 0;
276
277 /*
Ian Kentbcdc5e02006-09-27 01:50:44 -0700278 * A zero status is success otherwise we have a
279 * negative error code.
280 */
281 status = try_to_fill_dentry(dentry, flags);
282 if (status == 0)
Ian Kentf50b6f82007-02-20 13:58:10 -0800283 return 1;
284
Ian Kentbcdc5e02006-09-27 01:50:44 -0700285 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 }
Ian Kent97e74492008-07-23 21:30:26 -0700287 spin_unlock(&sbi->fs_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
289 /* Negative dentry.. invalidate if "old" */
290 if (dentry->d_inode == NULL)
Ian Kent2d753e62006-03-27 01:14:44 -0800291 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
293 /* Check for a non-mountpoint directory with no contents */
294 spin_lock(&dcache_lock);
295 if (S_ISDIR(dentry->d_inode->i_mode) &&
296 !d_mountpoint(dentry) &&
Ian Kent90a59c72006-03-27 01:14:50 -0800297 __simple_empty(dentry)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 DPRINTK("dentry=%p %.*s, emptydir",
299 dentry, dentry->d_name.len, dentry->d_name.name);
300 spin_unlock(&dcache_lock);
Ian Kent97e74492008-07-23 21:30:26 -0700301
Ian Kentbcdc5e02006-09-27 01:50:44 -0700302 /* The daemon never causes a mount to trigger */
303 if (oz_mode)
304 return 1;
305
306 /*
307 * A zero status is success otherwise we have a
308 * negative error code.
309 */
310 status = try_to_fill_dentry(dentry, flags);
311 if (status == 0)
312 return 1;
313
314 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 }
316 spin_unlock(&dcache_lock);
317
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 return 1;
319}
320
Ian Kent34ca9592006-03-27 01:14:54 -0800321void autofs4_dentry_release(struct dentry *de)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322{
323 struct autofs_info *inf;
324
325 DPRINTK("releasing %p", de);
326
327 inf = autofs4_dentry_ino(de);
328 de->d_fsdata = NULL;
329
330 if (inf) {
Ian Kentf50b6f82007-02-20 13:58:10 -0800331 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb);
332
Ian Kentf50b6f82007-02-20 13:58:10 -0800333 if (sbi) {
Ian Kent5f6f4f22008-07-23 21:30:09 -0700334 spin_lock(&sbi->lookup_lock);
Ian Kent25767372008-07-23 21:30:12 -0700335 if (!list_empty(&inf->active))
336 list_del(&inf->active);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700337 if (!list_empty(&inf->expiring))
338 list_del(&inf->expiring);
339 spin_unlock(&sbi->lookup_lock);
Ian Kentf50b6f82007-02-20 13:58:10 -0800340 }
341
Jeff Mahoneyc3724b12007-04-11 23:28:46 -0700342 inf->dentry = NULL;
343 inf->inode = NULL;
344
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 autofs4_free_ino(inf);
346 }
347}
348
349/* For dentries of directories in the root dir */
350static struct dentry_operations autofs4_root_dentry_operations = {
351 .d_revalidate = autofs4_revalidate,
352 .d_release = autofs4_dentry_release,
353};
354
355/* For other dentries */
356static struct dentry_operations autofs4_dentry_operations = {
357 .d_revalidate = autofs4_revalidate,
358 .d_release = autofs4_dentry_release,
359};
360
Ian Kent25767372008-07-23 21:30:12 -0700361static struct dentry *autofs4_lookup_active(struct autofs_sb_info *sbi, struct dentry *parent, struct qstr *name)
362{
363 unsigned int len = name->len;
364 unsigned int hash = name->hash;
365 const unsigned char *str = name->name;
366 struct list_head *p, *head;
367
368 spin_lock(&dcache_lock);
369 spin_lock(&sbi->lookup_lock);
370 head = &sbi->active_list;
371 list_for_each(p, head) {
372 struct autofs_info *ino;
373 struct dentry *dentry;
374 struct qstr *qstr;
375
376 ino = list_entry(p, struct autofs_info, active);
377 dentry = ino->dentry;
378
379 spin_lock(&dentry->d_lock);
380
381 /* Already gone? */
382 if (atomic_read(&dentry->d_count) == 0)
383 goto next;
384
385 qstr = &dentry->d_name;
386
387 if (dentry->d_name.hash != hash)
388 goto next;
389 if (dentry->d_parent != parent)
390 goto next;
391
392 if (qstr->len != len)
393 goto next;
394 if (memcmp(qstr->name, str, len))
395 goto next;
396
397 if (d_unhashed(dentry)) {
398 dget(dentry);
399 spin_unlock(&dentry->d_lock);
400 spin_unlock(&sbi->lookup_lock);
401 spin_unlock(&dcache_lock);
402 return dentry;
403 }
404next:
405 spin_unlock(&dentry->d_lock);
406 }
407 spin_unlock(&sbi->lookup_lock);
408 spin_unlock(&dcache_lock);
409
410 return NULL;
411}
412
Ian Kent5f6f4f22008-07-23 21:30:09 -0700413static struct dentry *autofs4_lookup_expiring(struct autofs_sb_info *sbi, struct dentry *parent, struct qstr *name)
Ian Kentf50b6f82007-02-20 13:58:10 -0800414{
415 unsigned int len = name->len;
416 unsigned int hash = name->hash;
417 const unsigned char *str = name->name;
418 struct list_head *p, *head;
419
420 spin_lock(&dcache_lock);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700421 spin_lock(&sbi->lookup_lock);
422 head = &sbi->expiring_list;
Ian Kentf50b6f82007-02-20 13:58:10 -0800423 list_for_each(p, head) {
424 struct autofs_info *ino;
425 struct dentry *dentry;
426 struct qstr *qstr;
427
Ian Kent5f6f4f22008-07-23 21:30:09 -0700428 ino = list_entry(p, struct autofs_info, expiring);
Ian Kentf50b6f82007-02-20 13:58:10 -0800429 dentry = ino->dentry;
430
431 spin_lock(&dentry->d_lock);
432
433 /* Bad luck, we've already been dentry_iput */
434 if (!dentry->d_inode)
435 goto next;
436
437 qstr = &dentry->d_name;
438
439 if (dentry->d_name.hash != hash)
440 goto next;
441 if (dentry->d_parent != parent)
442 goto next;
443
444 if (qstr->len != len)
445 goto next;
446 if (memcmp(qstr->name, str, len))
447 goto next;
448
449 if (d_unhashed(dentry)) {
Ian Kentf50b6f82007-02-20 13:58:10 -0800450 dget(dentry);
Ian Kentf50b6f82007-02-20 13:58:10 -0800451 spin_unlock(&dentry->d_lock);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700452 spin_unlock(&sbi->lookup_lock);
Ian Kentf50b6f82007-02-20 13:58:10 -0800453 spin_unlock(&dcache_lock);
454 return dentry;
455 }
456next:
457 spin_unlock(&dentry->d_lock);
458 }
Ian Kent5f6f4f22008-07-23 21:30:09 -0700459 spin_unlock(&sbi->lookup_lock);
Ian Kentf50b6f82007-02-20 13:58:10 -0800460 spin_unlock(&dcache_lock);
461
462 return NULL;
463}
464
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465/* Lookups in the root directory */
466static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
467{
468 struct autofs_sb_info *sbi;
Ian Kent25767372008-07-23 21:30:12 -0700469 struct autofs_info *ino;
470 struct dentry *expiring, *unhashed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 int oz_mode;
472
473 DPRINTK("name = %.*s",
474 dentry->d_name.len, dentry->d_name.name);
475
Ian Kent718c6042006-03-27 01:14:42 -0800476 /* File name too long to exist */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 if (dentry->d_name.len > NAME_MAX)
Ian Kent718c6042006-03-27 01:14:42 -0800478 return ERR_PTR(-ENAMETOOLONG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479
480 sbi = autofs4_sbi(dir->i_sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 oz_mode = autofs4_oz_mode(sbi);
Ian Kent718c6042006-03-27 01:14:42 -0800482
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
Pavel Emelianova47afb02007-10-18 23:39:46 -0700484 current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485
Ian Kent5f6f4f22008-07-23 21:30:09 -0700486 expiring = autofs4_lookup_expiring(sbi, dentry->d_parent, &dentry->d_name);
487 if (expiring) {
Ian Kentf50b6f82007-02-20 13:58:10 -0800488 /*
489 * If we are racing with expire the request might not
490 * be quite complete but the directory has been removed
491 * so it must have been successful, so just wait for it.
492 */
Ian Kent25767372008-07-23 21:30:12 -0700493 ino = autofs4_dentry_ino(expiring);
Ian Kent06a35982008-07-23 21:30:28 -0700494 autofs4_expire_wait(expiring);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700495 spin_lock(&sbi->lookup_lock);
496 if (!list_empty(&ino->expiring))
497 list_del_init(&ino->expiring);
498 spin_unlock(&sbi->lookup_lock);
499 dput(expiring);
Ian Kentf50b6f82007-02-20 13:58:10 -0800500 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501
Ian Kent25767372008-07-23 21:30:12 -0700502 unhashed = autofs4_lookup_active(sbi, dentry->d_parent, &dentry->d_name);
503 if (unhashed)
504 dentry = unhashed;
505 else {
506 /*
507 * Mark the dentry incomplete but don't hash it. We do this
508 * to serialize our inode creation operations (symlink and
509 * mkdir) which prevents deadlock during the callback to
510 * the daemon. Subsequent user space lookups for the same
511 * dentry are placed on the wait queue while the daemon
512 * itself is allowed passage unresticted so the create
513 * operation itself can then hash the dentry. Finally,
514 * we check for the hashed dentry and return the newly
515 * hashed dentry.
516 */
517 dentry->d_op = &autofs4_root_dentry_operations;
Ian Kent5f6f4f22008-07-23 21:30:09 -0700518
Ian Kent25767372008-07-23 21:30:12 -0700519 /*
520 * And we need to ensure that the same dentry is used for
521 * all following lookup calls until it is hashed so that
522 * the dentry flags are persistent throughout the request.
523 */
524 ino = autofs4_init_ino(NULL, sbi, 0555);
525 if (!ino)
526 return ERR_PTR(-ENOMEM);
527
528 dentry->d_fsdata = ino;
529 ino->dentry = dentry;
530
531 spin_lock(&sbi->lookup_lock);
532 list_add(&ino->active, &sbi->active_list);
533 spin_unlock(&sbi->lookup_lock);
534
535 d_instantiate(dentry, NULL);
536 }
Ian Kent5f6f4f22008-07-23 21:30:09 -0700537
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 if (!oz_mode) {
539 spin_lock(&dentry->d_lock);
540 dentry->d_flags |= DCACHE_AUTOFS_PENDING;
541 spin_unlock(&dentry->d_lock);
Ian Kentc432c252008-07-23 21:30:14 -0700542 if (dentry->d_op && dentry->d_op->d_revalidate) {
543 mutex_unlock(&dir->i_mutex);
544 (dentry->d_op->d_revalidate)(dentry, nd);
545 mutex_lock(&dir->i_mutex);
546 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547 }
548
549 /*
550 * If we are still pending, check if we had to handle
551 * a signal. If so we can force a restart..
552 */
553 if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
554 /* See if we were interrupted */
555 if (signal_pending(current)) {
556 sigset_t *sigset = &current->pending.signal;
557 if (sigismember (sigset, SIGKILL) ||
558 sigismember (sigset, SIGQUIT) ||
559 sigismember (sigset, SIGINT)) {
Ian Kent25767372008-07-23 21:30:12 -0700560 if (unhashed)
561 dput(unhashed);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 return ERR_PTR(-ERESTARTNOINTR);
563 }
564 }
Ian Kent25767372008-07-23 21:30:12 -0700565 if (!oz_mode) {
566 spin_lock(&dentry->d_lock);
567 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
568 spin_unlock(&dentry->d_lock);
569 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 }
571
572 /*
573 * If this dentry is unhashed, then we shouldn't honour this
Ian Kentc9ffec42007-02-20 13:58:10 -0800574 * lookup. Returning ENOENT here doesn't do the right thing
575 * for all system calls, but it should be OK for the operations
576 * we permit from an autofs.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 */
Ian Kent1864f7b2007-08-22 14:01:54 -0700578 if (!oz_mode && d_unhashed(dentry)) {
Ian Kentc9ffec42007-02-20 13:58:10 -0800579 /*
580 * A user space application can (and has done in the past)
581 * remove and re-create this directory during the callback.
582 * This can leave us with an unhashed dentry, but a
583 * successful mount! So we need to perform another
584 * cached lookup in case the dentry now exists.
585 */
586 struct dentry *parent = dentry->d_parent;
587 struct dentry *new = d_lookup(parent, &dentry->d_name);
588 if (new != NULL)
589 dentry = new;
590 else
591 dentry = ERR_PTR(-ENOENT);
592
Ian Kent25767372008-07-23 21:30:12 -0700593 if (unhashed)
594 dput(unhashed);
595
Ian Kentc9ffec42007-02-20 13:58:10 -0800596 return dentry;
Ian Kentf50b6f82007-02-20 13:58:10 -0800597 }
598
Ian Kent25767372008-07-23 21:30:12 -0700599 if (unhashed)
600 return unhashed;
601
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 return NULL;
603}
604
605static int autofs4_dir_symlink(struct inode *dir,
606 struct dentry *dentry,
607 const char *symname)
608{
609 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
610 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800611 struct autofs_info *p_ino;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 struct inode *inode;
613 char *cp;
614
615 DPRINTK("%s <- %.*s", symname,
616 dentry->d_name.len, dentry->d_name.name);
617
618 if (!autofs4_oz_mode(sbi))
619 return -EACCES;
620
621 ino = autofs4_init_ino(ino, sbi, S_IFLNK | 0555);
Ian Kent25767372008-07-23 21:30:12 -0700622 if (!ino)
623 return -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624
Ian Kent25767372008-07-23 21:30:12 -0700625 spin_lock(&sbi->lookup_lock);
626 if (!list_empty(&ino->active))
627 list_del_init(&ino->active);
628 spin_unlock(&sbi->lookup_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629
Ian Kentef581a72008-07-23 21:30:13 -0700630 ino->size = strlen(symname);
Ian Kent25767372008-07-23 21:30:12 -0700631 cp = kmalloc(ino->size + 1, GFP_KERNEL);
632 if (!cp) {
633 if (!dentry->d_fsdata)
634 kfree(ino);
635 return -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 }
637
638 strcpy(cp, symname);
639
640 inode = autofs4_get_inode(dir->i_sb, ino);
Ian Kent25767372008-07-23 21:30:12 -0700641 if (!inode) {
642 kfree(cp);
643 if (!dentry->d_fsdata)
644 kfree(ino);
645 return -ENOMEM;
646 }
Ian Kent1864f7b2007-08-22 14:01:54 -0700647 d_add(dentry, inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648
649 if (dir == dir->i_sb->s_root->d_inode)
650 dentry->d_op = &autofs4_root_dentry_operations;
651 else
652 dentry->d_op = &autofs4_dentry_operations;
653
654 dentry->d_fsdata = ino;
655 ino->dentry = dget(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800656 atomic_inc(&ino->count);
657 p_ino = autofs4_dentry_ino(dentry->d_parent);
658 if (p_ino && dentry->d_parent != dentry)
659 atomic_inc(&p_ino->count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 ino->inode = inode;
661
Ian Kent25767372008-07-23 21:30:12 -0700662 ino->u.symlink = cp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 dir->i_mtime = CURRENT_TIME;
664
665 return 0;
666}
667
668/*
669 * NOTE!
670 *
671 * Normal filesystems would do a "d_delete()" to tell the VFS dcache
672 * that the file no longer exists. However, doing that means that the
673 * VFS layer can turn the dentry into a negative dentry. We don't want
Ian Kentf50b6f82007-02-20 13:58:10 -0800674 * this, because the unlink is probably the result of an expire.
Ian Kent5f6f4f22008-07-23 21:30:09 -0700675 * We simply d_drop it and add it to a expiring list in the super block,
676 * which allows the dentry lookup to check for an incomplete expire.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 *
678 * If a process is blocked on the dentry waiting for the expire to finish,
679 * it will invalidate the dentry and try to mount with a new one.
680 *
681 * Also see autofs4_dir_rmdir()..
682 */
683static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
684{
685 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
686 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800687 struct autofs_info *p_ino;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688
689 /* This allows root to remove symlinks */
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700690 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 return -EACCES;
692
Ian Kent1aff3c82006-03-27 01:14:46 -0800693 if (atomic_dec_and_test(&ino->count)) {
694 p_ino = autofs4_dentry_ino(dentry->d_parent);
695 if (p_ino && dentry->d_parent != dentry)
696 atomic_dec(&p_ino->count);
697 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 dput(ino->dentry);
699
700 dentry->d_inode->i_size = 0;
Dave Hansence71ec32006-09-30 23:29:06 -0700701 clear_nlink(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702
703 dir->i_mtime = CURRENT_TIME;
704
Ian Kentf50b6f82007-02-20 13:58:10 -0800705 spin_lock(&dcache_lock);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700706 spin_lock(&sbi->lookup_lock);
Ian Kent25767372008-07-23 21:30:12 -0700707 if (list_empty(&ino->expiring))
708 list_add(&ino->expiring, &sbi->expiring_list);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700709 spin_unlock(&sbi->lookup_lock);
Ian Kentf50b6f82007-02-20 13:58:10 -0800710 spin_lock(&dentry->d_lock);
711 __d_drop(dentry);
712 spin_unlock(&dentry->d_lock);
713 spin_unlock(&dcache_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714
715 return 0;
716}
717
718static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
719{
720 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
721 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800722 struct autofs_info *p_ino;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723
Ian Kentf50b6f82007-02-20 13:58:10 -0800724 DPRINTK("dentry %p, removing %.*s",
725 dentry, dentry->d_name.len, dentry->d_name.name);
726
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 if (!autofs4_oz_mode(sbi))
728 return -EACCES;
729
730 spin_lock(&dcache_lock);
731 if (!list_empty(&dentry->d_subdirs)) {
732 spin_unlock(&dcache_lock);
733 return -ENOTEMPTY;
734 }
Ian Kent5f6f4f22008-07-23 21:30:09 -0700735 spin_lock(&sbi->lookup_lock);
Ian Kent25767372008-07-23 21:30:12 -0700736 if (list_empty(&ino->expiring))
737 list_add(&ino->expiring, &sbi->expiring_list);
Ian Kent5f6f4f22008-07-23 21:30:09 -0700738 spin_unlock(&sbi->lookup_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 spin_lock(&dentry->d_lock);
740 __d_drop(dentry);
741 spin_unlock(&dentry->d_lock);
742 spin_unlock(&dcache_lock);
743
Ian Kent1aff3c82006-03-27 01:14:46 -0800744 if (atomic_dec_and_test(&ino->count)) {
745 p_ino = autofs4_dentry_ino(dentry->d_parent);
746 if (p_ino && dentry->d_parent != dentry)
747 atomic_dec(&p_ino->count);
748 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 dput(ino->dentry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 dentry->d_inode->i_size = 0;
Dave Hansence71ec32006-09-30 23:29:06 -0700751 clear_nlink(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752
753 if (dir->i_nlink)
Dave Hansen9a53c3a2006-09-30 23:29:03 -0700754 drop_nlink(dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755
756 return 0;
757}
758
759static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
760{
761 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
762 struct autofs_info *ino = autofs4_dentry_ino(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800763 struct autofs_info *p_ino;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764 struct inode *inode;
765
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700766 if (!autofs4_oz_mode(sbi))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 return -EACCES;
768
769 DPRINTK("dentry %p, creating %.*s",
770 dentry, dentry->d_name.len, dentry->d_name.name);
771
772 ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
Ian Kent25767372008-07-23 21:30:12 -0700773 if (!ino)
774 return -ENOMEM;
775
776 spin_lock(&sbi->lookup_lock);
777 if (!list_empty(&ino->active))
778 list_del_init(&ino->active);
779 spin_unlock(&sbi->lookup_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780
781 inode = autofs4_get_inode(dir->i_sb, ino);
Ian Kent25767372008-07-23 21:30:12 -0700782 if (!inode) {
783 if (!dentry->d_fsdata)
784 kfree(ino);
785 return -ENOMEM;
786 }
Ian Kent1864f7b2007-08-22 14:01:54 -0700787 d_add(dentry, inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788
789 if (dir == dir->i_sb->s_root->d_inode)
790 dentry->d_op = &autofs4_root_dentry_operations;
791 else
792 dentry->d_op = &autofs4_dentry_operations;
793
794 dentry->d_fsdata = ino;
795 ino->dentry = dget(dentry);
Ian Kent1aff3c82006-03-27 01:14:46 -0800796 atomic_inc(&ino->count);
797 p_ino = autofs4_dentry_ino(dentry->d_parent);
798 if (p_ino && dentry->d_parent != dentry)
799 atomic_inc(&p_ino->count);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 ino->inode = inode;
Dave Hansend8c76e62006-09-30 23:29:04 -0700801 inc_nlink(dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 dir->i_mtime = CURRENT_TIME;
803
804 return 0;
805}
806
807/* Get/set timeout ioctl() operation */
808static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
809 unsigned long __user *p)
810{
811 int rv;
812 unsigned long ntimeout;
813
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700814 if ((rv = get_user(ntimeout, p)) ||
815 (rv = put_user(sbi->exp_timeout/HZ, p)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 return rv;
817
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700818 if (ntimeout > ULONG_MAX/HZ)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 sbi->exp_timeout = 0;
820 else
821 sbi->exp_timeout = ntimeout * HZ;
822
823 return 0;
824}
825
826/* Return protocol version */
827static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int __user *p)
828{
829 return put_user(sbi->version, p);
830}
831
832/* Return protocol sub version */
833static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int __user *p)
834{
835 return put_user(sbi->sub_version, p);
836}
837
838/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839* Tells the daemon whether it can umount the autofs mount.
840*/
841static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
842{
843 int status = 0;
844
Ian Kente3474a82006-03-27 01:14:51 -0800845 if (may_umount(mnt))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 status = 1;
847
848 DPRINTK("returning %d", status);
849
850 status = put_user(status, p);
851
852 return status;
853}
854
855/* Identify autofs4_dentries - this is so we can tell if there's
856 an extra dentry refcount or not. We only hold a refcount on the
857 dentry if its non-negative (ie, d_inode != NULL)
858*/
859int is_autofs4_dentry(struct dentry *dentry)
860{
861 return dentry && dentry->d_inode &&
862 (dentry->d_op == &autofs4_root_dentry_operations ||
863 dentry->d_op == &autofs4_dentry_operations) &&
864 dentry->d_fsdata != NULL;
865}
866
867/*
868 * ioctl()'s on the root directory is the chief method for the daemon to
869 * generate kernel reactions
870 */
871static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
872 unsigned int cmd, unsigned long arg)
873{
874 struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
875 void __user *p = (void __user *)arg;
876
877 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
Pavel Emelianova47afb02007-10-18 23:39:46 -0700878 cmd,arg,sbi,task_pgrp_nr(current));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700879
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700880 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
881 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882 return -ENOTTY;
883
Sukadev Bhattiprolud78e53c2007-05-10 22:23:06 -0700884 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885 return -EPERM;
886
887 switch(cmd) {
888 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */
889 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,0);
890 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */
891 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT);
892 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
893 autofs4_catatonic_mode(sbi);
894 return 0;
895 case AUTOFS_IOC_PROTOVER: /* Get protocol version */
896 return autofs4_get_protover(sbi, p);
897 case AUTOFS_IOC_PROTOSUBVER: /* Get protocol sub version */
898 return autofs4_get_protosubver(sbi, p);
899 case AUTOFS_IOC_SETTIMEOUT:
900 return autofs4_get_set_timeout(sbi, p);
901
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902 case AUTOFS_IOC_ASKUMOUNT:
Josef "Jeff" Sipeka4669ed2006-12-08 02:36:46 -0800903 return autofs4_ask_umount(filp->f_path.mnt, p);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700904
905 /* return a single thing to expire */
906 case AUTOFS_IOC_EXPIRE:
Josef "Jeff" Sipeka4669ed2006-12-08 02:36:46 -0800907 return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700908 /* same as above, but can send multiple expires through pipe */
909 case AUTOFS_IOC_EXPIRE_MULTI:
Josef "Jeff" Sipeka4669ed2006-12-08 02:36:46 -0800910 return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911
912 default:
913 return -ENOSYS;
914 }
915}