Lines Matching +full:super +full:- +full:set
1 // SPDX-License-Identifier: GPL-2.0-or-later
34 return -EINVAL; in check_name()
46 return -EINVAL; in invalid_str()
60 if ((param->ver_major != AUTOFS_DEV_IOCTL_VERSION_MAJOR) || in check_dev_ioctl_version()
61 (param->ver_minor > AUTOFS_DEV_IOCTL_VERSION_MINOR)) { in check_dev_ioctl_version()
66 param->ver_major, param->ver_minor, cmd); in check_dev_ioctl_version()
67 err = -EINVAL; in check_dev_ioctl_version()
71 param->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; in check_dev_ioctl_version()
72 param->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; in check_dev_ioctl_version()
87 return ERR_PTR(-EFAULT); in copy_dev_ioctl()
90 return ERR_PTR(-EINVAL); in copy_dev_ioctl()
93 return ERR_PTR(-ENAMETOOLONG); in copy_dev_ioctl()
97 res->size = tmp.size; in copy_dev_ioctl()
123 if (param->size > AUTOFS_DEV_IOCTL_SIZE) { in validate_dev_ioctl()
124 err = invalid_str(param->path, param->size - AUTOFS_DEV_IOCTL_SIZE); in validate_dev_ioctl()
132 /* Setting the per-dentry expire timeout requires a trailing in validate_dev_ioctl()
136 err = check_name(param->path); in validate_dev_ioctl()
138 err = err ? 0 : -EINVAL; in validate_dev_ioctl()
148 err = -EINVAL; in validate_dev_ioctl()
163 /* This should have already been set. */ in autofs_dev_ioctl_version()
164 param->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; in autofs_dev_ioctl_version()
165 param->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; in autofs_dev_ioctl_version()
174 param->protover.version = sbi->version; in autofs_dev_ioctl_protover()
183 param->protosubver.sub_version = sbi->sub_version; in autofs_dev_ioctl_protosubver()
199 err = -ENOENT; in find_autofs_mount()
200 while (path.dentry == path.mnt->mnt_root) { in find_autofs_mount()
201 if (path.dentry->d_sb->s_magic == AUTOFS_SUPER_MAGIC) { in find_autofs_mount()
218 return path->dentry->d_sb->s_dev == *(dev_t *)p; in test_by_dev()
223 struct autofs_info *ino = autofs_dentry_ino(path->dentry); in test_by_type()
225 return ino && ino->sbi->type & *(unsigned *)p; in test_by_type()
230 * to the given path and device number (aka. new_encode_dev(sb->s_dev)).
271 /* param->path has been checked in validate_dev_ioctl() */ in autofs_dev_ioctl_openmount()
273 if (!param->openmount.devid) in autofs_dev_ioctl_openmount()
274 return -EINVAL; in autofs_dev_ioctl_openmount()
276 param->ioctlfd = -1; in autofs_dev_ioctl_openmount()
278 path = param->path; in autofs_dev_ioctl_openmount()
279 devid = new_decode_dev(param->openmount.devid); in autofs_dev_ioctl_openmount()
288 param->ioctlfd = fd; in autofs_dev_ioctl_openmount()
298 return close_fd(param->ioctlfd); in autofs_dev_ioctl_closemount()
311 token = (autofs_wqt_t) param->ready.token; in autofs_dev_ioctl_ready()
326 token = (autofs_wqt_t) param->fail.token; in autofs_dev_ioctl_fail()
327 status = param->fail.status < 0 ? param->fail.status : -ENOENT; in autofs_dev_ioctl_fail()
332 * Set the pipe fd for kernel communication to the daemon.
334 * Normally this is set at mount using an option but if we
351 if (param->setpipefd.pipefd == -1) in autofs_dev_ioctl_setpipefd()
352 return -EINVAL; in autofs_dev_ioctl_setpipefd()
354 pipefd = param->setpipefd.pipefd; in autofs_dev_ioctl_setpipefd()
356 mutex_lock(&sbi->wq_mutex); in autofs_dev_ioctl_setpipefd()
357 if (!(sbi->flags & AUTOFS_SBI_CATATONIC)) { in autofs_dev_ioctl_setpipefd()
358 mutex_unlock(&sbi->wq_mutex); in autofs_dev_ioctl_setpipefd()
359 return -EBUSY; in autofs_dev_ioctl_setpipefd()
365 if (ns_of_pid(new_pid) != ns_of_pid(sbi->oz_pgrp)) { in autofs_dev_ioctl_setpipefd()
367 err = -EINVAL; in autofs_dev_ioctl_setpipefd()
373 err = -EBADF; in autofs_dev_ioctl_setpipefd()
377 err = -EPIPE; in autofs_dev_ioctl_setpipefd()
381 swap(sbi->oz_pgrp, new_pid); in autofs_dev_ioctl_setpipefd()
382 sbi->pipefd = pipefd; in autofs_dev_ioctl_setpipefd()
383 sbi->pipe = pipe; in autofs_dev_ioctl_setpipefd()
384 sbi->flags &= ~AUTOFS_SBI_CATATONIC; in autofs_dev_ioctl_setpipefd()
388 mutex_unlock(&sbi->wq_mutex); in autofs_dev_ioctl_setpipefd()
405 * Set the autofs mount expire timeout.
407 * There are two places an expire timeout can be set, in the autofs
408 * super block info. (this is all that's needed for direct and offset
410 * these) and per-dentry within within the dentry info. If a per-dentry
411 * timeout is set it will override the expire timeout set in the parent
412 * autofs super block info.
414 * If setting the autofs super block expire timeout the autofs_dev_ioctl
416 * setting the per-dentry expire timeout the mount point name is passed
420 * Setting the autofs mount expire timeout sets the timeout in the super
421 * block info. struct. Setting the per-dentry timeout does a little more.
422 * If the timeout is equal to -1 the per-dentry timeout (and flag) is
423 * cleared which reverts to using the super block timeout, otherwise if
424 * timeout is 0 the timeout is set to this value and the flag is left
425 * set which disables expiration for the mount point, lastly the flag
426 * and the timeout are set enabling the dentry to use this timeout.
432 unsigned long timeout = param->timeout.timeout; in autofs_dev_ioctl_timeout()
436 * placed in param->path and param->size adjusted to account in autofs_dev_ioctl_timeout()
437 * for it otherwise param->size it is set to the structure in autofs_dev_ioctl_timeout()
440 if (param->size == AUTOFS_DEV_IOCTL_SIZE) { in autofs_dev_ioctl_timeout()
441 param->timeout.timeout = sbi->exp_timeout / HZ; in autofs_dev_ioctl_timeout()
442 sbi->exp_timeout = timeout * HZ; in autofs_dev_ioctl_timeout()
444 struct dentry *base = fp->f_path.dentry; in autofs_dev_ioctl_timeout()
445 struct inode *inode = base->d_inode; in autofs_dev_ioctl_timeout()
446 int path_len = param->size - AUTOFS_DEV_IOCTL_SIZE - 1; in autofs_dev_ioctl_timeout()
450 if (!autofs_type_indirect(sbi->type)) in autofs_dev_ioctl_timeout()
451 return -EINVAL; in autofs_dev_ioctl_timeout()
454 * could be a problem at shutdown but the super block in autofs_dev_ioctl_timeout()
458 if (timeout >= sbi->exp_timeout) in autofs_dev_ioctl_timeout()
459 pr_warn("per-mount expire timeout is greater than " in autofs_dev_ioctl_timeout()
464 dentry = try_lookup_one_len(param->path, base, path_len); in autofs_dev_ioctl_timeout()
467 return dentry ? PTR_ERR(dentry) : -ENOENT; in autofs_dev_ioctl_timeout()
471 return -ENOENT; in autofs_dev_ioctl_timeout()
474 if (ino->exp_timeout && ino->flags & AUTOFS_INF_EXPIRE_SET) in autofs_dev_ioctl_timeout()
475 param->timeout.timeout = ino->exp_timeout / HZ; in autofs_dev_ioctl_timeout()
477 param->timeout.timeout = sbi->exp_timeout / HZ; in autofs_dev_ioctl_timeout()
479 if (timeout == -1) { in autofs_dev_ioctl_timeout()
480 /* Revert to using the super block timeout */ in autofs_dev_ioctl_timeout()
481 ino->flags &= ~AUTOFS_INF_EXPIRE_SET; in autofs_dev_ioctl_timeout()
482 ino->exp_timeout = 0; in autofs_dev_ioctl_timeout()
484 /* Set the dentry expire flag and timeout. in autofs_dev_ioctl_timeout()
489 ino->flags |= AUTOFS_INF_EXPIRE_SET; in autofs_dev_ioctl_timeout()
490 ino->exp_timeout = timeout * HZ; in autofs_dev_ioctl_timeout()
502 * we need to re-connect to mounts that may have used the original
513 int err = -ENOENT; in autofs_dev_ioctl_requester()
515 /* param->path has been checked in validate_dev_ioctl() */ in autofs_dev_ioctl_requester()
517 devid = sbi->sb->s_dev; in autofs_dev_ioctl_requester()
519 param->requester.uid = param->requester.gid = -1; in autofs_dev_ioctl_requester()
521 err = find_autofs_mount(param->path, &path, test_by_dev, &devid); in autofs_dev_ioctl_requester()
529 spin_lock(&sbi->fs_lock); in autofs_dev_ioctl_requester()
530 param->requester.uid = in autofs_dev_ioctl_requester()
531 from_kuid_munged(current_user_ns(), ino->uid); in autofs_dev_ioctl_requester()
532 param->requester.gid = in autofs_dev_ioctl_requester()
533 from_kgid_munged(current_user_ns(), ino->gid); in autofs_dev_ioctl_requester()
534 spin_unlock(&sbi->fs_lock); in autofs_dev_ioctl_requester()
542 * Call repeatedly until it returns -EAGAIN, meaning there's nothing
552 how = param->expire.how; in autofs_dev_ioctl_expire()
553 mnt = fp->f_path.mnt; in autofs_dev_ioctl_expire()
555 return autofs_do_expire_multi(sbi->sb, mnt, sbi, how); in autofs_dev_ioctl_expire()
563 param->askumount.may_umount = 0; in autofs_dev_ioctl_askumount()
564 if (may_umount(fp->f_path.mnt)) in autofs_dev_ioctl_askumount()
565 param->askumount.may_umount = 1; in autofs_dev_ioctl_askumount()
575 * mountpoint or contains a mount, such as a multi-mount
577 * path is a mount point and the super magic of the covering
585 * the super magic of the mount or 0 otherwise.
598 int err = -ENOENT; in autofs_dev_ioctl_ismountpoint()
600 /* param->path has been checked in validate_dev_ioctl() */ in autofs_dev_ioctl_ismountpoint()
602 name = param->path; in autofs_dev_ioctl_ismountpoint()
603 type = param->ismountpoint.in.type; in autofs_dev_ioctl_ismountpoint()
605 param->ismountpoint.out.devid = devid = 0; in autofs_dev_ioctl_ismountpoint()
606 param->ismountpoint.out.magic = magic = 0; in autofs_dev_ioctl_ismountpoint()
608 if (!fp || param->ioctlfd == -1) { in autofs_dev_ioctl_ismountpoint()
617 devid = new_encode_dev(path.dentry->d_sb->s_dev); in autofs_dev_ioctl_ismountpoint()
619 if (path.mnt->mnt_root == path.dentry) { in autofs_dev_ioctl_ismountpoint()
621 magic = path.dentry->d_sb->s_magic; in autofs_dev_ioctl_ismountpoint()
624 dev_t dev = sbi->sb->s_dev; in autofs_dev_ioctl_ismountpoint()
635 magic = path.dentry->d_sb->s_magic; in autofs_dev_ioctl_ismountpoint()
638 param->ismountpoint.out.devid = devid; in autofs_dev_ioctl_ismountpoint()
639 param->ismountpoint.out.magic = magic; in autofs_dev_ioctl_ismountpoint()
650 #define cmd_idx(cmd) (cmd - _IOC_NR(AUTOFS_DEV_IOCTL_IOC_FIRST))
693 cmd - cmd_first > AUTOFS_DEV_IOCTL_IOC_COUNT) { in _autofs_dev_ioctl()
694 return -ENOTTY; in _autofs_dev_ioctl()
703 return -EPERM; in _autofs_dev_ioctl()
717 err = -ENOTTY; in _autofs_dev_ioctl()
735 fp = fget(param->ioctlfd); in _autofs_dev_ioctl()
739 err = -EBADF; in _autofs_dev_ioctl()
743 sb = file_inode(fp)->i_sb; in _autofs_dev_ioctl()
744 if (sb->s_type != &autofs_fs_type) { in _autofs_dev_ioctl()
745 err = -EINVAL; in _autofs_dev_ioctl()
752 * Admin needs to be able to set the mount catatonic in in _autofs_dev_ioctl()
753 * order to be able to perform the re-open. in _autofs_dev_ioctl()
757 err = -EACCES; in _autofs_dev_ioctl()
768 err = -EFAULT; in _autofs_dev_ioctl()