diff mbox series

[1/2] block: clear bio->bi_bdev when putting a bio back in the cache

Message ID 20230224170845.175485-2-axboe@kernel.dk (mailing list archive)
State New, archived
Headers show
Series Polling fix | expand

Commit Message

Jens Axboe Feb. 24, 2023, 5:08 p.m. UTC
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")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Keith Busch Feb. 24, 2023, 8:18 p.m. UTC | #1
On Fri, Feb 24, 2023 at 10:08:44AM -0700, Jens Axboe wrote:
> 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")
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

> ---
>  block/bio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/bio.c b/block/bio.c
> index 2693f34afb7e..605c40025068 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -772,6 +772,7 @@ static inline void bio_put_percpu_cache(struct bio *bio)
>  
>  	if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) {
>  		bio->bi_next = cache->free_list;
> +		bio->bi_bdev = NULL;
>  		cache->free_list = bio;
>  		cache->nr++;
>  	} else {
> -- 
> 2.39.1
>
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 2693f34afb7e..605c40025068 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -772,6 +772,7 @@  static inline void bio_put_percpu_cache(struct bio *bio)
 
 	if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) {
 		bio->bi_next = cache->free_list;
+		bio->bi_bdev = NULL;
 		cache->free_list = bio;
 		cache->nr++;
 	} else {