Skip to content

Commit 49e4d04

Browse files
htejunaxboe
authored andcommitted
block: Drop spurious might_sleep() from blk_put_queue()
Dan reports the following smatch detected the following: block/blk-cgroup.c:1863 blkcg_schedule_throttle() warn: sleeping in atomic context caused by blkcg_schedule_throttle() calling blk_put_queue() in an non-sleepable context. blk_put_queue() acquired might_sleep() in 63f93fd ("block: mark blk_put_queue as potentially blocking") which transferred the might_sleep() from blk_free_queue(). blk_free_queue() acquired might_sleep() in e8c7d14 ("block: revert back to synchronous request_queue removal") while turning request_queue removal synchronous. However, this isn't necessary as nothing in the free path actually requires sleeping. It's pretty unusual to require a sleeping context in a put operation and it's not needed in the first place. Let's drop it. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Dan Carpenter <error27@gmail.com> Link: https://lkml.kernel.org/r/Y7g3L6fntnTtOm63@kili Cc: Christoph Hellwig <hch@lst.de> Cc: Luis Chamberlain <mcgrof@kernel.org> Fixes: e8c7d14 ("block: revert back to synchronous request_queue removal") # v5.9+ Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/Y7iFwjN+XzWvLv3y@slm.duckdns.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent b2b50d5 commit 49e4d04

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

block/blk-core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,9 @@ static void blk_free_queue(struct request_queue *q)
283283
*
284284
* Decrements the refcount of the request_queue and free it when the refcount
285285
* reaches 0.
286-
*
287-
* Context: Can sleep.
288286
*/
289287
void blk_put_queue(struct request_queue *q)
290288
{
291-
might_sleep();
292289
if (refcount_dec_and_test(&q->refs))
293290
blk_free_queue(q);
294291
}

0 commit comments

Comments
 (0)