Skip to content

Commit a09b314

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: freeze the queue earlier in del_gendisk
Freeze the queue earlier in del_gendisk so that the state does not change while we remove debugfs and sysfs files. Ming mentioned that being able to observer request in debugfs might be useful while the queue is being frozen in del_gendisk, which is made possible by this change. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220614074827.458955-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 99d055b commit a09b314

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

block/genhd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ void del_gendisk(struct gendisk *disk)
623623
* Prevent new I/O from crossing bio_queue_enter().
624624
*/
625625
blk_queue_start_drain(q);
626+
blk_mq_freeze_queue_wait(q);
626627

627628
if (!(disk->flags & GENHD_FL_HIDDEN)) {
628629
sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
@@ -646,8 +647,6 @@ void del_gendisk(struct gendisk *disk)
646647
pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
647648
device_del(disk_to_dev(disk));
648649

649-
blk_mq_freeze_queue_wait(q);
650-
651650
blk_throtl_cancel_bios(disk->queue);
652651

653652
blk_sync_queue(q);

0 commit comments

Comments
 (0)