bcachefs: Prevent journal reclaim from spinning
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 6 Dec 2020 21:29:13 +0000 (16:29 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:49 +0000 (17:08 -0400)
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 <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal_reclaim.c

index 5ab147e94167cb891370673b58148053d97fd1b7..e8fd11abe4c3a535b7bb73ca3bbe7bdd55ee2f85 100644 (file)
@@ -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);