Whamcloud - gitweb
Add allow_cancellation config option
authorTheodore Ts'o <tytso@mit.edu>
Sat, 31 Dec 2005 05:52:23 +0000 (00:52 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 31 Dec 2005 05:52:23 +0000 (00:52 -0500)
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>
e2fsck/ChangeLog
e2fsck/unix.c

index 9b9b8be..951ff73 100644 (file)
@@ -1,3 +1,13 @@
+2005-12-31  Theodore Ts'o  <tytso@mit.edu>
+
+       * unix.c (main): 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)
+
 2005-12-30  Theodore Ts'o  <tytso@mit.edu>
 
        * e2fsck.c (e2fsck_free_context), unix.c (PRS), e2fsck.h: Use
index 024e434..bb19727 100644 (file)
@@ -1147,15 +1147,26 @@ restart:
                        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)) {