Skip to content

Commit 12e57f5

Browse files
Ming Leiaxboe
authored andcommitted
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>
1 parent 02e7074 commit 12e57f5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

block/blk-merge.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
428428
if (sg)
429429
sg_mark_end(sg);
430430

431+
/*
432+
* Something must have been wrong if the figured number of
433+
* segment is bigger than number of req's physical segments
434+
*/
435+
WARN_ON(nsegs > rq->nr_phys_segments);
436+
431437
return nsegs;
432438
}
433439
EXPORT_SYMBOL(blk_rq_map_sg);

0 commit comments

Comments
 (0)