]> www.infradead.org Git - linux.git/commitdiff
bcachefs: make sure to release last journal pin in replay
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 16 Apr 2024 03:53:12 +0000 (23:53 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 16 Apr 2024 23:14:01 +0000 (19:14 -0400)
This fixes a deadlock when journal replay has many keys to insert that
were from fsck, not the journal.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/recovery.c

index 0f328aba9760ba0e89fd015ee757239b6d8bd8c4..be5b47619327001ac8191c026575f6ac18d74d16 100644 (file)
@@ -249,7 +249,10 @@ int bch2_journal_replay(struct bch_fs *c)
 
                struct journal_key *k = *kp;
 
-               replay_now_at(j, k->journal_seq);
+               if (k->journal_seq)
+                       replay_now_at(j, k->journal_seq);
+               else
+                       replay_now_at(j, j->replay_journal_seq_end);
 
                ret = commit_do(trans, NULL, NULL,
                                BCH_TRANS_COMMIT_no_enospc|