aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch b/meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch
new file mode 100644
index 0000000000..440e96ab46
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0027-mount-use-get_mount_parameters_fragment-consistently.patch
@@ -0,0 +1,114 @@
+From 7f38735fa33f37ebe547b8849c1e5be8a1182693 Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Wed, 9 Dec 2015 16:02:10 +0100
+Subject: [PATCH] mount: use get_mount_parameters_fragment() consistently
+
+There are multiple different checks, that all mean the same thing:
+Is it a explicitly configured mount unit where actions need to be taken to
+mount it, or is is just mirroring 'mountinfo':
+'from_fragment' to set if fragment_path is not NULL, and
+get_mount_parameters_fragment() just wraps that and returns fragment_path.
+
+Use get_mount_parameters_fragment() everywhere to be consistent.
+This is just a cleanup without functional change.
+
+(cherry picked from commit b294b79fb0f9749afa53624c8f06b145ea2c1525)
+---
+ src/core/mount.c | 34 ++++++++++++++++------------------
+ 1 file changed, 16 insertions(+), 18 deletions(-)
+
+diff --git a/src/core/mount.c b/src/core/mount.c
+index 665a60b..7b20892 100644
+--- a/src/core/mount.c
++++ b/src/core/mount.c
+@@ -482,6 +482,7 @@ static int mount_add_default_dependencies(Mount *m) {
+
+ static int mount_verify(Mount *m) {
+ _cleanup_free_ char *e = NULL;
++ MountParameters *p;
+ int r;
+
+ assert(m);
+@@ -506,7 +507,8 @@ static int mount_verify(Mount *m) {
+ return -EINVAL;
+ }
+
+- if (UNIT(m)->fragment_path && !m->parameters_fragment.what) {
++ p = get_mount_parameters_fragment(m);
++ if (p && !p->what) {
+ log_unit_error(UNIT(m), "What= setting is missing. Refusing.");
+ return -EBADMSG;
+ }
+@@ -850,11 +852,6 @@ fail:
+ mount_enter_mounted(m, MOUNT_FAILURE_RESOURCES);
+ }
+
+-static int mount_get_opts(Mount *m, char **ret) {
+- return fstab_filter_options(m->parameters_fragment.options,
+- "nofail\0" "noauto\0" "auto\0", NULL, NULL, ret);
+-}
+-
+ static void mount_enter_mounting(Mount *m) {
+ int r;
+ MountParameters *p;
+@@ -877,19 +874,18 @@ static void mount_enter_mounting(Mount *m) {
+ if (p && mount_is_bind(p))
+ (void) mkdir_p_label(p->what, m->directory_mode);
+
+- if (m->from_fragment) {
++ if (p) {
+ _cleanup_free_ char *opts = NULL;
+
+- r = mount_get_opts(m, &opts);
++ r = fstab_filter_options(p->options, "nofail\0" "noauto\0" "auto\0", NULL, NULL, &opts);
+ if (r < 0)
+ goto fail;
+
+- r = exec_command_set(m->control_command, MOUNT_PATH,
+- m->parameters_fragment.what, m->where, NULL);
++ r = exec_command_set(m->control_command, MOUNT_PATH, p->what, m->where, NULL);
+ if (r >= 0 && m->sloppy_options)
+ r = exec_command_append(m->control_command, "-s", NULL);
+- if (r >= 0 && m->parameters_fragment.fstype)
+- r = exec_command_append(m->control_command, "-t", m->parameters_fragment.fstype, NULL);
++ if (r >= 0 && p->fstype)
++ r = exec_command_append(m->control_command, "-t", p->fstype, NULL);
+ if (r >= 0 && !isempty(opts))
+ r = exec_command_append(m->control_command, "-o", opts, NULL);
+ } else
+@@ -915,27 +911,29 @@ fail:
+
+ static void mount_enter_remounting(Mount *m) {
+ int r;
++ MountParameters *p;
+
+ assert(m);
+
+ m->control_command_id = MOUNT_EXEC_REMOUNT;
+ m->control_command = m->exec_command + MOUNT_EXEC_REMOUNT;
+
+- if (m->from_fragment) {
++ p = get_mount_parameters_fragment(m);
++ if (p) {
+ const char *o;
+
+- if (m->parameters_fragment.options)
+- o = strjoina("remount,", m->parameters_fragment.options);
++ if (p->options)
++ o = strjoina("remount,", p->options);
+ else
+ o = "remount";
+
+ r = exec_command_set(m->control_command, MOUNT_PATH,
+- m->parameters_fragment.what, m->where,
++ p->what, m->where,
+ "-o", o, NULL);
+ if (r >= 0 && m->sloppy_options)
+ r = exec_command_append(m->control_command, "-s", NULL);
+- if (r >= 0 && m->parameters_fragment.fstype)
+- r = exec_command_append(m->control_command, "-t", m->parameters_fragment.fstype, NULL);
++ if (r >= 0 && p->fstype)
++ r = exec_command_append(m->control_command, "-t", p->fstype, NULL);
+ } else
+ r = -ENOENT;
+