Re: [PATCH 2/2] Revert "ublk_drv: fix request queue leak"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux