提交 3943b040 编写于 作者: S Shan Hai 提交者: Jens Axboe

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: fadd94e0 (bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set)
Signed-off-by: NShan Hai <shan.hai@oracle.com>
Signed-off-by: NColy Li <colyli@suse.de>
Tested-by: NShenghui Wang <shhuiw@foxmail.com>
Cc: stable@vger.kernel.org #4.17+
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 5bed49ad
...@@ -685,8 +685,10 @@ static int bch_writeback_thread(void *arg) ...@@ -685,8 +685,10 @@ static int bch_writeback_thread(void *arg)
* data on cache. BCACHE_DEV_DETACHING flag is set in * data on cache. BCACHE_DEV_DETACHING flag is set in
* bch_cached_dev_detach(). * 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; break;
}
} }
up_write(&dc->writeback_lock); up_write(&dc->writeback_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册