]> git.dujemihanovic.xyz Git - linux.git/commitdiff
bcachefs: Make sure we print error that causes fsck to bail out
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 1 Oct 2024 20:26:02 +0000 (16:26 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 5 Oct 2024 00:25:31 +0000 (20:25 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/error.c

index aac1960321b770d19416deaf9ec44ff83ad3dd72..7a79f695ba2e749bbcb352864028c8ff9f51736f 100644 (file)
@@ -393,6 +393,14 @@ int __bch2_fsck_err(struct bch_fs *c,
             !(flags & FSCK_CAN_IGNORE)))
                ret = -BCH_ERR_fsck_errors_not_fixed;
 
+       bool exiting =
+               test_bit(BCH_FS_fsck_running, &c->flags) &&
+               (ret != -BCH_ERR_fsck_fix &&
+                ret != -BCH_ERR_fsck_ignore);
+
+       if (exiting)
+               print = true;
+
        if (print) {
                if (bch2_fs_stdio_redirect(c))
                        bch2_print(c, "%s\n", out->buf);
@@ -400,9 +408,7 @@ int __bch2_fsck_err(struct bch_fs *c,
                        bch2_print_string_as_lines(KERN_ERR, out->buf);
        }
 
-       if (test_bit(BCH_FS_fsck_running, &c->flags) &&
-           (ret != -BCH_ERR_fsck_fix &&
-            ret != -BCH_ERR_fsck_ignore))
+       if (exiting)
                bch_err(c, "Unable to continue, halting");
        else if (suppressing)
                bch_err(c, "Ratelimiting new instances of previous error");