public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix q->max_segment_size checking in blk_recalc_rq_segments about VMERGE
@ 2008-07-15 10:44 FUJITA Tomonori
  2008-07-15 13:37 ` Mikulas Patocka
  0 siblings, 1 reply; 39+ messages in thread
From: FUJITA Tomonori @ 2008-07-15 10:44 UTC (permalink / raw)
  To: jens.axboe, linux-kernel
  Cc: linux-scsi, FUJITA Tomonori, Mikulas Patocka, David Miller

blk_recalc_rq_segments assumes that any segments can be merged in the
case of BIOVEC_VIRT_MERGEABLE && !BIOVEC_VIRT_OVERSIZE. However, an
IOMMU can't merge segments if the total length of the segments is
larger than max_segment_size (the LLD restriction).

Due to this bug, a LLD may get the larger number of segments than
nr_hw_segments because the block layer puts more segments in a request
than it should do.

This bug could happen on alpha, parisc, and sparc, which use VMERGE.

Like blk_hw_contig_segment() does, this patch uses hw_seg_size for
simplicity, which is a bit larger than an exact value (we don't need
BIOVEC_VIRT_START_SIZE here).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: David Miller <davem@davemloft.net>
---
 block/blk-merge.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 5efc9e7..39a22f8 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -83,7 +83,8 @@ void blk_recalc_rq_segments(struct request *rq)
 			continue;
 		}
 new_segment:
-		if (BIOVEC_VIRT_MERGEABLE(bvprv, bv) &&
+		if (hw_seg_size + bv->bv_len <= q->max_segment_size &&
+		    BIOVEC_VIRT_MERGEABLE(bvprv, bv) &&
 		    !BIOVEC_VIRT_OVERSIZE(hw_seg_size + bv->bv_len))
 			hw_seg_size += bv->bv_len;
 		else {
-- 
1.5.5.GIT


^ permalink raw reply related	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2008-07-25  5:22 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-15 10:44 [PATCH] block: fix q->max_segment_size checking in blk_recalc_rq_segments about VMERGE FUJITA Tomonori
2008-07-15 13:37 ` Mikulas Patocka
2008-07-15 14:20   ` FUJITA Tomonori
2008-07-15 14:37     ` Mikulas Patocka
2008-07-15 15:30       ` FUJITA Tomonori
2008-07-15 15:46         ` Mikulas Patocka
2008-07-16  0:34           ` FUJITA Tomonori
2008-07-16 18:02             ` Mikulas Patocka
2008-07-17  4:14               ` FUJITA Tomonori
2008-07-17 11:50                 ` Mikulas Patocka
2008-07-17 13:18                   ` FUJITA Tomonori
2008-07-17 13:27                     ` Boaz Harrosh
2008-07-17 13:56                       ` James Bottomley
2008-07-19  7:28                     ` David Miller
2008-07-20  1:45                       ` Mikulas Patocka
2008-07-20  2:17                         ` James Bottomley
2008-07-20  4:07                           ` David Miller
2008-07-20 14:52                             ` James Bottomley
2008-07-20 17:23                               ` David Miller
2008-07-20 17:33                                 ` James Bottomley
2008-07-24 15:07                                   ` Mikulas Patocka
2008-07-24 15:28                                     ` James Bottomley
2008-07-24 16:34                                       ` Mikulas Patocka
2008-07-24 16:52                                         ` James Bottomley
2008-07-24 21:49                                           ` Mikulas Patocka
2008-07-24 21:53                                             ` David Miller
2008-07-25  3:47                                               ` James Bottomley
2008-07-25  5:21                                                 ` David Miller
2008-07-25  2:26                                             ` FUJITA Tomonori
2008-07-25  2:40                                             ` [PATCH] block: fix q->max_segment_size checking in blk_recalc_rq_segments John David Anglin
2008-07-20  5:54                         ` [PATCH] block: fix q->max_segment_size checking in blk_recalc_rq_segments about VMERGE David Miller
2008-07-15 14:50     ` James Bottomley
2008-07-15 15:24       ` Mikulas Patocka
2008-07-15 15:41         ` James Bottomley
2008-07-15 15:58           ` Mikulas Patocka
2008-07-15 16:07             ` James Bottomley
2008-07-15 16:20               ` Mikulas Patocka
2008-07-15 16:36                 ` James Bottomley
2008-07-15 21:50                   ` Mikulas Patocka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox