Add allow_cancellation config option
If the e2fsck configuration file sets the allow_cancellation option to be
true, then if the filesystem does not have any known problems, and was
known to be cleanly unmounted, then let e2fsck exit with a status code of 0
instead of 32 (FSCK_CANCELED) so that the bootup scripts will continue
without stopping the boot. (Addresses Debian Bug: #150295)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 024e434..bb19727 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1147,15 +1147,26 @@
exit_value |= FSCK_REBOOT;
}
}
- if (!ext2fs_test_valid(fs)) {
+ if (!ext2fs_test_valid(fs) ||
+ ((exit_value & FSCK_CANCELED) &&
+ (sb->s_state & EXT2_ERROR_FS))) {
printf(_("\n%s: ********** WARNING: Filesystem still has "
"errors **********\n\n"), ctx->device_name);
exit_value |= FSCK_UNCORRECTED;
exit_value &= ~FSCK_NONDESTRUCT;
}
- if (exit_value & FSCK_CANCELED)
+ if (exit_value & FSCK_CANCELED) {
+ int allow_cancellation;
+
+ profile_get_boolean(ctx->profile, "options",
+ "allow_cancellation", 0, 0,
+ &allow_cancellation);
exit_value &= ~FSCK_NONDESTRUCT;
- else {
+ if (allow_cancellation && ext2fs_test_valid(fs) &&
+ (sb->s_state & EXT2_VALID_FS) &&
+ !(sb->s_state & EXT2_ERROR_FS))
+ exit_value = 0;
+ } else {
show_stats(ctx);
if (!(ctx->options & E2F_OPT_READONLY)) {
if (ext2fs_test_valid(fs)) {