APPLIED: [SRU][E][PATCH v2 0/1] bcache: fix hung task timeout in bch_bucket_alloc()

Seth Forshee seth.forshee at canonical.com
Fri Aug 9 12:03:23 UTC 2019


On Wed, Aug 07, 2019 at 02:58:46PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1784665
> 
> [Impact]
> 
> bcache_allocator can call the following:
> 
>  bch_allocator_thread()
>   -> bch_prio_write()
>      -> bch_bucket_alloc()
>         -> wait on &ca->set->bucket_wait
> 
> But the wake up event on bucket_wait is supposed to come from
> bch_allocator_thread() itself causing a deadlock.
> 
> [Test Case]
> 
> This is a simple script that can easily trigger the deadlock condition:
> https://launchpadlibrarian.net/381282009/bcache-basic-repro.sh
> 
> A better test case has been also provided in LP: #1796292:
> https://bugs.launchpad.net/curtin/+bug/1796292/+attachment/5280353/+files/curtin-nvme.sh
> 
> [Fix]
> 
> Fix by making the call to bch_prio_write() non-blocking, so that
> bch_allocator_thread() never waits on itself. Moreover, make sure to
> wake up the garbage collector thread when bch_prio_write() is failing to
> allocate buckets to increase the chance of freeing up more buckets.
> 
> [Regression Potential]
> 
> Even if this patch is not yet applied upstream (posted to the LKML), it
> seems to reliably fix/prevent the specific deadlock problem reported in
> this bug, so it should be considered safe to apply it as it is for now,
> to prevent potential hung task timeout conditions.
> 
> Changes in v2:
>  - fix potential buckets leak

Applied to eoan/master-next, thanks!



More information about the kernel-team mailing list