mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
loop: reorder loop_exit
Unregister the misc and blockdevice first to prevent further access, and only then iterate to remove the devices. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
1 parent
1033d103a9
commit
8b52d8be86
1 file changed
+2
-5
@@ -2550,14 +2550,11 @@ 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);
|
||||
|
||||
idr_for_each(&loop_index_idr, &loop_exit_cb, NULL);
|
||||
idr_destroy(&loop_index_idr);
|
||||
|
||||
unregister_blkdev(LOOP_MAJOR, "loop");
|
||||
|
||||
misc_deregister(&loop_misc);
|
||||
|
||||
mutex_unlock(&loop_ctl_mutex);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user