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 2/2] Revert "ublk_drv: fix request queue leak"
Date: Wed, 20 Jul 2022 18:16:42 +0800 [thread overview]
Message-ID: <YtfWCl7+/N+50LNH@T590> (raw)
In-Reply-To: <20220720090040.GA18210@lst.de>
On Wed, Jul 20, 2022 at 11:00:40AM +0200, Christoph Hellwig wrote:
> On Wed, Jul 20, 2022 at 03:47:27PM +0800, Ming Lei wrote:
> > > What is broken in START_DEV/STOP_DEV? Please explain the semantics you
> > > want and what doesn't work. FYI, there is nothing in the test suite the
> > > complains. And besides the obvious block layer bug that Jens found you
> > > seemed to be perfectly happy with the semantics.
> >
> > START_DEV calls add_disk(), and STOP_DEV calls del_gendisk(), but if
> > GD_OWNS_QUEUE is set, blk_mq_exit_queue() will be called in
> > del_gendisk(), then the following START_DEV will stuck.
>
> Uh, yeah. alloc_disk and add_disk are supposed to be paired and
> not split over different ioctls. The lifetime rules here are
> rather broken.
Can you explain what this way breaks? And why can't one disk be
added/deleted multiple times?
>
> > > > similar with scsi's, in which disk rebind needs to be supported
> > > > and GD_OWNS_QUEUE can't be set.
> > >
> > > SCSI needs it because it needs the request_queue to probe for what ULP
> > > to bind to, and it allows to unbind the ULP. None of that is the case
> > > here. And managing the lifetimes separately is a complete mess, so
> > > don't do it. Especially not in a virtual driver where you don't have
> > > to cater to a long set protocol like SCSI.
> >
> > If blk_mq_exit_queue is called in del_gendisk() for scsi, how can
> > re-bind work as expected since it needs one completely workable
> > request queue instead of partial exited one?
>
> For !GD_OWNS_QUEUE blk_mq_exit_queue is not called from del_gendisk().
That is why scsi can't set GD_OWNS_QUEUE, for any driver, if disk rebind
or similar behavior is needed, GD_OWNS_QUEUE can't be set. That is why
ublk_drv uses separated queue/disk.
thanks,
Ming
next prev parent reply other threads:[~2022-07-20 10: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 [this message]
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
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=YtfWCl7+/N+50LNH@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 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.