Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1276028

[PATCH 3/3] blk-merge: warn if figured out segment number is bigger than nr_phys_segments

From Ming Lei <ming.lei@canonical.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] blk-merge: warn if figured out segment number is bigger than nr_phys_segments
Date 2015-11-24 03:40 +0100
Message-ID <qybGq-1Y4-15@gated-at.bofh.it> (permalink)
References <qybGp-1Y4-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We had seen lots of reports of this kind issue, so add one
warnning in blk-merge, then it can be triggered easily and
avoid to depend on warning/bug from drivers.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 block/blk-merge.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 50793cd..41a55ba 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -428,6 +428,12 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
 	if (sg)
 		sg_mark_end(sg);
 
+	/*
+	 * Something must have been wrong if the figured number of
+	 * segment is bigger than number of req's physical segments
+	 */
+	WARN_ON(nsegs > rq->nr_phys_segments);
+
 	return nsegs;
 }
 EXPORT_SYMBOL(blk_rq_map_sg);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] blk-merge: fix sg merge regression Ming Lei <ming.lei@canonical.com> - 2015-11-24 03:40 +0100
  [PATCH 2/3] blk-merge: fix blk_bio_segment_split Ming Lei <ming.lei@canonical.com> - 2015-11-24 03:40 +0100
  [PATCH 1/3] block: fix segment split Ming Lei <ming.lei@canonical.com> - 2015-11-24 03:40 +0100
  [PATCH 3/3] blk-merge: warn if figured out segment number is bigger than nr_phys_segments Ming Lei <ming.lei@canonical.com> - 2015-11-24 03:40 +0100
  Re: [PATCH 0/3] blk-merge: fix sg merge regression Jens Axboe <axboe@kernel.dk> - 2015-11-24 04:20 +0100

csiph-web