[PATCH] bcache: fix up kthread_stop crash in cached_dev_free()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In bch_cached_dev_attach(), writeback kthread stopped if
bch_cached_dev_run() returns error. Then, cached_dev_free()
will stop writeback kthread again and crash.

This patch set dc->writeback_thread to null after call kthread_stop().

Fixes: 5c2a634cbfaf ("bcache: stop writeback kthread and kworker when bch_cached_dev_run() failed")
Signed-off-by: Mingzhe Zou <mingzhe.zou@xxxxxxxxxxxx>
---
 drivers/md/bcache/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index ba3909bb6bea..7b6e533b0339 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1310,6 +1310,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
 		 * have to be stopped manually here.
 		 */
 		kthread_stop(dc->writeback_thread);
+		dc->writeback_thread = NULL;
 		cancel_writeback_rate_update_dwork(dc);
 		pr_err("Couldn't run cached device %pg\n", dc->bdev);
 		return ret;
-- 
2.17.1.windows.2




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux