From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: [PATCH 3/3] block: mark blk_put_queue as potentially blocking
Date: Sat, 5 Nov 2022 09:08:15 +0100 [thread overview]
Message-ID: <20221105080815.775721-3-hch@lst.de> (raw)
In-Reply-To: <20221105080815.775721-1-hch@lst.de>
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>
---
block/blk-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index d14317bfdf654..8ab21dd01cd1c 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);
}
--
2.30.2
next prev parent reply other threads:[~2022-11-05 8:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 8:08 [PATCH 1/3] blk-crypto: pass a gendisk to blk_crypto_sysfs_register Christoph Hellwig
2022-11-05 8:08 ` [PATCH 2/3] block: untangle request_queue refcounting from sysfs Christoph Hellwig
2022-11-07 19:57 ` Eric Biggers
2022-11-09 13:01 ` Christoph Hellwig
2022-11-05 8:08 ` Christoph Hellwig [this message]
2022-11-07 19:55 ` [PATCH 1/3] blk-crypto: pass a gendisk to blk_crypto_sysfs_register Eric Biggers
2022-11-09 12:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221105080815.775721-3-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox