1 /* -*- c -*- --------------------------------------------------------------- *
3 * linux/fs/autofs/root.c
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
7 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
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.
13 * ------------------------------------------------------------------------- */
15 #include <linux/capability.h>
16 #include <linux/errno.h>
17 #include <linux/stat.h>
18 #include <linux/slab.h>
19 #include <linux/param.h>
20 #include <linux/time.h>
21 #include <linux/compat.h>
22 #include <linux/mutex.h>
26 DEFINE_SPINLOCK(autofs4_lock);
28 static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
29 static int autofs4_dir_unlink(struct inode *,struct dentry *);
30 static int autofs4_dir_rmdir(struct inode *,struct dentry *);
31 static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
32 static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
34 static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long);
36 static int autofs4_dir_open(struct inode *inode, struct file *file);
37 static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
39 const struct file_operations autofs4_root_operations = {
40 .open = dcache_dir_open,
41 .release = dcache_dir_close,
42 .read = generic_read_dir,
43 .readdir = dcache_readdir,
44 .llseek = dcache_dir_lseek,
45 .unlocked_ioctl = autofs4_root_ioctl,
47 .compat_ioctl = autofs4_root_compat_ioctl,
51 const struct file_operations autofs4_dir_operations = {
52 .open = autofs4_dir_open,
53 .release = dcache_dir_close,
54 .read = generic_read_dir,
55 .readdir = dcache_readdir,
56 .llseek = dcache_dir_lseek,
59 const struct inode_operations autofs4_dir_inode_operations = {
60 .lookup = autofs4_lookup,
61 .unlink = autofs4_dir_unlink,
62 .symlink = autofs4_dir_symlink,
63 .mkdir = autofs4_dir_mkdir,
64 .rmdir = autofs4_dir_rmdir,
67 static void autofs4_add_active(struct dentry *dentry)
69 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
70 struct autofs_info *ino = autofs4_dentry_ino(dentry);
72 spin_lock(&sbi->lookup_lock);
73 if (!ino->active_count) {
74 if (list_empty(&ino->active))
75 list_add(&ino->active, &sbi->active_list);
78 spin_unlock(&sbi->lookup_lock);
83 static void autofs4_del_active(struct dentry *dentry)
85 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
86 struct autofs_info *ino = autofs4_dentry_ino(dentry);
88 spin_lock(&sbi->lookup_lock);
90 if (!ino->active_count) {
91 if (!list_empty(&ino->active))
92 list_del_init(&ino->active);
94 spin_unlock(&sbi->lookup_lock);
99 static int autofs4_dir_open(struct inode *inode, struct file *file)
101 struct dentry *dentry = file->f_path.dentry;
102 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
104 DPRINTK("file=%p dentry=%p %.*s",
105 file, dentry, dentry->d_name.len, dentry->d_name.name);
107 if (autofs4_oz_mode(sbi))
111 * An empty directory in an autofs file system is always a
112 * mount point. The daemon must have failed to mount this
113 * during lookup so it doesn't exist. This can happen, for
114 * example, if user space returns an incorrect status for a
115 * mount request. Otherwise we're doing a readdir on the
116 * autofs file system so just let the libfs routines handle
119 spin_lock(&autofs4_lock);
120 spin_lock(&dentry->d_lock);
121 if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
122 spin_unlock(&dentry->d_lock);
123 spin_unlock(&autofs4_lock);
126 spin_unlock(&dentry->d_lock);
127 spin_unlock(&autofs4_lock);
130 return dcache_dir_open(inode, file);
133 void autofs4_dentry_release(struct dentry *de)
135 struct autofs_info *inf;
137 DPRINTK("releasing %p", de);
139 inf = autofs4_dentry_ino(de);
143 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb);
146 spin_lock(&sbi->lookup_lock);
147 if (!list_empty(&inf->active))
148 list_del(&inf->active);
149 if (!list_empty(&inf->expiring))
150 list_del(&inf->expiring);
151 spin_unlock(&sbi->lookup_lock);
157 autofs4_free_ino(inf);
161 /* For dentries of directories in the root dir */
162 static const struct dentry_operations autofs4_root_dentry_operations = {
163 .d_release = autofs4_dentry_release,
166 /* For other dentries */
167 static const struct dentry_operations autofs4_dentry_operations = {
168 .d_automount = autofs4_d_automount,
169 .d_manage = autofs4_d_manage,
170 .d_release = autofs4_dentry_release,
173 static struct dentry *autofs4_lookup_active(struct dentry *dentry)
175 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
176 struct dentry *parent = dentry->d_parent;
177 struct qstr *name = &dentry->d_name;
178 unsigned int len = name->len;
179 unsigned int hash = name->hash;
180 const unsigned char *str = name->name;
181 struct list_head *p, *head;
183 spin_lock(&autofs4_lock);
184 spin_lock(&sbi->lookup_lock);
185 head = &sbi->active_list;
186 list_for_each(p, head) {
187 struct autofs_info *ino;
188 struct dentry *active;
191 ino = list_entry(p, struct autofs_info, active);
192 active = ino->dentry;
194 spin_lock(&active->d_lock);
197 if (active->d_count == 0)
200 qstr = &active->d_name;
202 if (active->d_name.hash != hash)
204 if (active->d_parent != parent)
207 if (qstr->len != len)
209 if (memcmp(qstr->name, str, len))
212 if (d_unhashed(active)) {
214 spin_unlock(&active->d_lock);
215 spin_unlock(&sbi->lookup_lock);
216 spin_unlock(&autofs4_lock);
220 spin_unlock(&active->d_lock);
222 spin_unlock(&sbi->lookup_lock);
223 spin_unlock(&autofs4_lock);
228 static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
230 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
231 struct dentry *parent = dentry->d_parent;
232 struct qstr *name = &dentry->d_name;
233 unsigned int len = name->len;
234 unsigned int hash = name->hash;
235 const unsigned char *str = name->name;
236 struct list_head *p, *head;
238 spin_lock(&autofs4_lock);
239 spin_lock(&sbi->lookup_lock);
240 head = &sbi->expiring_list;
241 list_for_each(p, head) {
242 struct autofs_info *ino;
243 struct dentry *expiring;
246 ino = list_entry(p, struct autofs_info, expiring);
247 expiring = ino->dentry;
249 spin_lock(&expiring->d_lock);
251 /* Bad luck, we've already been dentry_iput */
252 if (!expiring->d_inode)
255 qstr = &expiring->d_name;
257 if (expiring->d_name.hash != hash)
259 if (expiring->d_parent != parent)
262 if (qstr->len != len)
264 if (memcmp(qstr->name, str, len))
267 if (d_unhashed(expiring)) {
268 dget_dlock(expiring);
269 spin_unlock(&expiring->d_lock);
270 spin_unlock(&sbi->lookup_lock);
271 spin_unlock(&autofs4_lock);
275 spin_unlock(&expiring->d_lock);
277 spin_unlock(&sbi->lookup_lock);
278 spin_unlock(&autofs4_lock);
283 static int autofs4_mount_wait(struct dentry *dentry)
285 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
286 struct autofs_info *ino = autofs4_dentry_ino(dentry);
289 if (ino->flags & AUTOFS_INF_PENDING) {
290 DPRINTK("waiting for mount name=%.*s",
291 dentry->d_name.len, dentry->d_name.name);
292 status = autofs4_wait(sbi, dentry, NFY_MOUNT);
293 DPRINTK("mount wait done status=%d", status);
294 ino->last_used = jiffies;
300 static int do_expire_wait(struct dentry *dentry)
302 struct dentry *expiring;
304 expiring = autofs4_lookup_expiring(dentry);
306 return autofs4_expire_wait(dentry);
309 * If we are racing with expire the request might not
310 * be quite complete, but the directory has been removed
311 * so it must have been successful, just wait for it.
313 autofs4_expire_wait(expiring);
314 autofs4_del_expiring(expiring);
320 static struct dentry *autofs4_mountpoint_changed(struct path *path)
322 struct dentry *dentry = path->dentry;
323 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
326 * If this is an indirect mount the dentry could have gone away
327 * as a result of an expire and a new one created.
329 if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
330 struct dentry *parent = dentry->d_parent;
331 struct dentry *new = d_lookup(parent, &dentry->d_name);
340 struct vfsmount *autofs4_d_automount(struct path *path)
342 struct dentry *dentry = path->dentry;
343 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
344 struct autofs_info *ino = autofs4_dentry_ino(dentry);
347 DPRINTK("dentry=%p %.*s",
348 dentry, dentry->d_name.len, dentry->d_name.name);
351 * Someone may have manually umounted this or it was a submount
352 * that has gone away.
354 spin_lock(&dentry->d_lock);
355 if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
356 if (!(dentry->d_flags & DCACHE_MANAGE_TRANSIT) &&
357 (dentry->d_flags & DCACHE_NEED_AUTOMOUNT))
358 __managed_dentry_set_transit(path->dentry);
360 spin_unlock(&dentry->d_lock);
362 /* The daemon never triggers a mount. */
363 if (autofs4_oz_mode(sbi))
367 * If an expire request is pending everyone must wait.
368 * If the expire fails we're still mounted so continue
369 * the follow and return. A return of -EAGAIN (which only
370 * happens with indirect mounts) means the expire completed
371 * and the directory was removed, so just go ahead and try
374 status = do_expire_wait(dentry);
375 if (status && status != -EAGAIN)
378 /* Callback to the daemon to perform the mount or wait */
379 spin_lock(&sbi->fs_lock);
380 if (ino->flags & AUTOFS_INF_PENDING) {
381 spin_unlock(&sbi->fs_lock);
382 status = autofs4_mount_wait(dentry);
384 return ERR_PTR(status);
385 spin_lock(&sbi->fs_lock);
390 * If the dentry is a symlink it's equivalent to a directory
391 * having d_mountpoint() true, so there's no need to call back
394 if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))
396 if (!d_mountpoint(dentry)) {
398 * It's possible that user space hasn't removed directories
399 * after umounting a rootless multi-mount, although it
400 * should. For v5 have_submounts() is sufficient to handle
401 * this because the leaves of the directory tree under the
402 * mount never trigger mounts themselves (they have an autofs
403 * trigger mount mounted on them). But v4 pseudo direct mounts
404 * do need the leaves to to trigger mounts. In this case we
405 * have no choice but to use the list_empty() check and
406 * require user space behave.
408 if (sbi->version > 4) {
409 if (have_submounts(dentry))
412 spin_lock(&dentry->d_lock);
413 if (!list_empty(&dentry->d_subdirs)) {
414 spin_unlock(&dentry->d_lock);
417 spin_unlock(&dentry->d_lock);
419 ino->flags |= AUTOFS_INF_PENDING;
420 spin_unlock(&sbi->fs_lock);
421 status = autofs4_mount_wait(dentry);
423 return ERR_PTR(status);
424 spin_lock(&sbi->fs_lock);
425 ino->flags &= ~AUTOFS_INF_PENDING;
428 if (!(ino->flags & AUTOFS_INF_EXPIRING)) {
430 * Any needed mounting has been completed and the path updated
431 * so turn this into a normal dentry so we don't continually
432 * call ->d_automount() and ->d_manage().
434 spin_lock(&dentry->d_lock);
435 __managed_dentry_clear_transit(dentry);
437 * Only clear DMANAGED_AUTOMOUNT for rootless multi-mounts and
438 * symlinks as in all other cases the dentry will be covered by
439 * an actual mount so ->d_automount() won't be called during
442 if ((!d_mountpoint(dentry) &&
443 !list_empty(&dentry->d_subdirs)) ||
444 (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)))
445 __managed_dentry_clear_automount(dentry);
446 spin_unlock(&dentry->d_lock);
448 spin_unlock(&sbi->fs_lock);
450 /* Mount succeeded, check if we ended up with a new dentry */
451 dentry = autofs4_mountpoint_changed(path);
453 return ERR_PTR(-ENOENT);
458 int autofs4_d_manage(struct dentry *dentry, bool mounting_here)
460 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
462 DPRINTK("dentry=%p %.*s",
463 dentry, dentry->d_name.len, dentry->d_name.name);
465 /* The daemon never waits. */
466 if (autofs4_oz_mode(sbi) || mounting_here) {
467 if (!d_mountpoint(dentry))
472 /* Wait for pending expires */
473 do_expire_wait(dentry);
476 * This dentry may be under construction so wait on mount
479 return autofs4_mount_wait(dentry);
482 /* Lookups in the root directory */
483 static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
485 struct autofs_sb_info *sbi;
486 struct autofs_info *ino;
487 struct dentry *active;
489 DPRINTK("name = %.*s", dentry->d_name.len, dentry->d_name.name);
491 /* File name too long to exist */
492 if (dentry->d_name.len > NAME_MAX)
493 return ERR_PTR(-ENAMETOOLONG);
495 sbi = autofs4_sbi(dir->i_sb);
497 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
498 current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode);
500 active = autofs4_lookup_active(dentry);
504 d_set_d_op(dentry, &autofs4_root_dentry_operations);
507 * A dentry that is not within the root can never trigger a
508 * mount operation, unless the directory already exists, so we
509 * can return fail immediately. The daemon however does need
510 * to create directories within the file system.
512 if (!autofs4_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
513 return ERR_PTR(-ENOENT);
515 /* Mark entries in the root as mount triggers */
516 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) {
517 d_set_d_op(dentry, &autofs4_dentry_operations);
518 __managed_dentry_set_managed(dentry);
521 ino = autofs4_init_ino(NULL, sbi, 0555);
523 return ERR_PTR(-ENOMEM);
525 dentry->d_fsdata = ino;
526 ino->dentry = dentry;
528 autofs4_add_active(dentry);
530 d_instantiate(dentry, NULL);
535 static int autofs4_dir_symlink(struct inode *dir,
536 struct dentry *dentry,
539 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
540 struct autofs_info *ino = autofs4_dentry_ino(dentry);
541 struct autofs_info *p_ino;
545 DPRINTK("%s <- %.*s", symname,
546 dentry->d_name.len, dentry->d_name.name);
548 if (!autofs4_oz_mode(sbi))
551 ino = autofs4_init_ino(ino, sbi, S_IFLNK | 0555);
555 autofs4_del_active(dentry);
557 ino->size = strlen(symname);
558 cp = kmalloc(ino->size + 1, GFP_KERNEL);
560 if (!dentry->d_fsdata)
567 inode = autofs4_get_inode(dir->i_sb, ino);
570 if (!dentry->d_fsdata)
574 d_add(dentry, inode);
576 dentry->d_fsdata = ino;
577 ino->dentry = dget(dentry);
578 atomic_inc(&ino->count);
579 p_ino = autofs4_dentry_ino(dentry->d_parent);
580 if (p_ino && dentry->d_parent != dentry)
581 atomic_inc(&p_ino->count);
585 dir->i_mtime = CURRENT_TIME;
593 * Normal filesystems would do a "d_delete()" to tell the VFS dcache
594 * that the file no longer exists. However, doing that means that the
595 * VFS layer can turn the dentry into a negative dentry. We don't want
596 * this, because the unlink is probably the result of an expire.
597 * We simply d_drop it and add it to a expiring list in the super block,
598 * which allows the dentry lookup to check for an incomplete expire.
600 * If a process is blocked on the dentry waiting for the expire to finish,
601 * it will invalidate the dentry and try to mount with a new one.
603 * Also see autofs4_dir_rmdir()..
605 static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
607 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
608 struct autofs_info *ino = autofs4_dentry_ino(dentry);
609 struct autofs_info *p_ino;
611 /* This allows root to remove symlinks */
612 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
615 if (atomic_dec_and_test(&ino->count)) {
616 p_ino = autofs4_dentry_ino(dentry->d_parent);
617 if (p_ino && dentry->d_parent != dentry)
618 atomic_dec(&p_ino->count);
622 dentry->d_inode->i_size = 0;
623 clear_nlink(dentry->d_inode);
625 dir->i_mtime = CURRENT_TIME;
627 spin_lock(&autofs4_lock);
628 autofs4_add_expiring(dentry);
629 spin_lock(&dentry->d_lock);
631 spin_unlock(&dentry->d_lock);
632 spin_unlock(&autofs4_lock);
637 static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
639 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
640 struct autofs_info *ino = autofs4_dentry_ino(dentry);
641 struct autofs_info *p_ino;
643 DPRINTK("dentry %p, removing %.*s",
644 dentry, dentry->d_name.len, dentry->d_name.name);
646 if (!autofs4_oz_mode(sbi))
649 spin_lock(&autofs4_lock);
650 spin_lock(&sbi->lookup_lock);
651 spin_lock(&dentry->d_lock);
652 if (!list_empty(&dentry->d_subdirs)) {
653 spin_unlock(&dentry->d_lock);
654 spin_unlock(&sbi->lookup_lock);
655 spin_unlock(&autofs4_lock);
658 __autofs4_add_expiring(dentry);
659 spin_unlock(&sbi->lookup_lock);
661 spin_unlock(&dentry->d_lock);
662 spin_unlock(&autofs4_lock);
664 if (atomic_dec_and_test(&ino->count)) {
665 p_ino = autofs4_dentry_ino(dentry->d_parent);
666 if (p_ino && dentry->d_parent != dentry)
667 atomic_dec(&p_ino->count);
670 dentry->d_inode->i_size = 0;
671 clear_nlink(dentry->d_inode);
679 static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
681 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
682 struct autofs_info *ino = autofs4_dentry_ino(dentry);
683 struct autofs_info *p_ino;
686 if (!autofs4_oz_mode(sbi))
689 DPRINTK("dentry %p, creating %.*s",
690 dentry, dentry->d_name.len, dentry->d_name.name);
692 ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
696 autofs4_del_active(dentry);
698 inode = autofs4_get_inode(dir->i_sb, ino);
700 if (!dentry->d_fsdata)
704 d_add(dentry, inode);
706 dentry->d_fsdata = ino;
707 ino->dentry = dget(dentry);
708 atomic_inc(&ino->count);
709 p_ino = autofs4_dentry_ino(dentry->d_parent);
710 if (p_ino && dentry->d_parent != dentry)
711 atomic_inc(&p_ino->count);
714 dir->i_mtime = CURRENT_TIME;
719 /* Get/set timeout ioctl() operation */
721 static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
722 compat_ulong_t __user *p)
725 unsigned long ntimeout;
727 if ((rv = get_user(ntimeout, p)) ||
728 (rv = put_user(sbi->exp_timeout/HZ, p)))
731 if (ntimeout > UINT_MAX/HZ)
732 sbi->exp_timeout = 0;
734 sbi->exp_timeout = ntimeout * HZ;
740 static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
741 unsigned long __user *p)
744 unsigned long ntimeout;
746 if ((rv = get_user(ntimeout, p)) ||
747 (rv = put_user(sbi->exp_timeout/HZ, p)))
750 if (ntimeout > ULONG_MAX/HZ)
751 sbi->exp_timeout = 0;
753 sbi->exp_timeout = ntimeout * HZ;
758 /* Return protocol version */
759 static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int __user *p)
761 return put_user(sbi->version, p);
764 /* Return protocol sub version */
765 static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int __user *p)
767 return put_user(sbi->sub_version, p);
771 * Tells the daemon whether it can umount the autofs mount.
773 static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
780 DPRINTK("returning %d", status);
782 status = put_user(status, p);
787 /* Identify autofs4_dentries - this is so we can tell if there's
788 an extra dentry refcount or not. We only hold a refcount on the
789 dentry if its non-negative (ie, d_inode != NULL)
791 int is_autofs4_dentry(struct dentry *dentry)
793 return dentry && dentry->d_inode &&
794 (dentry->d_op == &autofs4_root_dentry_operations ||
795 dentry->d_op == &autofs4_dentry_operations) &&
796 dentry->d_fsdata != NULL;
800 * ioctl()'s on the root directory is the chief method for the daemon to
801 * generate kernel reactions
803 static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
804 unsigned int cmd, unsigned long arg)
806 struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
807 void __user *p = (void __user *)arg;
809 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
810 cmd,arg,sbi,task_pgrp_nr(current));
812 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
813 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
816 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
820 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */
821 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,0);
822 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */
823 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT);
824 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
825 autofs4_catatonic_mode(sbi);
827 case AUTOFS_IOC_PROTOVER: /* Get protocol version */
828 return autofs4_get_protover(sbi, p);
829 case AUTOFS_IOC_PROTOSUBVER: /* Get protocol sub version */
830 return autofs4_get_protosubver(sbi, p);
831 case AUTOFS_IOC_SETTIMEOUT:
832 return autofs4_get_set_timeout(sbi, p);
834 case AUTOFS_IOC_SETTIMEOUT32:
835 return autofs4_compat_get_set_timeout(sbi, p);
838 case AUTOFS_IOC_ASKUMOUNT:
839 return autofs4_ask_umount(filp->f_path.mnt, p);
841 /* return a single thing to expire */
842 case AUTOFS_IOC_EXPIRE:
843 return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p);
844 /* same as above, but can send multiple expires through pipe */
845 case AUTOFS_IOC_EXPIRE_MULTI:
846 return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p);
853 static long autofs4_root_ioctl(struct file *filp,
854 unsigned int cmd, unsigned long arg)
856 struct inode *inode = filp->f_dentry->d_inode;
857 return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
861 static long autofs4_root_compat_ioctl(struct file *filp,
862 unsigned int cmd, unsigned long arg)
864 struct inode *inode = filp->f_path.dentry->d_inode;
867 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
868 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
870 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
871 (unsigned long)compat_ptr(arg));