[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200511134158.GM11244@42.do-not-panic.com>
Date: Mon, 11 May 2020 13:41:58 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: axboe@...nel.dk, viro@...iv.linux.org.uk, bvanassche@....org,
rostedt@...dmis.org, mingo@...hat.com, jack@...e.cz,
ming.lei@...hat.com, nstange@...e.de, akpm@...ux-foundation.org,
mhocko@...e.com, yukuai3@...wei.com, linux-block@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Omar Sandoval <osandov@...com>,
Hannes Reinecke <hare@...e.com>,
Michal Hocko <mhocko@...nel.org>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v4 1/5] block: revert back to synchronous request_queue
removal
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
Powered by blists - more mailing lists