// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved * Copyright 2005-2006 Ian Kent <raven@themaw.net>
*/
/* * In the event of a failure in get_sb_nodev the superblock * info is not present so nothing else has been setup, so * just call kill_anon_super when we are called from * deactivate_super.
*/ if (sbi) { /* Free wait queues, close pipe */
autofs_catatonic_mode(sbi);
put_pid(sbi->oz_pgrp);
}
pr_debug("shutting down\n");
kill_litter_super(sb); if (sbi)
kfree_rcu(sbi, rcu);
}
/* * Open the fd. We do it here rather than in get_tree so that it's done in the * context of the system call that passed the data and not the one that * triggered the superblock creation, lest the fd gets reassigned.
*/ staticint autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi, struct fs_parameter *param, struct fs_parse_result *result)
{ struct file *pipe; int ret;
if (param->type == fs_value_is_file) { /* came through the new api */
pipe = param->file;
param->file = NULL;
} else {
pipe = fget(result->uint_32);
} if (!pipe) {
errorf(fc, "could not open pipe file descriptor"); return -EBADF;
}
ret = autofs_check_pipe(pipe); if (ret < 0) {
errorf(fc, "Invalid/unusable pipe");
fput(pipe); return -EBADF;
}
/* Test versions first */ if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
errorf(fc, "kernel does not match daemon version " "daemon (%d, %d) kernel (%d, %d)\n",
sbi->min_proto, sbi->max_proto,
AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); return -EINVAL;
}
/* Establish highest kernel protocol version */ if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
sbi->version = AUTOFS_MAX_PROTO_VERSION; else
sbi->version = sbi->max_proto;
switch (sbi->version) { case 4:
sbi->sub_version = 7; break; case 5:
sbi->sub_version = AUTOFS_PROTO_SUBVERSION; break; default:
sbi->sub_version = 0;
}
if (ctx->pgrp_set) {
sbi->oz_pgrp = find_get_pid(ctx->pgrp); if (!sbi->oz_pgrp) return invalf(fc, "Could not find process group %d",
ctx->pgrp);
} else
sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID);
if (autofs_type_trigger(sbi->type)) /* s->s_root won't be contended so there's little to * be gained by not taking the d_lock when setting * d_flags, even when a lot mounts are being done.
*/
managed_dentry_set_managed(s->s_root);
/* * Validate the parameters and then request a superblock.
*/ staticint autofs_get_tree(struct fs_context *fc)
{ struct autofs_sb_info *sbi = fc->s_fs_info; int ret;
ret = autofs_validate_protocol(fc); if (ret) return ret;
if (sbi->pipefd < 0) return invalf(fc, "No control pipe specified");
/* * Set up the filesystem mount context.
*/ int autofs_init_fs_context(struct fs_context *fc)
{ struct autofs_fs_context *ctx; struct autofs_sb_info *sbi;
ctx = kzalloc(sizeof(struct autofs_fs_context), GFP_KERNEL); if (!ctx) goto nomem;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.