summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-17 18:20:26 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:41 -0400
commiteff508b459fb90682c7a5c4e6d2de0b1d18217e4 (patch)
tree2abf7b1ce47b17911d9f5f31aa6f0780bcabd02c /fs/bcachefs
parenta34782a0663cc3a5d8c4e4657480fa0e6ddc8a16 (diff)
bcachefs: Add a kthread_should_stop() check to allocator thread
Turns out it's possible during shutdown for the allocator to get stuck spinning on bch2_invalidate_buckets() without hitting any of the other checks. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/alloc_background.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 93ee5cdfbe35..98dd4995e528 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1104,6 +1104,8 @@ static int bch2_allocator_thread(void *arg)
while (1) {
cond_resched();
+ if (kthread_should_stop())
+ break;
pr_debug("discarding %zu invalidated buckets",
fifo_used(&ca->free_inc));