mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-24 05:01:03 +02:00
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>
This commit is contained in:
committed by
Jens Axboe
parent
2bd85221a6
commit
63f93fd6fa
@@ -260,8 +260,6 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
|
|||||||
|
|
||||||
static void blk_free_queue(struct request_queue *q)
|
static void blk_free_queue(struct request_queue *q)
|
||||||
{
|
{
|
||||||
might_sleep();
|
|
||||||
|
|
||||||
percpu_ref_exit(&q->q_usage_counter);
|
percpu_ref_exit(&q->q_usage_counter);
|
||||||
|
|
||||||
if (q->poll_stat)
|
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
|
* Decrements the refcount of the request_queue and free it when the refcount
|
||||||
* reaches 0.
|
* reaches 0.
|
||||||
*
|
*
|
||||||
* Context: Any context, but the last reference must not be dropped from
|
* Context: Can sleep.
|
||||||
* atomic context.
|
|
||||||
*/
|
*/
|
||||||
void blk_put_queue(struct request_queue *q)
|
void blk_put_queue(struct request_queue *q)
|
||||||
{
|
{
|
||||||
|
might_sleep();
|
||||||
if (refcount_dec_and_test(&q->refs))
|
if (refcount_dec_and_test(&q->refs))
|
||||||
blk_free_queue(q);
|
blk_free_queue(q);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user