public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yi Zhang <yi.zhang@redhat.com>
Cc: linux-block <linux-block@vger.kernel.org>,
	"open list:NVM EXPRESS DRIVER" <linux-nvme@lists.infradead.org>
Subject: Re: [bug report] kmemleak observed from blktests on latest linux-block/for-next
Date: Mon, 13 Jun 2022 22:23:21 +0800	[thread overview]
Message-ID: <YqdIWcgnEylFuSci@T590> (raw)
In-Reply-To: <CAHj4cs8y5HHYjr0FtWm1AmkEY=ZqOL4OmgzrWBEhbRpu5V8dWA@mail.gmail.com>

On Mon, Jun 13, 2022 at 09:08:11PM +0800, Yi Zhang wrote:
> Hi Ming
> 
> The kmemleak also can be reproduced on 5.19.0-rc2, pls try to enable
> nvme_core multipath and retest.
> 
> # cat /sys/module/nvme_core/parameters/multipath
> Y
>

OK, I can understand the reason now since rqos is only removed for blk-mq queue,
then rqos allocated for bio queue is leaked, see disk_release_mq().

The following patch should fix it:

diff --git a/block/genhd.c b/block/genhd.c
index 556d6e4b38d9..6e7ca8c302aa 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1120,9 +1120,10 @@ static const struct attribute_group *disk_attr_groups[] = {
 	NULL
 };
 
-static void disk_release_mq(struct request_queue *q)
+static void disk_release_queue(struct request_queue *q)
 {
-	blk_mq_cancel_work_sync(q);
+	if (queue_is_mq(q))
+		blk_mq_cancel_work_sync(q);
 
 	/*
 	 * There can't be any non non-passthrough bios in flight here, but
@@ -1166,8 +1167,7 @@ static void disk_release(struct device *dev)
 	might_sleep();
 	WARN_ON_ONCE(disk_live(disk));
 
-	if (queue_is_mq(disk->queue))
-		disk_release_mq(disk->queue);
+	disk_release_queue(disk->queue);
 
 	blkcg_exit_queue(disk->queue);
 

Thanks,
Ming


  reply	other threads:[~2022-06-13 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12  7:23 [bug report] kmemleak observed from blktests on latest linux-block/for-next Yi Zhang
2022-06-13  3:29 ` Ming Lei
2022-06-13 13:08   ` Yi Zhang
2022-06-13 14:23     ` Ming Lei [this message]
2022-06-14  5:35       ` Yi Zhang
2022-06-26 14:16         ` Sagi Grimberg

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=YqdIWcgnEylFuSci@T590 \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=yi.zhang@redhat.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