]> www.infradead.org Git - nvme.git/commitdiff
nvme: handle connectivity loss in nvme_set_queue_count
authorDaniel Wagner <wagi@kernel.org>
Thu, 9 Jan 2025 13:30:48 +0000 (14:30 +0100)
committerKeith Busch <kbusch@kernel.org>
Thu, 23 Jan 2025 18:04:26 +0000 (10:04 -0800)
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 <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>
drivers/nvme/host/core.c

index 0d21258e22833369ff218e6bf1138588edf8f0da..2bcd9f710cb65fe21afa04d4af73773293a66aad 100644 (file)
@@ -1695,7 +1695,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;
 
        /*