diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-10-18 20:50:55 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-10-20 05:50:29 -0700 |
commit | d4347d50407daea6237872281ece64c4bdf1ec99 (patch) | |
tree | fb609912c4deb0ac37524b3067c0324b81598d91 /block | |
parent | 33566f92cd5f1c1d462920978f6dc102c744270d (diff) | |
download | linux-d4347d50407daea6237872281ece64c4bdf1ec99.tar.gz linux-d4347d50407daea6237872281ece64c4bdf1ec99.tar.bz2 linux-d4347d50407daea6237872281ece64c4bdf1ec99.zip |
bio: safeguard REQ_ALLOC_CACHE bio put
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/558d78313476c4e9c233902efa0092644c3d420a.1666122465.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/bio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c index 6c470a50a36d..0a14af923738 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); |