Current file backed ns code uses request data length to compute number of io vector.
This way is actually wrong, the warning in nvmet_file_execute_io() may be triggered because the sg->offset isn't considered.
Given the sg list is only single-page for nvme target, simply use the req->sg_cnt as number of io vector.
Reported-by: Yi Zhang yi.zhang@redhat.com Fixes: d5eff33ee6f8("nvmet: add simple file backed ns support") Cc: Yi Zhang yi.zhang@redhat.com Cc: Sagi Grimberg sagi@grimberg.me Cc: Chaitanya Kulkarni chaitanya.kulkarni@wdc.com Cc: stable@vger.kernel.org Signed-off-by: Ming Lei ming.lei@redhat.com --- drivers/nvme/target/io-cmd-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index 3e43212d3c1c..d67a43832cb1 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -128,7 +128,7 @@ static void nvmet_file_io_done(struct kiocb *iocb, long ret, long ret2)
static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags) { - ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE); + ssize_t nr_bvec = req->sg_cnt; struct sg_page_iter sg_pg_iter; unsigned long bv_cnt = 0; bool is_sync = false; @@ -225,7 +225,7 @@ static void nvmet_file_submit_buffered_io(struct nvmet_req *req)
static void nvmet_file_execute_rw(struct nvmet_req *req) { - ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE); + ssize_t nr_bvec = req->sg_cnt;
if (!req->sg_cnt || !nr_bvec) { nvmet_req_complete(req, 0);
I'd rather see this merged with the last one (and patch 3 dropped as it just gets removed entirely in 4) - that fixes all the issues together and doesn't require your patch 1 as as a workaround first.
On Tue, Mar 26, 2019 at 3:38 PM Christoph Hellwig hch@lst.de wrote:
I'd rather see this merged with the last one (and patch 3 dropped as it just gets removed entirely in 4) - that fixes all the issues together and doesn't require your patch 1 as as a workaround first.
Patch 1 isn't a workaround, which is needed for stable tree, and the other fixes won't work without patch 1.
However, we may revert patch 1 for 5.1 in which multi-page bvec is supported.
I am fine to merge the last three in one patch since the backporting isn't too hard for me, :-) However I guess our stable guys may prefer to simpler fix.
Thanks, Ming Lei
On Tue, Mar 26, 2019 at 03:50:01PM +0800, Ming Lei wrote:
On Tue, Mar 26, 2019 at 3:38 PM Christoph Hellwig hch@lst.de wrote:
I'd rather see this merged with the last one (and patch 3 dropped as it just gets removed entirely in 4) - that fixes all the issues together and doesn't require your patch 1 as as a workaround first.
Patch 1 isn't a workaround, which is needed for stable tree, and the other fixes won't work without patch 1.
However, we may revert patch 1 for 5.1 in which multi-page bvec is supported.
Lets do it another way around - put the proper fix into 5.1-rc and only apply patch 1 for stable. No need to put something in and immediately revert it.
linux-stable-mirror@lists.linaro.org