Commit c609947b authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix for getting stuck in journal replay

In journal replay, we weren't immediately dropping journal pins when we
start doing updates that ewern't from journal replay - leading to
journal reclaim getting stuck.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent e492e7b6
...@@ -556,7 +556,8 @@ static int journal_keys_sort(struct bch_fs *c) ...@@ -556,7 +556,8 @@ static int journal_keys_sort(struct bch_fs *c)
static void replay_now_at(struct journal *j, u64 seq) static void replay_now_at(struct journal *j, u64 seq)
{ {
BUG_ON(seq < j->replay_journal_seq); BUG_ON(seq < j->replay_journal_seq);
BUG_ON(seq > j->replay_journal_seq_end);
seq = min(seq, j->replay_journal_seq_end);
while (j->replay_journal_seq < seq) while (j->replay_journal_seq < seq)
bch2_journal_pin_put(j, j->replay_journal_seq++); bch2_journal_pin_put(j, j->replay_journal_seq++);
...@@ -629,8 +630,7 @@ static int bch2_journal_replay(struct bch_fs *c) ...@@ -629,8 +630,7 @@ static int bch2_journal_replay(struct bch_fs *c)
cond_resched(); cond_resched();
if (!k->allocated) replay_now_at(j, keys->journal_seq_base + k->journal_seq);
replay_now_at(j, keys->journal_seq_base + k->journal_seq);
ret = bch2_trans_do(c, NULL, NULL, ret = bch2_trans_do(c, NULL, NULL,
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment