From: Brian Foster <bfoster@redhat.com>
To: linux-bcachefs@vger.kernel.org
Subject: [PATCH 4/5] bcachefs: drop unnecessary journal stuck check from space calculation
Date: Tue, 21 Mar 2023 09:20:13 -0400 [thread overview]
Message-ID: <20230321132014.1438249-5-bfoster@redhat.com> (raw)
In-Reply-To: <20230321132014.1438249-1-bfoster@redhat.com>
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>
---
fs/bcachefs/journal_reclaim.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index 8c88884c74a5..37c6846a30aa 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -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 <
--
2.39.2
next prev parent reply other threads:[~2023-03-21 13:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 13:20 [PATCH 0/5] bcachefs: journal stall fixes Brian Foster
2023-03-21 13:20 ` [PATCH 1/5] bcachefs: more aggressive fast path write buffer key flushing Brian Foster
2023-03-21 13:40 ` Brian Foster
2023-03-21 13:20 ` [PATCH 2/5] bcachefs: gracefully unwind journal res slowpath on shutdown Brian Foster
2023-03-21 13:20 ` [PATCH 3/5] bcachefs: refactor journal stuck checking into standalone helper Brian Foster
2023-03-21 13:20 ` Brian Foster [this message]
2023-03-21 13:20 ` [PATCH 5/5] RFC: bcachefs: use a timeout for the journal stuck condition Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230321132014.1438249-5-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox