summaryrefslogtreecommitdiff
path: root/block/bio.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-02-24 19:59:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-10 11:34:02 +0300
commit398d8745262d10040720d9d772b5b44c10edf7ec (patch)
tree03b871d965467b32c245d49b56726c1282977632 /block/bio.c
parent1796bc1e4499cedb3ba61c1068130d19ebae0b44 (diff)
downloadlinux-398d8745262d10040720d9d772b5b44c10edf7ec.tar.xz
block: clear bio->bi_bdev when putting a bio back in the cache
commit 11eb695feb636fa5211067189cad25ac073e7fe5 upstream. This isn't strictly needed in terms of correctness, but it does allow polling to know if the bio has been put already by a different task and hence avoid polling something that we don't need to. Cc: stable@vger.kernel.org Fixes: be4d234d7aeb ("bio: add allocation cache abstraction") Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block/bio.c')
-rw-r--r--block/bio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c
index 57c2f327225b..d5cd825d6efc 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -747,6 +747,7 @@ void bio_put(struct bio *bio)
bio_uninit(bio);
cache = per_cpu_ptr(bio->bi_pool->cache, get_cpu());
bio->bi_next = cache->free_list;
+ bio->bi_bdev = NULL;
cache->free_list = bio;
if (++cache->nr > ALLOC_CACHE_MAX + ALLOC_CACHE_SLACK)
bio_alloc_cache_prune(cache, ALLOC_CACHE_SLACK);