Skip to content

Commit 13d4c99

Browse files
Shan Haijfvogel
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]> (cherry picked from commit 3943b04) Orabug: 28335202 Signed-off-by: Shan Hai <[email protected]> Reviewed-by: Darren Kenny <[email protected]>
1 parent 0e26a01 commit 13d4c99

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
@@ -455,8 +455,10 @@ static int bch_writeback_thread(void *arg)
455455
* data on cache. BCACHE_DEV_DETACHING flag is set in
456456
* bch_cached_dev_detach().
457457
*/
458-
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
458+
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) {
459+
up_write(&dc->writeback_lock);
459460
break;
461+
}
460462
}
461463

462464
up_write(&dc->writeback_lock);

0 commit comments

Comments
 (0)