From: Kent Overstreet Date: Wed, 17 Jun 2020 22:20:26 +0000 (-0400) Subject: bcachefs: Add a kthread_should_stop() check to allocator thread X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=eff508b459fb90682c7a5c4e6d2de0b1d18217e4;p=linux.git 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 Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index 93ee5cdfbe354..98dd4995e528a 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));