Skip to content

Commit 77ad1df

Browse files
author
Kent Overstreet
committed
bcachefs: Fix "journal stuck" during recovery
If we crash when the journal pin fifo is completely full - i.e. we're at the maximum number of dirty journal entries - that may put us in a sticky situation in recovery, as journal replay will need to be able to open new journal entries in order to get going. bch2_fs_journal_start() already had provisions for resizing the journal pin fifo if needed, but it needs a fudge factor to ensure there's room for journal replay. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 2581f89 commit 77ad1df

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/bcachefs/journal.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,14 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
14041404

14051405
nr = cur_seq - last_seq;
14061406

1407+
/*
1408+
* Extra fudge factor, in case we crashed when the journal pin fifo was
1409+
* nearly or completely full. We'll need to be able to open additional
1410+
* journal entries (at least a few) in order for journal replay to get
1411+
* going:
1412+
*/
1413+
nr += nr / 4;
1414+
14071415
if (nr + 1 > j->pin.size) {
14081416
free_fifo(&j->pin);
14091417
init_fifo(&j->pin, roundup_pow_of_two(nr + 1), GFP_KERNEL);

0 commit comments

Comments
 (0)