From: Kent Overstreet Date: Mon, 30 Nov 2020 07:07:38 +0000 (-0500) Subject: bcachefs: Change a BUG_ON() to a fatal error X-Git-Tag: v6.7-rc1~201^2~1897 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b04163c2e6fbfb3befc047586c4c85069e8db3;p=thirdparty%2Fkernel%2Fstable.git bcachefs: Change a BUG_ON() to a fatal error 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 Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c index ae3d5880f84eb..ccb5f3cc71604 100644 --- a/fs/bcachefs/btree_key_cache.c +++ b/fs/bcachefs/btree_key_cache.c @@ -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);