On Mon, Apr 20, 2020 at 02:11:13PM -0700, Bart Van Assche wrote: > On 4/20/20 11:59 AM, Luis Chamberlain wrote: > > On Sun, Apr 19, 2020 at 03:23:31PM -0700, Bart Van Assche wrote: > > > On 4/19/20 12:45 PM, Luis Chamberlain wrote: > > > > + * Decrements the refcount to the request_queue kobject, when this reaches > > > > + * 0 we'll have blk_release_queue() called. You should avoid calling > > > > + * this function in atomic context but if you really have to ensure you > > > > + * first refcount the block device with bdgrab() / bdput() so that the > > > > + * last decrement happens in blk_cleanup_queue(). > > > > + */ > > > > > > Is calling bdgrab() and bdput() an option from a context in which it is not > > > guaranteed that the block device is open? > > > > If the block device is not open, nope. For that blk_get_queue() can > > be used, and is used by the block layer. This begs the question: > > > > Do we have *drivers* which requires access to the request_queue from > > atomic context when the block device is not open? > > Instead of trying to answer that question, how about changing the references > to bdgrab() and bdput() into references to blk_get_queue() and > blk_put_queue()? I think if that change is made that we won't have to > research what the answer to the bdgrab()/bdput() question is. Yeah that's fine, now at least we'd have documented what should be avoided. Luis