All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Pavel Begunkov <asml.silence@gmail.com>
Subject: [RFC for-next v2 1/4] bio: safeguard REQ_ALLOC_CACHE bio put
Date: Tue, 18 Oct 2022 20:50:55 +0100	[thread overview]
Message-ID: <558d78313476c4e9c233902efa0092644c3d420a.1666122465.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1666122465.git.asml.silence@gmail.com>

bio_put() with REQ_ALLOC_CACHE assumes that it's executed not from
an irq context. Let's add a warning if the invariant is not respected,
especially since there is a couple of places removing REQ_POLLED by hand
without also clearing REQ_ALLOC_CACHE.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/bio.c b/block/bio.c
index 7cb7d2ff139b..5b4594daa259 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -741,7 +741,7 @@ void bio_put(struct bio *bio)
 			return;
 	}
 
-	if (bio->bi_opf & REQ_ALLOC_CACHE) {
+	if ((bio->bi_opf & REQ_ALLOC_CACHE) && !WARN_ON_ONCE(in_interrupt())) {
 		struct bio_alloc_cache *cache;
 
 		bio_uninit(bio);
-- 
2.38.0


  reply	other threads:[~2022-10-18 19:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 19:50 [RFC for-next v2 0/4] enable pcpu bio caching for IRQ I/O Pavel Begunkov
2022-10-18 19:50 ` Pavel Begunkov [this message]
2022-10-20  8:26   ` [RFC for-next v2 1/4] bio: safeguard REQ_ALLOC_CACHE bio put Christoph Hellwig
2022-10-18 19:50 ` [RFC for-next v2 2/4] bio: split pcpu cache part of bio_put into a helper Pavel Begunkov
2022-10-20  8:30   ` Christoph Hellwig
2022-10-18 19:50 ` [RFC for-next v2 3/4] block/bio: add pcpu caching for non-polling bio_put Pavel Begunkov
2022-10-20  8:31   ` Christoph Hellwig
2022-10-20 12:26     ` Pavel Begunkov
2022-10-18 19:50 ` [RFC for-next v2 4/4] io_uring/rw: enable bio caches for IRQ rw Pavel Begunkov
2022-10-20  8:32 ` [RFC for-next v2 0/4] enable pcpu bio caching for IRQ I/O Christoph Hellwig
2022-10-20 12:40   ` Pavel Begunkov
2022-10-20 12:53     ` Jens Axboe
2022-10-20 12:50 ` (subset) " Jens Axboe

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=558d78313476c4e9c233902efa0092644c3d420a.1666122465.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.