diff options
author | Christoph Hellwig | 2021-06-23 16:59:01 +0200 |
---|---|---|
committer | Jens Axboe | 2021-06-30 15:34:13 -0600 |
commit | bd5c39edad535d9f6ccb99633930f9f7b768593c (patch) | |
tree | cf7a6b22f7d5031628858a47d5901e2b05da3454 /drivers/block/loop.c | |
parent | 8b52d8be86d723085784317427d339528766d9a3 (diff) |
loop: reduce loop_ctl_mutex coverage in loop_exit
loop_ctl_mutex is only needed to iterate the IDR for removing the loop
devices, so reduce the coverage.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Link: https://lore.kernel.org/r/20210623145908.92973-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0e96f8c422b3..4a3712e4cf12 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2549,13 +2549,14 @@ static int loop_exit_cb(int id, void *ptr, void *data) static void __exit loop_exit(void) { - mutex_lock(&loop_ctl_mutex); unregister_blkdev(LOOP_MAJOR, "loop"); misc_deregister(&loop_misc); + mutex_lock(&loop_ctl_mutex); idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); - idr_destroy(&loop_index_idr); mutex_unlock(&loop_ctl_mutex); + + idr_destroy(&loop_index_idr); } module_init(loop_init); |