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 <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2020-11-30 02:07:38 -05:00 committed by Kent Overstreet
parent d0022290b8
commit d7b04163c2

View File

@ -368,10 +368,11 @@ static int btree_key_cache_flush_pos(struct btree_trans *trans,
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);