From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
axboe@kernel.dk, shinichiro.kawasaki@wdc.com,
dan.j.williams@intel.com, yukuai3@huawei.com,
linux-block@vger.kernel.org
Subject: Re: [PATCH] block: remove per-disk debugfs files in blk_unregister_queue
Date: Tue, 24 May 2022 15:06:30 +0200 [thread overview]
Message-ID: <20220524130630.GA25398@lst.de> (raw)
In-Reply-To: <YozMGvN/3TJirE3N@T590>
On Tue, May 24, 2022 at 08:14:18PM +0800, Ming Lei wrote:
> Then please move it to disk release at least, when blk-mq debug becomes
> less useful.
No. del_gendisk is where we need stop all new external access to the
queue so that we can sanely unwind it without chasing one little thing
after another. This is where we stop allowing opening it, stop allowing
sysfs access, and stop requests from being sent to the driver. What
we could do is something like the patch below. It passes basic removal
testing, but I'm a lot less confident in it than the debugfs changes
themselves:
---
From 5d553acccfc6bfbda48f13d252f1411ef65a3d0d Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Tue, 24 May 2022 14:33:09 +0200
Subject: block: freeze the queue earlier in del_gendisk
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 | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index 36532b9318419..8ff5b187791af 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -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);
--
2.30.2
next prev parent reply other threads:[~2022-05-24 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 8:33 [PATCH] block: remove per-disk debugfs files in blk_unregister_queue Christoph Hellwig
2022-05-24 9:29 ` Hannes Reinecke
2022-05-24 12:00 ` Christoph Hellwig
2022-05-24 11:47 ` Ming Lei
2022-05-24 12:01 ` Christoph Hellwig
2022-05-24 12:14 ` Ming Lei
2022-05-24 13:06 ` Christoph Hellwig [this message]
2022-05-24 14:44 ` Ming Lei
2022-05-27 7:15 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220524130630.GA25398@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=dan.j.williams@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).