mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 12:24:37 -04:00
bcachefs: drop unnecessary journal stuck check from space calculation
The journal stucking check in bch2_journal_space_available() is particularly aggressive and can lead to premature shutdown in some rare cases. This is difficult to reproduce, but also comes along with a fatal error and so is worthwhile to be cautious. For example, we've seen instances where the journal is under heavy reservation pressure, the journal allocation path transitions into the final available journal bucket, the journal write path immediately consumes that bucket and calls into bch2_journal_space_available(), which then in turn flags the journal as stuck because there is no available space and shuts down the filesystem instead of submitting the journal write (that would have otherwise succeeded). To avoid this problem, simplify the journal stuck checking by just relying on the higher level logic in the journal reservation path. This produces more useful debug output and is a more reliable indicator that things have bogged down. Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
committed by
Kent Overstreet
parent
db1bf72905
commit
030e9f9264
@@ -210,24 +210,7 @@ void bch2_journal_space_available(struct journal *j)
|
||||
clean = j->space[journal_space_clean].total;
|
||||
total = j->space[journal_space_total].total;
|
||||
|
||||
if (!clean_ondisk &&
|
||||
journal_cur_seq(j) == j->seq_ondisk) {
|
||||
struct printbuf buf = PRINTBUF;
|
||||
|
||||
__bch2_journal_debug_to_text(&buf, j);
|
||||
bch_err(c, "journal stuck\n%s", buf.buf);
|
||||
printbuf_exit(&buf);
|
||||
|
||||
/*
|
||||
* Hack: bch2_fatal_error() calls bch2_journal_halt() which
|
||||
* takes journal lock:
|
||||
*/
|
||||
spin_unlock(&j->lock);
|
||||
bch2_fatal_error(c);
|
||||
spin_lock(&j->lock);
|
||||
|
||||
ret = JOURNAL_ERR_journal_stuck;
|
||||
} else if (!j->space[journal_space_discarded].next_entry)
|
||||
if (!j->space[journal_space_discarded].next_entry)
|
||||
ret = JOURNAL_ERR_journal_full;
|
||||
|
||||
if ((j->space[journal_space_clean_ondisk].next_entry <
|
||||
|
||||
Reference in New Issue
Block a user