From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org, ming.lei@redhat.com
Subject: Re: [PATCH 1/2] block: call blk_mq_exit_queue from disk_release for never added disks
Date: Mon, 18 Jul 2022 23:16:07 +0800 [thread overview]
Message-ID: <YtV5N2ATLgy+d/q+@T590> (raw)
In-Reply-To: <20220718130725.GA19204@lst.de>
On Mon, Jul 18, 2022 at 03:07:25PM +0200, Christoph Hellwig wrote:
> On Mon, Jul 18, 2022 at 03:18:52PM +0800, Ming Lei wrote:
> > Request queue is allocated successfully, but disk allocation may fail,
> > so blk_mq_exit_queue still may be missed in this case.
>
> Yes. That's a separate issue, though and solved by this one liner:
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index d716b7f3763f3..70177ee74295b 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -3960,7 +3960,7 @@ struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set, void *queuedata,
>
> disk = __alloc_disk_node(q, set->numa_node, lkclass);
> if (!disk) {
> - blk_put_queue(q);
> + blk_mq_destroy_queue(q);
> return ERR_PTR(-ENOMEM);
OK, but it is still tricky, since there isn't the required order between
calling blk_mq_free_tag_set and put_disk, but now put_disk has to be called
before calling blk_mq_free_tag_set, so you may have to audit drivers
first, and make sure that all put_disk is called before blk_mq_free_tag_set()
in driver's error handling code path.
Thanks,
Ming
prev parent reply other threads:[~2022-07-18 15:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 6:29 [PATCH 1/2] block: call blk_mq_exit_queue from disk_release for never added disks Christoph Hellwig
2022-07-18 6:29 ` [PATCH 2/2] Revert "ublk_drv: fix request queue leak" Christoph Hellwig
2022-07-19 12:37 ` Ming Lei
2022-07-20 6:07 ` Christoph Hellwig
2022-07-20 7:47 ` Ming Lei
2022-07-20 9:00 ` Christoph Hellwig
2022-07-20 10:16 ` Ming Lei
2022-07-20 10:23 ` Ming Lei
2022-07-20 13:08 ` Christoph Hellwig
2022-07-20 15:33 ` Ming Lei
2022-07-21 5:12 ` Christoph Hellwig
2022-07-18 7:18 ` [PATCH 1/2] block: call blk_mq_exit_queue from disk_release for never added disks Ming Lei
2022-07-18 8:33 ` Ming Lei
2022-07-18 13:08 ` Christoph Hellwig
2022-07-18 13:07 ` Christoph Hellwig
2022-07-18 15:16 ` Ming Lei [this message]
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=YtV5N2ATLgy+d/q+@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
/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).