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 2D29725F798; Tue, 11 Mar 2025 15:27:09 +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=1741706829; cv=none; b=Qmf33ZvqnkLTsG3dGAB0D9zPAY3i6qey7HJ6eYPHdLws0KbJ4/68DB1a/dLYOrJ7l3ug5A63vegq+Tk0ufWEVc23WkkDywK6qbfZGUAsJMk8utd/3BFdjl8kNxL8oTLsTmLS6a8JuH972mjFFMxbol8lswR9FWohwu2RpOKy/As= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706829; c=relaxed/simple; bh=v0MjPKoUin3oJjIXWBLSg0y/VEy+wCzM3EDxtSSilo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=guSR5712/+cWtd7O/LEI+Jr+wqhnpAJdVwnkJD32XdRhUmkd5W+vJoKK9iqlqOT0Q23KDjjgnqTJBz6EeJvYmDfUjPAkEE1NtCClyIgF+bkbMJxp6DajUK7CZzxKB888nYudNUVSUFwQR6Ia6EJgfmAlZ1kYotwEd0WDYgxCzys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fT9regvb; 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="fT9regvb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A805CC4CEE9; Tue, 11 Mar 2025 15:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741706829; bh=v0MjPKoUin3oJjIXWBLSg0y/VEy+wCzM3EDxtSSilo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fT9regvbC61X0eW9BRFfxRGgOUm7BKxPT9EcVP247IJVKslSxSReQoTb9vspBocAK ycIpeCRu9paFJDOWf4XxAxKEfUmLGaM7VDsv4XvTH4IgJcrhhSGzd9qNjnNGl6o54l QGxGSaV4E39D1C8Kl4Ze4lqtYjqYVKBmwqjVLitU= 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 5.10 151/462] nvme: handle connectivity loss in nvme_set_queue_count Date: Tue, 11 Mar 2025 15:56:57 +0100 Message-ID: <20250311145804.315974585@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311145758.343076290@linuxfoundation.org> References: <20250311145758.343076290@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 5.10-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 f988a5e3f0e15..019a6dbdcbc28 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1491,7 +1491,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