From: Kent Overstreet Date: Sun, 29 Nov 2020 22:09:13 +0000 (-0500) Subject: bcachefs: Fix journal reclaim spinning in recovery X-Git-Tag: v6.7-rc1~201^2~1899 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5731cf01567da4f354bbff4a040b53f3f86328ad;p=thirdparty%2Fkernel%2Flinux.git 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: Kent Overstreet Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 9f0d2e6aa4e30..c20f6de347305 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -609,6 +609,10 @@ static int bch2_journal_reclaim_thread(void *arg) struct journal *j = arg; unsigned long next; + set_freezable(); + + kthread_wait_freezable(test_bit(JOURNAL_RECLAIM_STARTED, &j->flags)); + while (!kthread_should_stop()) { j->reclaim_kicked = false; @@ -627,6 +631,7 @@ static int bch2_journal_reclaim_thread(void *arg) if (time_after_eq(jiffies, next)) break; schedule_timeout(next - jiffies); + try_to_freeze(); } __set_current_state(TASK_RUNNING); diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 6750063663b5f..0b3521c9cc19e 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.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(JOURNAL_RECLAIM_STARTED, &j->flags); + journal_reclaim_kick(j); j->replay_journal_seq = seq;