From 3b78db59d05dd5393e276aa69af9e7fb00bffd53 Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Tue, 31 Aug 2021 20:48:51 +0800 Subject: [PATCH 1/2] fstab-generator: also order noauto or automount mount units before "post" target units The ordering should not prevent noauto or automount from working as expected, and we do not want them to be stopped too early if they are active. --- src/fstab-generator/fstab-generator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 8a4340c5ba..fd7fc30da3 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -434,8 +434,7 @@ static int add_mount( /* Order the mount unit we generate relative to the post unit, so that DefaultDependencies= on the * target unit won't affect us. */ - if (post && !FLAGS_SET(flags, MOUNT_AUTOMOUNT) && !FLAGS_SET(flags, MOUNT_NOAUTO) && - !FLAGS_SET(flags, MOUNT_NOFAIL)) + if (post && !FLAGS_SET(flags, MOUNT_NOFAIL)) fprintf(f, "Before=%s\n", post); if (passno != 0) { From 195baa1bd82e2d0b3fe460d68404f09ec8d9de4b Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Tue, 31 Aug 2021 21:46:04 +0800 Subject: [PATCH 2/2] core/mount: also add default before dependency for automount mount units The dependency should not prevent automount from working as expected, and we do not want them to be stopped too early if they are active. --- src/core/mount.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index 35b56426d4..23ffabd60d 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -84,14 +84,6 @@ static MountParameters* get_mount_parameters(Mount *m) { return get_mount_parameters_fragment(m); } -static bool mount_is_automount(const MountParameters *p) { - assert(p); - - return fstab_test_option(p->options, - "comment=systemd.automount\0" - "x-systemd.automount\0"); -} - static bool mount_is_network(const MountParameters *p) { assert(p); @@ -484,7 +476,7 @@ static int mount_add_default_ordering_dependencies( before = SPECIAL_LOCAL_FS_TARGET; } - if (!mount_is_nofail(m) && !mount_is_automount(p)) { + if (!mount_is_nofail(m)) { r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, before, true, mask); if (r < 0) return r;