From bed3ff8ebcebd8944d82efea7f59d23da80d01dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 20 Mar 2025 10:33:56 +0100 Subject: [PATCH] generator: also suppress fsck early if we are adding a bind mount There's no point in "fscking a bind mount". Let's not do it hence. --- src/fstab-generator/fstab-generator.c | 2 +- src/gpt-auto-generator/gpt-auto-generator.c | 2 +- src/shared/generator.c | 8 +++++++- src/shared/generator.h | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 33c4c941f04..51df843f122 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -605,7 +605,7 @@ static int add_mount( fprintf(f, "After=%s\n", extra_after); if (passno != 0) { - r = generator_write_fsck_deps(f, dest, what, where, fstype); + r = generator_write_fsck_deps(f, dest, what, where, fstype, opts); if (r < 0) return r; } diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 54f674040be..167d15318f4 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -245,7 +245,7 @@ static int add_mount( if (post) fprintf(f, "Before=%s\n", post); - r = generator_write_fsck_deps(f, arg_dest, what, where, fstype); + r = generator_write_fsck_deps(f, arg_dest, what, where, fstype, opts_filtered); if (r < 0) return r; diff --git a/src/shared/generator.c b/src/shared/generator.c index 70fcd6e935d..d4af0272b72 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -270,7 +270,8 @@ int generator_write_fsck_deps( const char *dir, const char *what, const char *where, - const char *fstype) { + const char *fstype, + const char *options) { int r; @@ -298,6 +299,11 @@ int generator_write_fsck_deps( } } + if (fstab_test_option(options, "bind\0rbind\0")) { + log_debug("Skipping file system check for bind mount of '%s'.", what); + return 0; + } + if (!is_device_path(what)) { log_warning("Checking was requested for \"%s\", but it is not a device.", what); return 0; diff --git a/src/shared/generator.h b/src/shared/generator.h index 47cccd9c592..fd342a280c7 100644 --- a/src/shared/generator.h +++ b/src/shared/generator.h @@ -22,7 +22,8 @@ int generator_write_fsck_deps( const char *dir, const char *what, const char *where, - const char *type); + const char *type, + const char *options); int generator_write_device_timeout( const char *dir, -- 2.47.3