diff options
author | Ming Lei <ming.lei@canonical.com> | 2015-11-24 10:35:31 +0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-11-23 20:16:55 -0700 |
commit | 12e57f59ca3344a588531f68eeede45666e8a6e0 (patch) | |
tree | ab7fae19d98f36118ba64fd12eef25a23c47c65f /block/blk-merge.c | |
parent | 02e707424c2eadbcda68cd38876c9f4434ca8e1a (diff) | |
download | linux-12e57f59ca3344a588531f68eeede45666e8a6e0.tar.bz2 |
blk-merge: warn if figured out segment number is bigger than nr_phys_segments
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>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r-- | block/blk-merge.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index 50793cdc5331..41a55ba0d78e 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); |