Skip to content

Commit d4347d5

Browse files
isilenceaxboe
authored andcommitted
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/558d78313476c4e9c233902efa0092644c3d420a.1666122465.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 33566f9 commit d4347d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/bio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ void bio_put(struct bio *bio)
741741
return;
742742
}
743743

744-
if (bio->bi_opf & REQ_ALLOC_CACHE) {
744+
if ((bio->bi_opf & REQ_ALLOC_CACHE) && !WARN_ON_ONCE(in_interrupt())) {
745745
struct bio_alloc_cache *cache;
746746

747747
bio_uninit(bio);

0 commit comments

Comments
 (0)