Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: axboe@kernel.dk, hare@suse.de, nilay@linux.ibm.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	yi.zhang@huawei.com, yangerkun@huawei.com,
	johnny.chenyi@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH 00/10] blk-mq: fix blk_mq_tags double free while nr_requests grown
Date: Fri, 15 Aug 2025 22:20:39 +0800	[thread overview]
Message-ID: <aJ9CN_oeQERVgAoW@fedora> (raw)
In-Reply-To: <abde1955-d634-29d4-d229-df8c6ebdc582@huaweicloud.com>

On Fri, Aug 15, 2025 at 05:05:34PM +0800, Yu Kuai wrote:
> Hi,
> 
> 在 2025/08/15 16:30, Ming Lei 写道:
> > On Fri, Aug 15, 2025 at 04:02:06PM +0800, Yu Kuai wrote:
> > > From: Yu Kuai <yukuai3@huawei.com>
> > > 
> > > In the case user trigger tags grow by queue sysfs attribute nr_requests,
> > > hctx->sched_tags will be freed directly and replaced with a new
> > > allocated tags, see blk_mq_tag_update_depth().
> > > 
> > > The problem is that hctx->sched_tags is from elevator->et->tags, while
> > > et->tags is still the freed tags, hence later elevator exist will try to
> > > free the tags again, causing kernel panic.
> > > 
> > > patch 1-6 are prep cleanup and refactor patches for updating nr_requests
> > > patch 7,8 are the fix patches for the regression
> > > patch 9 is cleanup patch after patch 8
> > > patch 10 fix the stale nr_requests documentation
> > 
> > Please do not mix bug(regression) fix with cleanup.
> > 
> > The bug fix for updating nr_requests should have been simple enough in single
> > or two patches, why do you make 10-patches for dealing with the regression?
> 
> Ok, in short, my solution is:
> 
> - serialize switching elevator with updating nr_requests
> - check the case that nr_requests will grow and allocate elevator_tags
> before freezing the queue.
> - for the grow case, switch to new elevator_tags.

I'd suggest to make one or two commits to fix the recent regression
f5a6604f7a44 ("block: fix lockdep warning caused by lock dependency in elv_iosched_store")
first, because double free is one serious issue, and the fix should
belong to v6.17.

For other long-term or less serious issue, it may be fine to delay to v6.18
if the patchset is too big or complicated, which might imply new regression.


Thanks, 
Ming


      reply	other threads:[~2025-08-15 14:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  8:02 [PATCH 00/10] blk-mq: fix blk_mq_tags double free while nr_requests grown Yu Kuai
2025-08-15  8:02 ` [PATCH 01/10] blk-mq: remove useless checking from queue_requests_store() Yu Kuai
2025-08-15  8:02 ` [PATCH 02/10] blk-mq: remove useless checkings from blk_mq_update_nr_requests() Yu Kuai
2025-08-15  8:02 ` [PATCH 03/10] blk-mq: check invalid nr_requests in queue_requests_store() Yu Kuai
2025-08-15  8:02 ` [PATCH 04/10] blk-mq: serialize updating nr_requests with update_nr_hwq_lock Yu Kuai
2025-08-15 14:47   ` Ming Lei
2025-08-16  0:49     ` Yu Kuai
2025-08-16  2:23       ` Ming Lei
2025-08-15  8:02 ` [PATCH 05/10] blk-mq: cleanup shared tags case in blk_mq_update_nr_requests() Yu Kuai
2025-08-15  8:02 ` [PATCH 06/10] blk-mq: split bitmap grow and resize " Yu Kuai
2025-08-15  8:02 ` [PATCH 07/10] blk-mq-sched: add new parameter nr_requests in blk_mq_alloc_sched_tags() Yu Kuai
2025-08-15  8:02 ` [PATCH 08/10] blk-mq: fix blk_mq_tags double free while nr_requests grown Yu Kuai
2025-08-15 19:30   ` Nilay Shroff
2025-08-16  2:57     ` Yu Kuai
2025-08-16  4:05       ` Ming Lei
2025-08-16  8:05         ` 余快
2025-08-18  2:11           ` Ming Lei
2025-08-18  3:12             ` Ming Lei
2025-08-15  8:02 ` [PATCH 09/10] blk-mq: remove blk_mq_tag_update_depth() Yu Kuai
2025-08-15  8:02 ` [PATCH 10/10] blk-mq: fix stale nr_requests documentation Yu Kuai
2025-08-15  8:30 ` [PATCH 00/10] blk-mq: fix blk_mq_tags double free while nr_requests grown Ming Lei
2025-08-15  9:05   ` Yu Kuai
2025-08-15 14:20     ` 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=aJ9CN_oeQERVgAoW@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=johnny.chenyi@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nilay@linux.ibm.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.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