Skip to content

Commit 294b2b7

Browse files
igawkeithbusch
authored andcommitted
nvme: handle connectivity loss in nvme_set_queue_count
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: 9a0be7a ("nvme: refactor set_queue_count") Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Daniel Wagner <wagi@kernel.org> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent d3d380e commit 294b2b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
16951695

16961696
status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0,
16971697
&result);
1698-
if (status < 0)
1698+
1699+
/*
1700+
* It's either a kernel error or the host observed a connection
1701+
* lost. In either case it's not possible communicate with the
1702+
* controller and thus enter the error code path.
1703+
*/
1704+
if (status < 0 || status == NVME_SC_HOST_PATH_ERROR)
16991705
return status;
17001706

17011707
/*

0 commit comments

Comments
 (0)