From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03D69C43381 for ; Tue, 2 Apr 2019 01:56:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7C2220880 for ; Tue, 2 Apr 2019 01:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbfDBB4V (ORCPT ); Mon, 1 Apr 2019 21:56:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51082 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfDBB4U (ORCPT ); Mon, 1 Apr 2019 21:56:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF78F307EA92; Tue, 2 Apr 2019 01:56:20 +0000 (UTC) Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B654C5D780; Tue, 2 Apr 2019 01:56:15 +0000 (UTC) From: Ming Lei To: linux-nvme@lists.infradead.org, Christoph Hellwig Cc: Ming Lei , Yi Zhang , Sagi Grimberg , Chaitanya Kulkarni , stable@vger.kernel.org Subject: [RESEND PATCH stable only] nvmet: set loop queue's segment boundary mask as PAGE_SIZE - 1 Date: Tue, 2 Apr 2019 09:56:10 +0800 Message-Id: <20190402015610.26320-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 02 Apr 2019 01:56:20 +0000 (UTC) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 following NVMe target assumption. Multi-page bvec has been merged to v5.1-rc1, so commit 02db99548d36 ("nvmet: fix building bvec from sg list") can fix the current issue simply without needing to limit the segment size for nvme-loop. Reported-by: Yi Zhang Fixes: 3a85a5de29ea ("nvme-loop: add a NVMe loopback host driver") Cc: Yi Zhang Cc: Sagi Grimberg Cc: Chaitanya Kulkarni Cc: Signed-off-by: Ming Lei --- 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: -- 2.9.5