Commit 5731cf01 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix journal reclaim spinning in recovery

We can't run journal reclaim until we've finished replaying updates to
interior btree nodes - the check for this was in the wrong place though,
leading to journal reclaim spinning before it was allowed to proceed.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 89931472
...@@ -609,6 +609,10 @@ static int bch2_journal_reclaim_thread(void *arg) ...@@ -609,6 +609,10 @@ static int bch2_journal_reclaim_thread(void *arg)
struct journal *j = arg; struct journal *j = arg;
unsigned long next; unsigned long next;
set_freezable();
kthread_wait_freezable(test_bit(JOURNAL_RECLAIM_STARTED, &j->flags));
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
j->reclaim_kicked = false; j->reclaim_kicked = false;
...@@ -627,6 +631,7 @@ static int bch2_journal_reclaim_thread(void *arg) ...@@ -627,6 +631,7 @@ static int bch2_journal_reclaim_thread(void *arg)
if (time_after_eq(jiffies, next)) if (time_after_eq(jiffies, next))
break; break;
schedule_timeout(next - jiffies); schedule_timeout(next - jiffies);
try_to_freeze();
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
......
...@@ -616,6 +616,7 @@ static int bch2_journal_replay(struct bch_fs *c, ...@@ -616,6 +616,7 @@ static int bch2_journal_replay(struct bch_fs *c,
*/ */
set_bit(BCH_FS_BTREE_INTERIOR_REPLAY_DONE, &c->flags); set_bit(BCH_FS_BTREE_INTERIOR_REPLAY_DONE, &c->flags);
set_bit(JOURNAL_RECLAIM_STARTED, &j->flags); set_bit(JOURNAL_RECLAIM_STARTED, &j->flags);
journal_reclaim_kick(j);
j->replay_journal_seq = seq; j->replay_journal_seq = seq;
......
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