aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-14 09:48:27 +0200
committerJens Axboe <axboe@kernel.dk>2022-06-17 07:31:05 -0600
commita09b314005f3a0956ebf56e01b3b80339df577cc (patch)
tree9ea5206da7bcc6c5a5a6e9f5063394dafc6b2a51 /block/genhd.c
parentblock: remove per-disk debugfs files in blk_unregister_queue (diff)
downloadlinux-dev-a09b314005f3a0956ebf56e01b3b80339df577cc.tar.xz
linux-dev-a09b314005f3a0956ebf56e01b3b80339df577cc.zip
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>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/genhd.c b/block/genhd.c
index e0675772178b..278227ba1d53 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -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");
@@ -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);