]> www.infradead.org Git - users/hch/block.git/commitdiff
block: freeze the queue earlier in del_gendisk block-debugfs-name-reuse
authorChristoph Hellwig <hch@lst.de>
Tue, 24 May 2022 12:33:09 +0000 (14:33 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 30 May 2022 13:13:14 +0000 (15:13 +0200)
Ming mentioned that being able to observer request in debugfs might
be useful while the queue is being frozen in del_gendisk.  Move the
free wait before blk_unregister_queue to make that possible.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/genhd.c

index 36532b93184191e08f5ab8048ecb6ce99cfc33ee..8ff5b187791af02c0f7b9389af773a0bc8e33539 100644 (file)
@@ -621,6 +621,7 @@ void del_gendisk(struct gendisk *disk)
         * Prevent new I/O from crossing bio_queue_enter().
         */
        blk_queue_start_drain(q);
+       blk_mq_freeze_queue_wait(q);
 
        if (!(disk->flags & GENHD_FL_HIDDEN)) {
                sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
@@ -644,8 +645,6 @@ void del_gendisk(struct gendisk *disk)
        pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
        device_del(disk_to_dev(disk));
 
-       blk_mq_freeze_queue_wait(q);
-
        blk_throtl_cancel_bios(disk->queue);
 
        blk_sync_queue(q);