Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp877241pxk; Thu, 17 Sep 2020 20:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVvU5OEBHsiPBucWjO8JK5vm2VgyCFzR4pLkntAL9ZLGnAxl0D7n9itubwWTZ26z33Bpmd X-Received: by 2002:a17:906:4e54:: with SMTP id g20mr34998459ejw.252.1600398304879; Thu, 17 Sep 2020 20:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398304; cv=none; d=google.com; s=arc-20160816; b=NXoUReqpjyT8f5uvvtEsUO8S8fLQKlOj2YlwATFwhJp3qKYlHYJh7+5FyGc97nwdD0 nbEnSeZAejtAJ7cd310fs1hxnS7573chyZJ2QDUuXuL+ovI7osE0DOBm6Nljb9P8XJJT E0cI/f4M5fVHt18nG3DF+Zg5XwO68rWXs+CttLhBCFRHw94ZliMvZ7odc96ElU2+SYWz a8LgvyaJVfxZ+Nu0PQk9skn/ekAL7xj1WR03W/cBJaKyB43XphVicRbYyKCg0Iu8lRJT bSarZsOVjKwq/8WfmE+YVnOgf9JfvO+DdFxLTPct/BVGmuIaeGyMAztteXU7j563jlmp qbgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lSbJhaR4i/6GxCuT3I4j8g2AgdFJOV6BLtk8hU18Ut4=; b=RKzsfkQH1YIs3IqHukBdH5KDHhUwCUq69QPBj7l4p5729Mjy/DjU6oMmTSvRazPQgu aFGmperx6Z6PsB7DYYNTQY/mDgHIOEey9yUOZ6IU5rlc/ODNONBV80Zf2vQdJfiaFD9k 3K3g4rJwYWlreyS43hSaG7hWtgU81h3SkAED4BDhj5d8w8LiMjYrXW7aZArVHVzjMvkN PloYsQtbISrViSmsAp2awZlQSRJppnkEtHui2B5Gla+HA2crl+liOdDcJFl8JugEKLmw /7kjCeRukECAtWaA5+VGNQlFCLNKwuU8BS+ByX1WlJyp4eTXVXpDU8yBQqmnKtcqnvLr QHJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rhyCJxHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id nr22si1232996ejb.535.2020.09.17.20.04.40; Thu, 17 Sep 2020 20:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rhyCJxHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730247AbgIRDCf (ORCPT + 99 others); Thu, 17 Sep 2020 23:02:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727524AbgIRCFW (ORCPT ); Thu, 17 Sep 2020 22:05:22 -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 D1898238E3; Fri, 18 Sep 2020 02:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394721; bh=qS/Xbq0Jpq56JcCfjAFHKQ6K9SV18Q3CkH5HI7LzysE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rhyCJxHWMCbVx3Db4o3e5wCVJ5bi8S/2OkhuoboyLcHegzpLsLGYHMjFQGzdJ3i3H J438xaOfGZPcdCdJqQRU1Njub3Kn9r10weOMq93w6zCJdaMaY01sVwNVZcxVHFvmhh UdrHQnOQbswCUGtRPKVgayWuYIHJDS6I9FSKaAZk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: John Meneghini , Christoph Hellwig , Hannes Reinecke , Keith Busch , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 205/330] nvme-multipath: do not reset on unknown status Date: Thu, 17 Sep 2020 21:59:05 -0400 Message-Id: <20200918020110.2063155-205-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Meneghini [ Upstream commit 764e9332098c0e60251386a507fe46ac91276120 ] The nvme multipath error handling defaults to controller reset if the error is unknown. There are, however, no existing nvme status codes that indicate a reset should be used, and resetting causes unnecessary disruption to the rest of IO. Change nvme's error handling to first check if failover should happen. If not, let the normal error handling take over rather than reset the controller. Based-on-a-patch-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: John Meneghini Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 5 +---- drivers/nvme/host/multipath.c | 21 +++++++++------------ drivers/nvme/host/nvme.h | 5 +++-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 3cb017fa3a790..05688fa579e81 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -288,11 +288,8 @@ void nvme_complete_rq(struct request *req) nvme_req(req)->ctrl->comp_seen = true; if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) { - if ((req->cmd_flags & REQ_NVME_MPATH) && - blk_path_error(status)) { - nvme_failover_req(req); + if ((req->cmd_flags & REQ_NVME_MPATH) && nvme_failover_req(req)) return; - } if (!blk_queue_dying(req->q)) { nvme_retry_req(req); diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 0a458f7880887..3968f89f7855a 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -65,17 +65,12 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, } } -void nvme_failover_req(struct request *req) +bool nvme_failover_req(struct request *req) { struct nvme_ns *ns = req->q->queuedata; u16 status = nvme_req(req)->status; unsigned long flags; - spin_lock_irqsave(&ns->head->requeue_lock, flags); - blk_steal_bios(&ns->head->requeue_list, req); - spin_unlock_irqrestore(&ns->head->requeue_lock, flags); - blk_mq_end_request(req, 0); - switch (status & 0x7ff) { case NVME_SC_ANA_TRANSITION: case NVME_SC_ANA_INACCESSIBLE: @@ -104,15 +99,17 @@ void nvme_failover_req(struct request *req) nvme_mpath_clear_current_path(ns); break; default: - /* - * Reset the controller for any non-ANA error as we don't know - * what caused the error. - */ - nvme_reset_ctrl(ns->ctrl); - break; + /* This was a non-ANA error so follow the normal error path. */ + return false; } + spin_lock_irqsave(&ns->head->requeue_lock, flags); + blk_steal_bios(&ns->head->requeue_list, req); + spin_unlock_irqrestore(&ns->head->requeue_lock, flags); + blk_mq_end_request(req, 0); + kblockd_schedule_work(&ns->head->requeue_work); + return true; } void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 056953bd8bd81..80bfffa943ccd 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -530,7 +530,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); void nvme_mpath_start_freeze(struct nvme_subsystem *subsys); void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, struct nvme_ctrl *ctrl, int *flags); -void nvme_failover_req(struct request *req); +bool nvme_failover_req(struct request *req); void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head); void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id); @@ -579,8 +579,9 @@ static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance); } -static inline void nvme_failover_req(struct request *req) +static inline bool nvme_failover_req(struct request *req) { + return false; } static inline void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) { -- 2.25.1