X Tutup
Skip to content

Commit 457d659

Browse files
committed
mount: mount unit activated by automount unit should be only ordered against the automount unit
Both fstab-generator and pid1 are duplicating the handling of "Before=local-fs.target" dependency for mount units. fstab-generator is correctly skipping this dep if the mount unit is activated by an automount unit. However the condition used by pid1 was incorrect and missed the case when a mount unit uses "x-systemd.automount" since in this case the mount unit should be (only) ordered against its automount unit counterpart instead.
1 parent ad8f1b0 commit 457d659

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/core/mount.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ static bool MOUNT_STATE_WITH_PROCESS(MountState state) {
6666
MOUNT_CLEANING);
6767
}
6868

69+
static bool mount_is_automount(const MountParameters *p) {
70+
assert(p);
71+
72+
return fstab_test_option(p->options,
73+
"comment=systemd.automount\0"
74+
"x-systemd.automount\0");
75+
}
76+
6977
static bool mount_is_network(const MountParameters *p) {
7078
assert(p);
7179

@@ -473,7 +481,7 @@ static int mount_add_default_dependencies(Mount *m) {
473481
before = SPECIAL_LOCAL_FS_TARGET;
474482
}
475483

476-
if (!nofail) {
484+
if (!nofail && !mount_is_automount(p)) {
477485
r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, before, true, mask);
478486
if (r < 0)
479487
return r;

0 commit comments

Comments
 (0)
X Tutup