]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs; Check for allocator thread shutdown
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 1 Jun 2021 00:52:39 +0000 (20:52 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:05 +0000 (17:09 -0400)
We were missing a kthread_should_stop() check in the loop in
bch2_invalidate_buckets(), very occasionally leading to us getting stuck
while shutting down.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/alloc_background.c

index 791066b6b39b4b43735eb2bfad311017e791aa8e..b6bfba7aea0ab23b114cccb406098ca6e3356a2e 100644 (file)
@@ -836,6 +836,11 @@ static int bch2_invalidate_buckets(struct bch_fs *c, struct bch_dev *ca)
        while (!ret &&
               !fifo_full(&ca->free_inc) &&
               ca->alloc_heap.used) {
+               if (kthread_should_stop()) {
+                       ret = 1;
+                       break;
+               }
+
                ret = bch2_invalidate_one_bucket(c, ca, &journal_seq,
                                (!fifo_empty(&ca->free_inc)
                                 ? BTREE_INSERT_NOWAIT : 0));