OSDN Git Service

block/loop: Delete gendisk before cleaning up the request queue
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 28 Feb 2018 18:15:28 +0000 (10:15 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Feb 2018 19:23:35 +0000 (12:23 -0700)
Remove the disk, partition and bdi sysfs attributes before cleaning up
the request queue associated with the disk.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Shaohua Li <shli@fb.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c

index 87855b5..9d29aa6 100644 (file)
@@ -1864,8 +1864,8 @@ out:
 
 static void loop_remove(struct loop_device *lo)
 {
-       blk_cleanup_queue(lo->lo_queue);
        del_gendisk(lo->lo_disk);
+       blk_cleanup_queue(lo->lo_queue);
        blk_mq_free_tag_set(&lo->tag_set);
        put_disk(lo->lo_disk);
        kfree(lo);