From nobody Tue Dec 16 23:57:28 2025 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 EBF73219A75 for ; Thu, 9 Jan 2025 13:31:05 +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=1736429466; cv=none; b=Fqi9vaorwZdzhNaw3KMxvOEh2iA5xo7yrE6EBfWruovLMdN8Mj+2OaRFZmpa3t3DlC9mGKPA/4MrkJqmkdnVqFLmgES57udqNcNMXb80yYKdSQ30IaL0+qavGBjZ94a2D5NFAbJijTP3h247O+eKoAa3jYK+PyhvcR10PO8tEwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736429466; c=relaxed/simple; bh=nIScwi2DSPh0GvWAvF2mKHT9Nt5wUZKyiIzlhzVSW4w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h3EkhDhJFICPdx1hIpY1CW+BCVN6UlVIr6Z1hY1YWvY5r0aJL+r+D5xJWa1B3SlcUadPCtXY4iaTDD2NZsLDqBYic7YU6pYYJFVkB91qSqT+d4ypcBwJzwiDa8KeeRSZV1mc+Vf0rE9AcqN13r+d63SVnFfrVcK3kxdiQ1QMZWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GPfLd0KS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GPfLd0KS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DCCC4CED2; Thu, 9 Jan 2025 13:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736429465; bh=nIScwi2DSPh0GvWAvF2mKHT9Nt5wUZKyiIzlhzVSW4w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GPfLd0KSyXPP1kHLy8IabfOv4yfiatJSpxe8jGY8lOKORHtVPEvW/nSWWzf+gOJIj AJehwktHVNsNZk/Hpff24v/vRdmA2nYG/fLeSTuqA6YaYDKU/V2fjMB5l79wNvhhpE wLDCpE+L/DlI/ioi/zc4JL+PLXYyOHIMi3xD/YHT525YTvbB4/QEp83+UwPpxM3Kcq sghV7I2w2ruuxRe3VaoRbxaK/8PY0QWpIb1YwNzdbteNtOGykWQp0s1zJNFNiY1sq1 1Dkz1U9qW8wiRHCFT1IZ584qvx6I2defb2NOTovikfN0dI5B2vBr4ucRgw74QpgV4A 2FFZckyXoJnRw== From: Daniel Wagner Date: Thu, 09 Jan 2025 14:30:48 +0100 Subject: [PATCH v4 2/3] nvme: handle connectivity loss in nvme_set_queue_count Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250109-nvme-fc-handle-com-lost-v4-2-fe5cae17b492@kernel.org> References: <20250109-nvme-fc-handle-com-lost-v4-0-fe5cae17b492@kernel.org> In-Reply-To: <20250109-nvme-fc-handle-com-lost-v4-0-fe5cae17b492@kernel.org> To: James Smart , Keith Busch , Christoph Hellwig , Sagi Grimberg , Hannes Reinecke , Paul Ely Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner X-Mailer: b4 0.14.2 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 --- 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 b72b0e06801490f2c14e7fa09a45a870045a221d..a08ff8b362d0b7bd1a8a343e26d= 564b089c6bad3 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1695,7 +1695,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int= *count) =20 status =3D 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 =3D=3D NVME_SC_HOST_PATH_ERROR) return status; =20 /* --=20 2.47.1