Skip to content

Commit 90d0f0f

Browse files
Ming Leiaxboe
authored andcommitted
block: don't optimize for non-cloned bio in bio_get_last_bvec()
For !BIO_CLONED bio, we can use .bi_vcnt safely, but it doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1] because the start postion may have been moved in the middle of the bvec, such as splitting in the middle of bvec. Fixes: 7bcd79a(block: bio: introduce helpers to get the 1st and last bvec) Cc: stable@vger.kernel.org Reported-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent f2c1242 commit 90d0f0f

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

include/linux/bio.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,6 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv)
320320
struct bvec_iter iter = bio->bi_iter;
321321
int idx;
322322

323-
if (!bio_flagged(bio, BIO_CLONED)) {
324-
*bv = bio->bi_io_vec[bio->bi_vcnt - 1];
325-
return;
326-
}
327-
328323
if (unlikely(!bio_multiple_segments(bio))) {
329324
*bv = bio_iovec(bio);
330325
return;

0 commit comments

Comments
 (0)