NVMe target only accepts single-page sg list, either file or block device backed target code follows this assumption.
However, loop target is one exception, given the sg list is from the host queue directly.
This patch sets loop queue's segment boundary mask as PAGE_SIZE - 1 for folowoing NVMe target assumption.
Reported-by: Yi Zhang yi.zhang@redhat.com Fixes: 3a85a5de29ea ("nvme-loop: add a NVMe loopback host driver") 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/loop.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index b9f623ab01f3..7194f86b9dac 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -549,6 +549,9 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) if (ret) goto out_cleanup_connect_q;
+ /* target only accepts single-page sg list */ + blk_queue_segment_boundary(ctrl->ctrl.connect_q, PAGE_SIZE - 1); + return 0;
out_cleanup_connect_q:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
On Tue, Mar 26, 2019 at 3:36 PM Christoph Hellwig hch@lst.de wrote:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
block device backed ns still needs this patch.
thanks, Ming Lei
On Tue, Mar 26, 2019 at 3:37 PM Ming Lei tom.leiming@gmail.com wrote:
On Tue, Mar 26, 2019 at 3:36 PM Christoph Hellwig hch@lst.de wrote:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
block device backed ns still needs this patch.
Also both the 2nd & 3rd fixes depend on this patch too.
Thanks, Ming Lei
On Tue, Mar 26, 2019 at 03:37:36PM +0800, Ming Lei wrote:
On Tue, Mar 26, 2019 at 3:36 PM Christoph Hellwig hch@lst.de wrote:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
block device backed ns still needs this patch.
Then we need to fix that code as well. Or even better make bio_add_page handle the larger than page case fine if it really doesn't do that yet.
On Wed, Mar 27, 2019 at 4:15 PM Christoph Hellwig hch@lst.de wrote:
On Tue, Mar 26, 2019 at 03:37:36PM +0800, Ming Lei wrote:
On Tue, Mar 26, 2019 at 3:36 PM Christoph Hellwig hch@lst.de wrote:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
block device backed ns still needs this patch.
Then we need to fix that code as well. Or even better make bio_add_page handle the larger than page case fine if it really doesn't do that yet.
Given loop is the only exception, this patch is exactly the fix, right?
Thanks, Ming Lei
On Wed, Mar 27, 2019 at 04:26:26PM +0800, Ming Lei wrote:
On Wed, Mar 27, 2019 at 4:15 PM Christoph Hellwig hch@lst.de wrote:
On Tue, Mar 26, 2019 at 03:37:36PM +0800, Ming Lei wrote:
On Tue, Mar 26, 2019 at 3:36 PM Christoph Hellwig hch@lst.de wrote:
Note that in many cases allocating larger pages in the other targets would be useful. Given that you fix the one places where we made a page size assumption I don't see a great need to limit outselves here.
block device backed ns still needs this patch.
Then we need to fix that code as well. Or even better make bio_add_page handle the larger than page case fine if it really doesn't do that yet.
Given loop is the only exception, this patch is exactly the fix, right?
Well, we want to be able to pass multi-page biovecs everywhere, so I think we'd just solve this based on loop so that we can later take advantage of it everywhere.
linux-stable-mirror@lists.linaro.org