block: don't use the bvec fast path for dma-buf bios
PATCH 1/1 block: don't use the bvec fast path for dma-buf bios
From: Anuj Gupta <[email protected]>
bio_may_need_split() reads bi_io_vec, which for dma-buf bios aliases bi_dmabuf_map, and interprets the map as a bvec. Always run the full split check for dma-buf bios.
--- block/blk.h | 2 ++ 1 file changed, 2 insertions(+)
block/blk.h +2 -0
@@ -404,6 +404,8 @@ static inline bool bio_may_need_split(struct bio *bio,if (!bio->bi_io_vec)return true; +if (op_is_dmabuf (bio->bi_opf)) +return true; bv =__bvec_iter_bvec (bio->bi_io_vec, bio->bi_iter);if (bio->bi_iter.bi_size > bv->bv_len - bio->bi_iter.bi_offset)
Signature · 1 line
2.43.0
Quoted 5 lines · Anuj Gupta
From: Anuj Gupta <[email protected]>
bio_may_need_split()readsbi_io_vec, which for dma-buf bios aliasesbi_dmabuf_map, and interprets the map as a bvec. Always run the full split check for dma-buf bios.
That's odd, I recall adding a check to bio_may_need_split() before. Thanks, let me test it.
Quoted 19 lines
Fixes d88e44f43e93 ("block: introduce dma map backed bio type")Signed-off-by Anuj Gupta <[email protected]>--- block/blk.h | 2 ++ 1 file changed, 2 insertions(+)block/blk.h +2
-0@@ -404,6 +404,8 @@ static inline bool bio_may_need_split(struct bio *bio,if (!bio->bi_io_vec)return true; +if (op_is_dmabuf (bio->bi_opf)) +return true; bv =__bvec_iter_bvec (bio->bi_io_vec, bio->bi_iter);if (bio->bi_iter.bi_size > bv->bv_len - bio->bi_iter.bi_offset)
Signature · 1 line
Pavel Begunkov
Quoted 2 lines
That's odd, I recall adding a check to
bio_may_need_split()before. Thanks, let me test it.
Right, v3 [1] had a BIO_DMABUF_MAP check next to the bio_may_need_split() call, which seems to have been dropped in v4 [2].
[1] https://lore.kernel.org/linux-block/646ecd6fde8d9e146cb051efb514deb27ce3883e.1777475843.git.asml.silence@gmail.com/
[2] https://lore.kernel.org/linux-block/f97985ac5cfff3d9f7777b93f11456af57e253e2.1785274111.git.asml.silence@gmail.com/
Quoted 5 lines · Anuj Gupta
From: Anuj Gupta <[email protected]>
bio_may_need_split()readsbi_io_vec, which for dma-buf bios aliasesbi_dmabuf_map, and interprets the map as a bvec. Always run the full split check for dma-buf bios.
Signature · 1 line
Pavel Begunkov
Quoted 3 lines · Anuj Gupta
bio_may_need_split()readsbi_io_vec, which for dma-buf bios aliasesbi_dmabuf_map, and interprets the map as a bvec. Always run the full split check for dma-buf bios.
Applied, thanks!
[1/1] block: don't use the bvec fast path for dma-buf bios
commit: 801bddbf1e4147a69b811c548c35a06a157941b4
Best regards,
Signature · 1 line
Jens Axboe