History

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.

Christoph Hellwig committed 4 years ago

Commit a09b3141 parent 99d055b1 file · +1 −2Browse files

Unified · Split

block/genhd.c+1−2
@@ -623,6 +623,7 @@ void del_gendisk(struct gendisk *disk) · 622 unmodified lines
623 * Prevent new I/O from crossing bio_queue_enter().623 * Prevent new I/O from crossing bio_queue_enter().
624 */624 */
625 blk_queue_start_drain(q);625 blk_queue_start_drain(q);
626 blk_mq_freeze_queue_wait(q);
626 627
627 if (!(disk->flags & GENHD_FL_HIDDEN)) {628 if (!(disk->flags & GENHD_FL_HIDDEN)) {
628 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");629 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
@@ -646,8 +647,6 @@ void del_gendisk(struct gendisk *disk) · 17 unmodified lines
646 pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);647 pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
647 device_del(disk_to_dev(disk));648 device_del(disk_to_dev(disk));
648 649
649 blk_mq_freeze_queue_wait(q);
650
651 blk_throtl_cancel_bios(disk->queue);650 blk_throtl_cancel_bios(disk->queue);
652 651
653 blk_sync_queue(q);652 blk_sync_queue(q);