[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f38f5bc-6bd2-4e3a-92e6-c232761fafc6@kernel.org>
Date: Mon, 12 Aug 2024 15:51:12 +0200
From: Matthieu Baerts <matttbe@...nel.org>
To: Sasha Levin <sashal@...nel.org>, stable@...r.kernel.org,
Greg KH <gregkh@...uxfoundation.org>
Cc: Mikulas Patocka <mpatocka@...hat.com>, Anuj Gupta <anuj20.g@...sung.com>,
Kanchan Joshi <joshi.k@...sung.com>, Christoph Hellwig <hch@....de>,
Jens Axboe <axboe@...nel.dk>, kbusch@...nel.org, sagi@...mberg.me,
linux-nvme@...ts.infradead.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 6.10 13/16] block: change rq_integrity_vec to
respect the iterator
Hi Sasha, Greg,
On 28/07/2024 02:47, Sasha Levin wrote:
> From: Mikulas Patocka <mpatocka@...hat.com>
>
> [ Upstream commit cf546dd289e0f6d2594c25e2fb4e19ee67c6d988 ]
>
> If we allocate a bio that is larger than NVMe maximum request size,
> attach integrity metadata to it and send it to the NVMe subsystem, the
> integrity metadata will be corrupted.
(...)
> diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
> index 7428cb43952da..d16dd24719841 100644
> --- a/include/linux/blk-integrity.h
> +++ b/include/linux/blk-integrity.h
> @@ -100,14 +100,13 @@ static inline bool blk_integrity_rq(struct request *rq)
> }
>
> /*
> - * Return the first bvec that contains integrity data. Only drivers that are
> - * limited to a single integrity segment should use this helper.
> + * Return the current bvec that contains the integrity data. bip_iter may be
> + * advanced to iterate over the integrity data.
> */
> -static inline struct bio_vec *rq_integrity_vec(struct request *rq)
> +static inline struct bio_vec rq_integrity_vec(struct request *rq)
> {
> - if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
> - return NULL;
> - return rq->bio->bi_integrity->bip_vec;
> + return mp_bvec_iter_bvec(rq->bio->bi_integrity->bip_vec,
> + rq->bio->bi_integrity->bip_iter);
> }
> #else /* CONFIG_BLK_DEV_INTEGRITY */
> static inline int blk_rq_count_integrity_sg(struct request_queue *q,
> @@ -169,7 +168,8 @@ static inline int blk_integrity_rq(struct request *rq)
>
> static inline struct bio_vec *rq_integrity_vec(struct request *rq)
> {
> - return NULL;
> + /* the optimizer will remove all calls to this function */
> + return (struct bio_vec){ };
If CONFIG_BLK_DEV_INTEGRITY is not defined, there is a compilation error
here in v6.10 with the recently queued patches because the signature has
not been updated:
> In file included from block/bdev.c:15:
> include/linux/blk-integrity.h: In function 'rq_integrity_vec':
> include/linux/blk-integrity.h:172:16: error: incompatible types when returning type 'struct bio_vec' but 'struct bio_vec *' was expected
> 172 | return (struct bio_vec){ };
> | ^
Could it be possible to backport the following fix to v6.10 as well please?
69b6517687a4 ("block: use the right type for stub rq_integrity_vec()")
It is also needed for v6.6 and v6.1.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Powered by blists - more mailing lists