summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-05-21 13:31:44 +0000
committertrasz <trasz@FreeBSD.org>2015-05-21 13:31:44 +0000
commitbb27657bec9c8de9f1e63f184a840436596e4ea2 (patch)
tree139bec3a21e030aef9df5a681433509a11454d1d
parent0895f35cb3f72fc68b820d06ed33b2f22bb44981 (diff)
downloadFreeBSD-src-bb27657bec9c8de9f1e63f184a840436596e4ea2.zip
FreeBSD-src-bb27657bec9c8de9f1e63f184a840436596e4ea2.tar.gz
MFC r279846:
Properly pass options for direct maps. Sponsored by: The FreeBSD Foundation
-rw-r--r--usr.sbin/autofs/automount.c17
-rw-r--r--usr.sbin/autofs/automountd.c28
2 files changed, 18 insertions, 27 deletions
diff --git a/usr.sbin/autofs/automount.c b/usr.sbin/autofs/automount.c
index 0c42ffd..8a7c91a 100644
--- a/usr.sbin/autofs/automount.c
+++ b/usr.sbin/autofs/automount.c
@@ -141,8 +141,8 @@ mount_autofs(const char *from, const char *fspath, const char *options,
}
static void
-mount_if_not_already(const struct node *n, const char *map,
- const struct statfs *mntbuf, int nitems)
+mount_if_not_already(const struct node *n, const char *map, const char *options,
+ const char *prefix, const struct statfs *mntbuf, int nitems)
{
const struct statfs *sb;
char *mountpoint;
@@ -175,7 +175,7 @@ mount_if_not_already(const struct node *n, const char *map,
mountpoint);
}
- mount_autofs(from, mountpoint, n->n_options, n->n_key);
+ mount_autofs(from, mountpoint, options, prefix);
free(from);
free(mountpoint);
}
@@ -184,7 +184,7 @@ static void
mount_unmount(struct node *root)
{
struct statfs *mntbuf;
- struct node *n, *n2, *n3;
+ struct node *n, *n2;
int i, nitems;
nitems = getmntinfo(&mntbuf, MNT_WAIT);
@@ -216,15 +216,14 @@ mount_unmount(struct node *root)
TAILQ_FOREACH(n, &root->n_children, n_next) {
if (!node_is_direct_map(n)) {
- mount_if_not_already(n, n->n_map, mntbuf, nitems);
+ mount_if_not_already(n, n->n_map, n->n_options,
+ n->n_key, mntbuf, nitems);
continue;
}
TAILQ_FOREACH(n2, &n->n_children, n_next) {
- TAILQ_FOREACH(n3, &n2->n_children, n_next) {
- mount_if_not_already(n3, n->n_map,
- mntbuf, nitems);
- }
+ mount_if_not_already(n2, n->n_map, n->n_options,
+ "/", mntbuf, nitems);
}
}
}
diff --git a/usr.sbin/autofs/automountd.c b/usr.sbin/autofs/automountd.c
index 75c6a44..168e8b3 100644
--- a/usr.sbin/autofs/automountd.c
+++ b/usr.sbin/autofs/automountd.c
@@ -202,7 +202,7 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
parent = root;
} else {
parent = node_new_map(root, checked_strdup(adr->adr_prefix),
- checked_strdup(adr->adr_options), checked_strdup(map),
+ NULL, checked_strdup(map),
checked_strdup("[kernel request]"), lineno);
}
@@ -231,19 +231,19 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
"failing mount", map, adr->adr_path);
}
+ options = node_options(node);
+ options = concat(adr->adr_options, ',', options);
+
+ /*
+ * Prepend options passed via automountd(8) command line.
+ */
+ if (cmdline_options != NULL)
+ options = concat(cmdline_options, ',', options);
+
if (node->n_location == NULL) {
log_debugx("found node defined at %s:%d; not a mountpoint",
node->n_config_file, node->n_config_line);
- options = node_options(node);
-
- /*
- * Prepend options passed via automountd(8) command line.
- */
- if (cmdline_options != NULL) {
- options = concat(cmdline_options, ',', options);
- }
-
nobrowse = pick_option("nobrowse", &options);
if (nobrowse != NULL && adr->adr_key[0] == '\0') {
log_debugx("skipping map %s due to \"nobrowse\" "
@@ -293,14 +293,6 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
"failing mount", adr->adr_path);
}
- options = node_options(node);
-
- /*
- * Prepend options passed via automountd(8) command line.
- */
- if (cmdline_options != NULL)
- options = concat(cmdline_options, ',', options);
-
/*
* Append "automounted".
*/
OpenPOWER on IntegriCloud