[PATCH V6 03/10] null_blk: move unregister_blkdev() after destroying dev in null_exit()
Zizhi Wo <[email protected]>
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
From: Zizhi Wo <[email protected]> In null_exit(), unregister_blkdev() is called before the null_blk instances are destroyed, which is inconsistent with the cleanup order in null_init(). Move it after null_destroy_dev() so that teardown happens in the reverse order of initialization. No functional change intended. Suggested-by: Bart Van Assche <[email protected]> Signed-off-by: Zizhi Wo <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Nilay Shroff <[email protected]> --- drivers/block/null_blk/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 4613035222cd..6cb213779cc5 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -2194,8 +2194,6 @@ static void __exit null_exit(void) configfs_unregister_subsystem(&nullb_subsys); - unregister_blkdev(null_major, "nullb"); - mutex_lock(&lock); while (!list_empty(&nullb_list)) { nullb = list_entry(nullb_list.next, struct nullb, list); @@ -2203,6 +2201,8 @@ static void __exit null_exit(void) } mutex_unlock(&lock); + unregister_blkdev(null_major, "nullb"); + if (tag_set.ops) blk_mq_free_tag_set(&tag_set); -- 2.52.0