From fa138f5e26742f83a762b2809a1891978c6aa04a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 7 Apr 2021 11:12:39 +0200 Subject: [PATCH] fstab-generator: properly order generated mount units before "post" target units Let's make sure, that our mount unit are properly ordered before the "post" target unit even if DefaultDependencies= is used on the target unit. --- src/fstab-generator/fstab-generator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 8f5cd0af3ef..110a9bd1baf 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -433,6 +433,11 @@ static int add_mount( if (r < 0) return r; + /* 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, AUTOMOUNT) && !FLAGS_SET(flags, NOAUTO)) + fprintf(f, "Before=%s\n", post); + if (passno != 0) { r = generator_write_fsck_deps(f, dest, what, where, fstype); if (r < 0)