summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/journal_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-02-24 07:16:49 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:54 +0200
commit8567415457b25b467933e47ff78dca55a55f7206 (patch)
tree4be6df636bcff05478a339bc611786ef92a714da /fs/bcachefs/journal_io.c
parentbcachefs: Fix a 64 bit divide on 32 bit (diff)
downloadlinux-8567415457b25b467933e47ff78dca55a55f7206.tar.xz
linux-8567415457b25b467933e47ff78dca55a55f7206.zip
bcachefs: Dump journal state when we get stuck
We had a bug reported where the journal is failing to allocate a journal write - this should help figure out what's going on. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/journal_io.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 40d452cedffd..fdd5a837902c 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1383,6 +1383,7 @@ void bch2_journal_write(struct closure *cl)
struct jset_entry *start, *end;
struct jset *jset;
struct bio *bio;
+ char *journal_debug_buf = NULL;
bool validate_before_checksum = false;
unsigned i, sectors, bytes, u64s, nr_rw_members = 0;
int ret;
@@ -1484,6 +1485,12 @@ retry_alloc:
goto retry_alloc;
}
+ if (ret) {
+ journal_debug_buf = kmalloc(4096, GFP_ATOMIC);
+ if (journal_debug_buf)
+ __bch2_journal_debug_to_text(&_PBUF(journal_debug_buf, 4096), j);
+ }
+
/*
* write is allocated, no longer need to account for it in
* bch2_journal_space_available():
@@ -1498,7 +1505,9 @@ retry_alloc:
spin_unlock(&j->lock);
if (ret) {
- bch_err(c, "Unable to allocate journal write");
+ bch_err(c, "Unable to allocate journal write:\n%s",
+ journal_debug_buf);
+ kfree(journal_debug_buf);
bch2_fatal_error(c);
continue_at(cl, journal_write_done, system_highpri_wq);
return;