linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH] ublk_drv: fix request queue leak
Date: Thu, 14 Jul 2022 21:37:10 +0800	[thread overview]
Message-ID: <YtAcBnGodvCUtaRP@T590> (raw)
In-Reply-To: <YtAZgYh54V/CDNG+@T590>

On Thu, Jul 14, 2022 at 09:26:25PM +0800, Ming Lei wrote:
> On Thu, Jul 14, 2022 at 06:23:12AM -0700, Christoph Hellwig wrote:
> > On Thu, Jul 14, 2022 at 09:20:24PM +0800, Ming Lei wrote:
> > > The problem is that you moved part of blk_cleanup_queue() into
> > > del_gendisk().
> > > 
> > > Here, the issue Jens reproduced is that we don't add disk yet, so won't
> > > call del_gendisk(). The queue & disk is allocated & initialized correctly.
> > > 
> > > Then how to do the part done by original blk_cleanup_queue() without calling
> > > blk_mq_destroy_queue()?
> > 
> > What do you need to clean up?  put_disk is supposed to eventually
> > clean up everything allocated by blk_alloc_disk through disk_release.
> > If it fails to cleanup anything that is a bug we need to fix in the core
> > as it will affect all drivers.
> 
> The part to be cleaned up is nothing to do with disk:
> 
>                 if (queue_is_mq(q))
>                         blk_mq_exit_queue(q);
> 
> ->exit_hctx() is called in blk_mq_exit_queue().
> 
> Without calling blk_mq_destroy_queue, I don't see other way to address
> this issue, or suggestions?

It is actually one big problem of 6f8191fdf41d ("block: simplify disk shutdown")
since blk_put_queue() can't do what blk_cleanup_queue() did.

Anywhere using blk_put_queue() to release blk-mq queue before adding
disk has the same issue.


Thanks,
Ming


  reply	other threads:[~2022-07-14 13:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 10:32 [PATCH] ublk_drv: fix request queue leak Ming Lei
2022-07-14 13:00 ` Jens Axboe
2022-07-14 13:10   ` Ming Lei
2022-07-14 13:14     ` Jens Axboe
2022-07-14 13:24       ` Christoph Hellwig
2022-07-14 13:13 ` Christoph Hellwig
2022-07-14 13:20   ` Ming Lei
2022-07-14 13:23     ` Christoph Hellwig
2022-07-14 13:26       ` Ming Lei
2022-07-14 13:37         ` Ming Lei [this message]
2022-07-14 13:55           ` Christoph Hellwig
2022-07-14 14:02             ` Ming Lei

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=YtAcBnGodvCUtaRP@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --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).