Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp177052imd; Wed, 31 Oct 2018 16:52:17 -0700 (PDT) X-Google-Smtp-Source: AJdET5eAN72hq8S0hOpwV7rIoFDZN7R/6LYmvcbK5cP7uJ4O6d8/3Zu9uHEFawCZqfzMGjEhNVl9 X-Received: by 2002:a63:db04:: with SMTP id e4-v6mr5058027pgg.280.1541029937617; Wed, 31 Oct 2018 16:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029937; cv=none; d=google.com; s=arc-20160816; b=tTBNPYZsjFYF1RVdvuIwI+sGJ7z0LRNuWDAbXspjwaJQNqViYmP84wN0Y31lJeSIy/ 3Fu6V5O0J3en4Tf+xXfOA0RMAlZHY7h1LPyePBzADqMavot5b0R0yQNPflSKeR052+4w 6zySh95QspqNNu7y9x9k6oeYQUvevfaOQCPGZEZeLsAIX0H3u0ZxmCm7kRewRqlV6ZoN CQJTwXwNfIFIqK3b+iDUUq+ybiVPuFE3ifGVt2Dwr2RNiu6M9rhGjwGCCNHj3a9b0Fl5 vM7F8uZ8EAlIXbW5jE2UcGplejF0nQHIs6DTd1xHJQHX0UDcm7yX0H14O2siDunC9jA8 FYDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=u7NWI0gfdz5VN+DMnJW86tTvMMxsig8AIlrLfSlymGc=; b=TKgX61QACjOm3pn4wpp87cI1F63DO9BXMEk/vn10gG7Xep5EChDTLQV+slYLdgsedA +may3invNfsOCjqw3u2M1r2o9XZZqjWLtu1cZ1lvPSAVg0Y2XovA6S1KlP9sQ3Anmyiz w6y/JvEkGApZ+gdHx2n1SdixSJPo7YOhPo/Wb5zmrIqnHWzSzIJHgz8uNEikrs8D3RlW CcLGmj4Z21utnkBQhdoNYG8wyoppv+CuXcNRgSLXwLN4421kGrEQlnm76ownyccMH6Re feo4URAOIQeDwsgX7Br4HMmRezfeTI1AgVfsOJjW6rLTO0PdyyhcI5h5PDV488VjmP27 2IQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x2i39ULR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12-v6si27928245pfi.271.2018.10.31.16.52.02; Wed, 31 Oct 2018 16:52:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x2i39ULR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbeKAIGa (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:53400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728027AbeKAIG3 (ORCPT ); Thu, 1 Nov 2018 04:06:29 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E446520838; Wed, 31 Oct 2018 23:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027178; bh=Xg6sbxXu+ozFHaqwMu2qmxQMNArdSDC4OQGg43cNYpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x2i39ULRZFJ1U+wtWuJIURptLxejU6QR+TfUfpXL9LNS3+pZA0IIv2LiRE0OZFR4R qn1ru2GcxvjAT8+xxDsaniurIscFB8dpDe0a9YiVYcaDkRdUOe59+ZN5oKXTWhStnc KKVwC7tNRI1Q1kgqWW0TbHG+heqJy3mN5wlnyGOI= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: James Smart , Christoph Hellwig , Sasha Levin Subject: [PATCH AUTOSEL 4.19 040/146] nvme: call nvme_complete_rq when nvmf_check_ready fails for mpath I/O Date: Wed, 31 Oct 2018 19:03:55 -0400 Message-Id: <20181031230541.28822-40-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 783f4a4408e1251d17f333ad56abac24dde988b9 ] When an io is rejected by nvmf_check_ready() due to validation of the controller state, the nvmf_fail_nonready_command() will normally return BLK_STS_RESOURCE to requeue and retry. However, if the controller is dying or the I/O is marked for NVMe multipath, the I/O is failed so that the controller can terminate or so that the io can be issued on a different path. Unfortunately, as this reject point is before the transport has accepted the command, blk-mq ends up completing the I/O and never calls nvme_complete_rq(), which is where multipath may preserve or re-route the I/O. The end result is, the device user ends up seeing an EIO error. Example: single path connectivity, controller is under load, and a reset is induced. An I/O is received: a) while the reset state has been set but the queues have yet to be stopped; or b) after queues are started (at end of reset) but before the reconnect has completed. The I/O finishes with an EIO status. This patch makes the following changes: - Adds the HOST_PATH_ERROR pathing status from TP4028 - Modifies the reject point such that it appears to queue successfully, but actually completes the io with the new pathing status and calls nvme_complete_rq(). - nvme_complete_rq() recognizes the new status, avoids resetting the controller (likely was already done in order to get this new status), and calls the multipather to clear the current path that errored. This allows the next command (retry or new command) to select a new path if there is one. Signed-off-by: James Smart Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/fabrics.c | 7 +++++-- drivers/nvme/host/multipath.c | 7 +++++++ include/linux/nvme.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 206d63cb1afc..bcd09d3a44da 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -552,8 +552,11 @@ blk_status_t nvmf_fail_nonready_command(struct nvme_ctrl *ctrl, ctrl->state != NVME_CTRL_DEAD && !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH)) return BLK_STS_RESOURCE; - nvme_req(rq)->status = NVME_SC_ABORT_REQ; - return BLK_STS_IOERR; + + nvme_req(rq)->status = NVME_SC_HOST_PATH_ERROR; + blk_mq_start_request(rq); + nvme_complete_rq(rq); + return BLK_STS_OK; } EXPORT_SYMBOL_GPL(nvmf_fail_nonready_command); diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 9fe3fff818b8..b71c9ad1bf45 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -77,6 +77,13 @@ void nvme_failover_req(struct request *req) queue_work(nvme_wq, &ns->ctrl->ana_work); } break; + case NVME_SC_HOST_PATH_ERROR: + /* + * Temporary transport disruption in talking to the controller. + * Try to send on a new path. + */ + nvme_mpath_clear_current_path(ns); + break; default: /* * Reset the controller for any non-ANA error as we don't know diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 68e91ef5494c..818dbe9331be 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -1241,6 +1241,7 @@ enum { NVME_SC_ANA_PERSISTENT_LOSS = 0x301, NVME_SC_ANA_INACCESSIBLE = 0x302, NVME_SC_ANA_TRANSITION = 0x303, + NVME_SC_HOST_PATH_ERROR = 0x370, NVME_SC_DNR = 0x4000, }; -- 2.17.1