Skip to content

Commit 3943b04

Browse files
Shan Haiaxboe
Shan Hai
authored andcommitted
bcache: release dc->writeback_lock properly in bch_writeback_thread()
The writeback thread would exit with a lock held when the cache device is detached via sysfs interface, fix it by releasing the held lock before exiting the while-loop. Fixes: fadd94e (bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set) Signed-off-by: Shan Hai <[email protected]> Signed-off-by: Coly Li <[email protected]> Tested-by: Shenghui Wang <[email protected]> Cc: [email protected] #4.17+ Signed-off-by: Jens Axboe <[email protected]>
1 parent 5bed49a commit 3943b04

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/md/bcache/writeback.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,10 @@ static int bch_writeback_thread(void *arg)
685685
* data on cache. BCACHE_DEV_DETACHING flag is set in
686686
* bch_cached_dev_detach().
687687
*/
688-
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
688+
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) {
689+
up_write(&dc->writeback_lock);
689690
break;
691+
}
690692
}
691693

692694
up_write(&dc->writeback_lock);

0 commit comments

Comments
 (0)