summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-07-07 20:06:18 +0200
committerGitHub <noreply@github.com>2020-07-07 20:06:18 +0200
commit2e2f6a01a008156ed457040c4757fa541be4a055 (patch)
treef59452b2ff81567c687a53f2b38548fbbb5763d1 /src
parent5dc60faae58b9e0b7b916888ad88656d269cf9d0 (diff)
parent6371e69b498ee40204f6f7a75951b7eb04746873 (diff)
downloadsystemd-2e2f6a01a008156ed457040c4757fa541be4a055.tar.gz
Merge pull request #16143 from fbuihuu/fstab-generator-fix
fstab-generator: make sure explicit deps configured via mount options apply to .mount, not .automount unit
Diffstat (limited to 'src')
-rw-r--r--src/fstab-generator/fstab-generator.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 77b90e1a9b..91581aed30 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -314,6 +314,29 @@ static int write_requires_mounts_for(FILE *f, const char *opts) {
return 0;
}
+static int write_extra_dependencies(FILE *f, const char *opts) {
+ int r;
+
+ assert(f);
+
+ if (opts) {
+ r = write_after(f, opts);
+ if (r < 0)
+ return r;
+ r = write_requires_after(f, opts);
+ if (r < 0)
+ return r;
+ r = write_before(f, opts);
+ if (r < 0)
+ return r;
+ r = write_requires_mounts_for(f, opts);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static int add_mount(
const char *dest,
const char *what,
@@ -406,20 +429,9 @@ static int add_mount(
SET_FLAG(flags, NOFAIL, true);
}
- if (!(flags & AUTOMOUNT) && opts) {
- r = write_after(f, opts);
- if (r < 0)
- return r;
- r = write_requires_after(f, opts);
- if (r < 0)
- return r;
- r = write_before(f, opts);
- if (r < 0)
- return r;
- r = write_requires_mounts_for(f, opts);
- if (r < 0)
- return r;
- }
+ r = write_extra_dependencies(f, opts);
+ if (r < 0)
+ return r;
if (passno != 0) {
r = generator_write_fsck_deps(f, dest, what, where, fstype);
@@ -530,21 +542,6 @@ static int add_mount(
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
source);
- if (opts) {
- r = write_after(f, opts);
- if (r < 0)
- return r;
- r = write_requires_after(f, opts);
- if (r < 0)
- return r;
- r = write_before(f, opts);
- if (r < 0)
- return r;
- r = write_requires_mounts_for(f, opts);
- if (r < 0)
- return r;
- }
-
fprintf(f,
"\n"
"[Automount]\n"