zram: Delete gendisk before cleaning up the request queue
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 28 Feb 2018 18:15:30 +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: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/zram/zram_drv.c

index 0afa6c8c3857418c72f754fc817da8d61af09670..85110e7931e5ad919254bd73a83f2dd4bcba40fd 100644 (file)
@@ -1620,8 +1620,8 @@ static int zram_remove(struct zram *zram)
 
        pr_info("Removed device: %s\n", zram->disk->disk_name);
 
-       blk_cleanup_queue(zram->disk->queue);
        del_gendisk(zram->disk);
+       blk_cleanup_queue(zram->disk->queue);
        put_disk(zram->disk);
        kfree(zram);
        return 0;