bcache: release dc->writeback_lock properly in bch_writeback_thread()
Subsystems (3)
PATCH v2 1/1 bcache: release dc->writeback_lock properly in bch_writeback_thread()
From: Shan Hai <[email protected]>
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.
---
Changelog:
v2: add Fixes tag by Coly Li.
v1: initial patch from Shan Hai.
drivers/md/bcache/writeback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/writeback.c +3 -1
@@ -685,8 +685,10 @@ static int bch_writeback_thread(void *arg)* data on cache. BCACHE_DEV_DETACHING flag is set in * bch_cached_dev_detach(). */ -if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) +if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) { +up_write (&dc->writeback_lock);break ; + } }up_write (&dc->writeback_lock);
Signature · 1 line
2.18.0
Quoted 11 lines · Coly Li
From: Shan Hai <[email protected]>
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 fadd94e05c02 (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+
Quoted 4 lines
---
Changelog:
v2: add Fixes tag by Coly Li.
v1: initial patch from Shan Hai.
Hi Jens,
Please pick this patch for your next pull request. The change from Shan Hai fixes a real issue which is reported and lately verified by Shenghui Wang.
Thanks in advance.
Coly Li
Quoted 21 lines
drivers/md/bcache/writeback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/md/bcache/writeback.c +3
-1@@ -685,8 +685,10 @@ static int bch_writeback_thread(void *arg)* data on cache. BCACHE_DEV_DETACHING flag is set in * bch_cached_dev_detach(). */ -if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) +if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) { +up_write (&dc->writeback_lock);break ; + } }up_write (&dc->writeback_lock);
Jens Axboe
maintainerQuoted 17 lines · Coly Li
Quoted 11 lines · Coly Li
From: Shan Hai <[email protected]>
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 fadd94e05c02 (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+Quoted 4 lines
---
Changelog:
v2: add Fixes tag by Coly Li.
v1: initial patch from Shan Hai.
Quoted 5 lines
Hi Jens,
Please pick this patch for your next pull request. The change from Shan Hai fixes a real issue which is reported and lately verified by Shenghui Wang.
Applied - but I fixed up the commit message. Please keep lines at 72 characters for git commits.
Signature · 1 line
Jens Axboe