Skip to content

Commit d1a265d

Browse files
Shan Haigregkh
authored andcommitted
bcache: release dc->writeback_lock properly in bch_writeback_thread()
commit 3943b04 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c8d875b commit d1a265d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/md/bcache/writeback.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,10 @@ static int bch_writeback_thread(void *arg)
456456
* data on cache. BCACHE_DEV_DETACHING flag is set in
457457
* bch_cached_dev_detach().
458458
*/
459-
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
459+
if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) {
460+
up_write(&dc->writeback_lock);
460461
break;
462+
}
461463
}
462464

463465
up_write(&dc->writeback_lock);

0 commit comments

Comments
 (0)