Skip to content

Commit a7e2dd5

Browse files
author
Kent Overstreet
committed
bcachefs: Check if stuck in journal_res_get()
Like how we already do when the allocator seems to be stuck, check if we're waiting too long for a journal reservation and print some debug info. This is specifically to track down koverstreet/bcachefs#656 which is showing up in userspace where we don't have sysfs/debugfs to get the journal debug info. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 04b670d commit a7e2dd5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/bcachefs/journal.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,19 @@ int bch2_journal_res_get_slowpath(struct journal *j, struct journal_res *res,
603603
{
604604
int ret;
605605

606+
if (closure_wait_event_timeout(&j->async_wait,
607+
(ret = __journal_res_get(j, res, flags)) != -BCH_ERR_journal_res_get_blocked ||
608+
(flags & JOURNAL_RES_GET_NONBLOCK),
609+
HZ * 10))
610+
return ret;
611+
612+
struct bch_fs *c = container_of(j, struct bch_fs, journal);
613+
struct printbuf buf = PRINTBUF;
614+
bch2_journal_debug_to_text(&buf, j);
615+
bch_err(c, "Journal stuck? Waited for 10 seconds...\n%s",
616+
buf.buf);
617+
printbuf_exit(&buf);
618+
606619
closure_wait_event(&j->async_wait,
607620
(ret = __journal_res_get(j, res, flags)) != -BCH_ERR_journal_res_get_blocked ||
608621
(flags & JOURNAL_RES_GET_NONBLOCK));

0 commit comments

Comments
 (0)