[PATCH] nvmet-passthru: Cleanup nvmet_passthru_map_sg()
Christoph Hellwig
hch at lst.de
Thu Oct 15 14:01:48 EDT 2020
On Thu, Oct 15, 2020 at 10:01:30AM -0600, Logan Gunthorpe wrote:
>
>
> On 2020-10-15 1:56 a.m., Christoph Hellwig wrote:
> > On Fri, Oct 09, 2020 at 05:18:16PM -0600, Logan Gunthorpe wrote:
> >> static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
> >> {
> >> - int sg_cnt = req->sg_cnt;
> >> struct scatterlist *sg;
> >> int op_flags = 0;
> >> struct bio *bio;
> >> int i, ret;
> >>
> >> + if (req->sg_cnt > BIO_MAX_PAGES)
> >> + return -EINVAL;
> >
> > Don't you need to handle larger requests as well? Or at least
> > limit MDTS?
>
> No and Yes: there is already code in nvmet_passthru_override_id_ctrl()
> to limit MDTS based on max_segments and max_hw_sectors.
But those are entirely unrelated to the bio size. BIO_MAX_PAGES is
256, so with 4k pages and assuming none can't be merged that is 1MB,
while max_segments/max_hw_sectors could be something much larger.
More information about the Linux-nvme
mailing list