From 3c61c6aa45a1f5050196e6f6734603f1f7b4b1bf Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Sat, 9 Jan 2021 16:02:58 +0000 Subject: [PATCH] bvec/iter: disallow zero-length segment bvecs zero-length bvec segments are allowed in general, but not handled by bio and down the block layer so filtered out. This inconsistency may be confusing and prevent from optimisations. As zero-length segments are useless and places that were generating them are patched, declare them not allowed. Reviewed-by: Christoph Hellwig Signed-off-by: Pavel Begunkov Reviewed-by: Ming Lei Signed-off-by: Jens Axboe (cherry picked from commit 9b2e0016d04c6542ace0128eb82ecb3b10c97e43) (cherry picked from commit 87afbd40acbb99860f846ad6f199e62e93be96c2) (cherry picked from commit f0677085687d50b5ecd6e7a2e19e4aff23251cb6) (cherry picked from commit affb154c088db678d4a541f8a4080fa5088cb10b) (cherry picked from commit 9b383b80e8432af1d0421acf9287076db26996d7) (cherry picked from commit f643066fcac50220888ecfe9b86c5d895d621648) (cherry picked from commit d2f588cf9664d76f78287142f505e4f375503ae6) --- Documentation/block/biovecs.rst | 2 ++ Documentation/filesystems/porting.rst | 8 ++++++++ lib/iov_iter.c | 2 -- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/block/biovecs.rst b/Documentation/block/biovecs.rst index 36771a131..ddb867e01 100755 --- a/Documentation/block/biovecs.rst +++ b/Documentation/block/biovecs.rst @@ -40,6 +40,8 @@ normal code doesn't have to deal with bi_bvec_done. There is a lower level advance function - bvec_iter_advance() - which takes a pointer to a biovec, not a bio; this is used by the bio integrity code. +As of 5.12 bvec segments with zero bv_len are not supported. + What's all this get us? ======================= diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index 0a2d29d84..9925c9a52 100755 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -866,6 +866,14 @@ no matter what. Everything is handled by the caller. clone_private_mount() returns a longterm mount now, so the proper destructor of its result is kern_unmount() or kern_unmount_array(). + +--- + +**mandatory** + +zero-length bvec segments are disallowed, they must be filtered out before +passed on to an iterator. + --- **mandatory** diff --git a/lib/iov_iter.c b/lib/iov_iter.c index d5d476faf..8819922ea 100755 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -72,8 +72,6 @@ __start.bi_bvec_done = skip; \ __start.bi_idx = 0; \ for_each_bvec(__v, i->bvec, __bi, __start) { \ - if (!__v.bv_len) \ - continue; \ (void)(STEP); \ } \ }