summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-08-18 19:33:27 -0600
committerJens Axboe <axboe@kernel.dk>2021-08-18 21:21:14 -0600
commitb5599bb5cd57ea6b2f240bc01df14359689ae538 (patch)
treeab33e5f8a70071104791f42b3038ffc6c99f1b8f
parent13b17703b0be19f2054ce51022a2b34da759ab73 (diff)
bio: add in_task() check for bio alloc cache
We must be in process context for freeing a bio that belongs to the cache, since the cache itself is deliberately not IRQ safe. Be safe and just check in_task() before using the cache free, if not just use bio_free() which is always safe. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/bio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c
index 44c328db4390..56c67b1a9924 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -686,7 +686,7 @@ void bio_put(struct bio *bio)
return;
}
- if (bio_flagged(bio, BIO_PERCPU_CACHE)) {
+ if (bio_flagged(bio, BIO_PERCPU_CACHE) && in_task()) {
struct bio_alloc_cache *cache;
bio_uninit(bio);