When unloading bcache module there is lack of removing operation for closure debug file, so it will cause creating error when trying to reload module. This fix introduces closure_debug_exit to handle removing operation properly. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxx> --- drivers/md/bcache/closure.c | 5 +++++ drivers/md/bcache/closure.h | 2 ++ drivers/md/bcache/super.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c index 7f12920..8fcd737 100644 --- a/drivers/md/bcache/closure.c +++ b/drivers/md/bcache/closure.c @@ -204,6 +204,11 @@ void __init closure_debug_init(void) debug = debugfs_create_file("closures", 0400, NULL, NULL, &debug_ops); } +void closure_debug_exit(void) +{ + debugfs_remove(debug); +} + #endif MODULE_AUTHOR("Kent Overstreet <koverstreet@xxxxxxxxxx>"); diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index 3b9dfc9..1aa0f7e 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h @@ -186,12 +186,14 @@ static inline void closure_sync(struct closure *cl) #ifdef CONFIG_BCACHE_CLOSURES_DEBUG void closure_debug_init(void); +void closure_debug_exit(void); void closure_debug_create(struct closure *cl); void closure_debug_destroy(struct closure *cl); #else static inline void closure_debug_init(void) {} +static inline void closure_debug_exit(void) {} static inline void closure_debug_create(struct closure *cl) {} static inline void closure_debug_destroy(struct closure *cl) {} diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 1a9fdab..38e2e21 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -2118,6 +2118,7 @@ static void bcache_exit(void) destroy_workqueue(bcache_wq); if (bcache_major) unregister_blkdev(bcache_major, "bcache"); + closure_debug_exit(); unregister_reboot_notifier(&reboot); mutex_destroy(&bch_register_lock); } @@ -2137,6 +2138,7 @@ static int __init bcache_init(void) bcache_major = register_blkdev(0, "bcache"); if (bcache_major < 0) { + closure_debug_exit(); unregister_reboot_notifier(&reboot); mutex_destroy(&bch_register_lock); return bcache_major; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html