From: Ming Lei <ming.lei@redhat.com>
To: Nilay Shroff <nilay@linux.ibm.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, axboe@kernel.dk, gjoyce@ibm.com
Subject: Re: [PATCH] block: unfreeze queue if realloc tag set fails during nr_hw_queues update
Date: Mon, 12 May 2025 19:13:22 +0800 [thread overview]
Message-ID: <aCHX0vbWXbFbOgGt@fedora> (raw)
In-Reply-To: <20250512092952.135887-1-nilay@linux.ibm.com>
On Mon, May 12, 2025 at 02:43:38PM +0530, Nilay Shroff wrote:
> In __blk_mq_update_nr_hw_queues(), the current sequence involves:
>
> 1. unregistering sysfs/debugfs attributes
> 2. freeze the queue
> 3. reallocating the tag set
> 4. updating the queue map
> 5. reallocating hardware contexts
> 6. updating the elevator (which unfreeze the queue again)
> 7. re-register sysfs/debugfs attributes
>
> If tag set reallocation fails at step 3, the function skips steps 4–6
> and proceeds directly to step 7, re-registering the sysfs/debugfs
> attributes without unfreezing the queue first. This is incorrect and
> can lead to a system hang or lockdep splat, as the queue remains frozen
> and is never properly unfrozen.
>
> This patch addresses the issue by explicitly unfreezing the queue before
> re-registering the sysfs/debugfs attributes in the event of a tag set
> reallocation failure.
>
> Fixes: 9dc7a882ce96 ("block: move hctx debugfs/sysfs registering out of freezing queue")
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> ---
> block/blk-mq.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 4f79a9808fd1..cbc9a9f97a31 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -5002,8 +5002,11 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
> list_for_each_entry(q, &set->tag_list, tag_set_list)
> blk_mq_freeze_queue_nomemsave(q);
>
> - if (blk_mq_realloc_tag_set_tags(set, nr_hw_queues) < 0)
> + if (blk_mq_realloc_tag_set_tags(set, nr_hw_queues) < 0) {
> + list_for_each_entry(q, &set->tag_list, tag_set_list)
> + blk_mq_unfreeze_queue_nomemrestore(q);
> goto reregister;
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
next prev parent reply other threads:[~2025-05-12 11:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 9:13 [PATCH] block: unfreeze queue if realloc tag set fails during nr_hw_queues update Nilay Shroff
2025-05-12 11:13 ` Ming Lei [this message]
2025-05-12 13:15 ` Jens Axboe
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=aCHX0vbWXbFbOgGt@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=nilay@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.