Skip to content

Commit

Permalink
block: freeze the queue earlier in del_gendisk
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jun 17, 2022
1 parent 99d055b commit a09b314
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,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");
Expand All @@ -646,8 +647,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);
Expand Down

0 comments on commit a09b314

Please sign in to comment.