summaryrefslogtreecommitdiff
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-11-14 07:26:37 +0300
committerJens Axboe <axboe@kernel.dk>2022-11-30 21:09:00 +0300
commit63f93fd6fa5717769a78d6d7bea6f7f9a1ccca8e (patch)
treeb8a478855d3c4575d481b9476eb822cdfc150519 /block/blk-core.c
parent2bd85221a625b316114bafaab527770b607095d3 (diff)
downloadlinux-63f93fd6fa5717769a78d6d7bea6f7f9a1ccca8e.tar.xz
block: mark blk_put_queue as potentially blocking
We can't just say that the last reference release may block, as any reference dropped could be the last one. So move the might_sleep() from blk_free_queue to blk_put_queue and update the documentation. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20221114042637.1009333-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index d14317bfdf65..8ab21dd01cd1 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -260,8 +260,6 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
static void blk_free_queue(struct request_queue *q)
{
- might_sleep();
-
percpu_ref_exit(&q->q_usage_counter);
if (q->poll_stat)
@@ -285,11 +283,11 @@ static void blk_free_queue(struct request_queue *q)
* Decrements the refcount of the request_queue and free it when the refcount
* reaches 0.
*
- * Context: Any context, but the last reference must not be dropped from
- * atomic context.
+ * Context: Can sleep.
*/
void blk_put_queue(struct request_queue *q)
{
+ might_sleep();
if (refcount_dec_and_test(&q->refs))
blk_free_queue(q);
}