bcachefs: Change a BUG_ON() to a fatal error
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 30 Nov 2020 07:07:38 +0000 (02:07 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:48 +0000 (17:08 -0400)
In the btree key cache code, failing to flush a dirty key is a serious
error, but it doesn't need to be a BUG_ON(), we can stop the filesystem
instead.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_key_cache.c

index ae3d5880f84eb03b76a88a4a260de734f43c04b3..ccb5f3cc71604110191a78db1b59377e64052e2d 100644 (file)
@@ -368,10 +368,11 @@ err:
        if (ret == -EINTR)
                goto retry;
 
-       BUG_ON(ret && !bch2_journal_error(j));
-
-       if (ret)
+       if (ret) {
+               bch2_fs_fatal_err_on(!bch2_journal_error(j), c,
+                       "error flushing key cache: %i", ret);
                goto out;
+       }
 
        bch2_journal_pin_drop(j, &ck->journal);
        bch2_journal_preres_put(j, &ck->res);