Message ID | 20210621101547.3764003-2-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/9] loop: reorder loop_exit | expand |
On 6/21/21 03:21, Christoph Hellwig wrote: > Unregister the misc and blockdevice first to prevent further access, > and only then iterate to remove the devices. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Looks good. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 081eb9aaeba8..44fa27c54ac2 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2381,14 +2381,11 @@ static int loop_exit_cb(int id, void *ptr, void *data) static void __exit loop_exit(void) { mutex_lock(&loop_ctl_mutex); - - idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); - idr_destroy(&loop_index_idr); - unregister_blkdev(LOOP_MAJOR, "loop"); - misc_deregister(&loop_misc); + idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); + idr_destroy(&loop_index_idr); mutex_unlock(&loop_ctl_mutex); }
Unregister the misc and blockdevice first to prevent further access, and only then iterate to remove the devices. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/block/loop.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)