@@ -81,8 +81,16 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
struct bio *new = NULL;
bio_for_each_segment(bv, bio, iter) {
- if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
+ if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q,
+ bio->bi_iter.bi_sector)) {
+ /*
+ * avoid to split out zero length bio if size to
+ * chunk boundary is too small
+ */
+ if (!sectors)
+ goto new_segment;
goto split;
+ }
/*
* If the queue doesn't support SG gaps and adding this