Re: [PATCH v4 1/5] block: revert back to synchronous request_queue removal

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

 



On Sun, May 10, 2020 at 08:20:58AM +0200, Greg KH wrote:
> On Sat, May 09, 2020 at 03:10:54AM +0000, Luis Chamberlain wrote:
> > Commit dc9edc44de6c ("block: Fix a blk_exit_rl() regression") merged on
> > v4.12 moved the work behind blk_release_queue() into a workqueue after a
> > splat floated around which indicated some work on blk_release_queue()
> > could sleep in blk_exit_rl(). This splat would be possible when a driver
> > called blk_put_queue() or blk_cleanup_queue() (which calls blk_put_queue()
> > as its final call) from an atomic context.
> > 
> > blk_put_queue() decrements the refcount for the request_queue kobject,
> > and upon reaching 0 blk_release_queue() is called. Although blk_exit_rl()
> > is now removed through commit db6d9952356 ("block: remove request_list code")
> > on v5.0, we reserve the right to be able to sleep within blk_release_queue()
> > context.
> > 
> > The last reference for the request_queue must not be called from atomic
> > context. *When* the last reference to the request_queue reaches 0 varies,
> > and so let's take the opportunity to document when that is expected to
> > happen and also document the context of the related calls as best as possible
> > so we can avoid future issues, and with the hopes that the synchronous
> > request_queue removal sticks.
> > 
> > We revert back to synchronous request_queue removal because asynchronous
> > removal creates a regression with expected userspace interaction with
> > several drivers. An example is when removing the loopback driver, one
> > uses ioctls from userspace to do so, but upon return and if successful,
> > one expects the device to be removed. Likewise if one races to add another
> > device the new one may not be added as it is still being removed. This was
> > expected behavior before and it now fails as the device is still present
> > and busy still. Moving to asynchronous request_queue removal could have
> > broken many scripts which relied on the removal to have been completed if
> > there was no error. Document this expectation as well so that this
> > doesn't regress userspace again.
> > 
> > Using asynchronous request_queue removal however has helped us find
> > other bugs. In the future we can test what could break with this
> > arrangement by enabling CONFIG_DEBUG_KOBJECT_RELEASE.
> 
> You are adding documenation and might_sleep() calls all over the place
> in here, making the "real" change in the patch hard to pick out.
> 
> How about you split this up into 3 patches, one for documentation, one
> for might_sleep() and one for the real change?  Or maybe just 2 patches,
> but what you have here seems excessive.

Sure.

  Luis



[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