From b18df768ebf71196c3620d1e5f23f064c1ba1485 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 6 Dec 2020 16:29:13 -0500 Subject: [PATCH] bcachefs: Prevent journal reclaim from spinning Without checking if we actually flushed anything, journal reclaim could still go into an infinite loop while trying ot shut down. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/journal_reclaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 5ab147e94167..e8fd11abe4c3 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -610,7 +610,7 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct) else j->nr_background_reclaim += nr_flushed; trace_journal_reclaim_finish(c, nr_flushed); - } while (min_nr); + } while (min_nr && nr_flushed); memalloc_noreclaim_restore(flags);