On Fri, Oct 25, 2024 at 01:58:11PM +0200, Christoph Hellwig wrote: > blk_rq_map_user_bvec currently only has ad-hoc checks for queue limits, > and the last fix to it enabled valid NVMe I/O to pass, but also allowed > invalid one for drivers that set a max_segment_size or seg_boundary > limit. > > Fix it once for all by using the bio_split_rw_at helper from the I/O > path that indicates if and where a bio would be have to be split to > adhere to the queue limits, and it it returns a positive value, turn > that into -EREMOTEIO to retry using the copy path. > > Fixes: 2ff949441802 ("block: fix sanity checks in blk_rq_map_user_bvec") > Signed-off-by: Christoph Hellwig <hch@xxxxxx> This passes my test for NVMe passthrough I/O using a strict subset of a preregistered buffer (see 2ff949441802 for details). Tested-by: Uday Shankar <ushankar@xxxxxxxxxxxxxxx>