summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-05-31 20:52:39 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:05 -0400
commit01254036a326e0663eaeabb2eb3359c04caed2a0 (patch)
tree7ab109a490a86e427be5539e89c3c2487a025c9f
parentd7fc453bdb012d5bc021e693896989fd5973823f (diff)
bcachefs; Check for allocator thread shutdown
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>
-rw-r--r--fs/bcachefs/alloc_background.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 791066b6b39b..b6bfba7aea0a 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -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));