From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02571241693; Thu, 13 Feb 2025 14:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739457401; cv=none; b=Zh3rF0bPDMYf6yeftXm5yHUKKGDGO13ng5XftPRdfUUl8y5o24ZNuehDCbSFP4MLlOBkk5YP+EpnrF3D96vyz8UTl1BVdinGrWLwZLrHpQX3OkrR6ZC/7co5MIwFdJ1urxzmPfWrtWxd0L/8zWBf/2D+04d1DsE2fbMwi7P/pRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739457401; c=relaxed/simple; bh=JrtN25jAMAydX/BxwPIZ7osn3nhifvYzGeO0KuOQZgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VBz94J3v/vsJV1V9ahOVJBbvhWSbDjuntJQoaTOtSIRtVQyqIE1k7Ld3/tqvZa8cyvhNyEVDP+MR7DbSFA3yrKam4gVSiAXZZyddgzBrCbdor1SgjJ+Poyflz5pDXpwwGBw0aPnbf77AHOpLTDJL516VYMdLwQ2jR8nzvpS/Uas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=okm+md7Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="okm+md7Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B63C4CED1; Thu, 13 Feb 2025 14:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739457400; bh=JrtN25jAMAydX/BxwPIZ7osn3nhifvYzGeO0KuOQZgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=okm+md7ZxAL0e31YYWw8yLqaf5uDSMWOQo3GHOQpwWbzUteOBrWrm2jmQpaDqD/Fh uBElGzqDfH4nMfp4nIEtYfUit7+8H6zTwDmEhgXhvdSDNj6bxik4f+JTd77LuZMdah wFLDCN5SP2eWeF7GXXnlN54VuveJP+kNi5Xz8ftk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Hannes Reinecke , Sagi Grimberg , Daniel Wagner , Keith Busch , Sasha Levin Subject: [PATCH 6.12 100/422] nvme: handle connectivity loss in nvme_set_queue_count Date: Thu, 13 Feb 2025 15:24:09 +0100 Message-ID: <20250213142440.416286045@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142436.408121546@linuxfoundation.org> References: <20250213142436.408121546@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Wagner [ Upstream commit 294b2b7516fd06a8dd82e4a6118f318ec521e706 ] When the set feature attempts fails with any NVME status code set in nvme_set_queue_count, the function still report success. Though the numbers of queues set to 0. This is done to support controllers in degraded state (the admin queue is still up and running but no IO queues). Though there is an exception. When nvme_set_features reports an host path error, nvme_set_queue_count should propagate this error as the connectivity is lost, which means also the admin queue is not working anymore. Fixes: 9a0be7abb62f ("nvme: refactor set_queue_count") Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Signed-off-by: Daniel Wagner Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 4c409efd8cec1..8da50df56b079 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1691,7 +1691,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0, &result); - if (status < 0) + + /* + * It's either a kernel error or the host observed a connection + * lost. In either case it's not possible communicate with the + * controller and thus enter the error code path. + */ + if (status < 0 || status == NVME_SC_HOST_PATH_ERROR) return status; /* -- 2.39.5