Skip to content

Commit

Permalink
blk-merge: warn if figured out segment number is bigger than nr_phys_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Ming Lei authored and axboe committed Nov 24, 2015
1 parent 02e7074 commit 12e57f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 12e57f5

Please sign in to comment.