Commit 36ac9cf7 authored by Daniel Wagner's avatar Daniel Wagner Committed by Jingtong Meng
Browse files

nvme: handle connectivity loss in nvme_set_queue_count

stable inclusion
from stable-v6.6.78
commit 79578630329597434a3ca53bbdbc614a8172bb5d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBS4SF

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=79578630329597434a3ca53bbdbc614a8172bb5d



--------------------------------

[ 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: 9a0be7ab ("nvme: refactor set_queue_count")
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarDaniel Wagner <wagi@kernel.org>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJingtong Meng <jingtong.meng@windriver.com>
parent 4dc72d8d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1553,7 +1553,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;

	/*