Commit 20f78694 authored by Ankit Kumar's avatar Ankit Kumar Committed by Jim Harris
Browse files

bdev/nvme: fix current value for non-optimized paths in active-passive



When there are no optimized paths in active-passive, the existing code
shows current=false for all paths. The first available io_path is the
current in this case. Report current=true for that io_path.

Set current value as true for non-optimized path in non-optimized
inaccessible test case.

Change-Id: I901ed3866ca93b3026c77b3ec91748cd5f63ba17
Signed-off-by: default avatarAnkit Kumar <ankit.kumar@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23048


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 9b8579e4
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -8558,7 +8558,22 @@ nvme_io_path_info_json(struct spdk_json_write_ctx *w, struct nvme_io_path *io_pa
			current = current && (optimized_io_path == NULL);
		}
	} else {
		if (nbdev_ch->current_io_path) {
			current = (io_path == nbdev_ch->current_io_path);
		} else {
			struct nvme_io_path *first_path;

			/* We arrived here as there are no optimized paths for active-passive
			 * mode. Check if this io_path is the first one available on the list.
			 */
			current = false;
			STAILQ_FOREACH(first_path, &nbdev_ch->io_path_list, stailq) {
				if (nvme_io_path_is_available(first_path)) {
					current = (io_path == first_path);
					break;
				}
			}
		}
	}
	spdk_json_write_named_bool(w, "current", current);
	spdk_json_write_named_bool(w, "connected", nvme_qpair_is_connected(io_path->qpair));
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ check_status false true true true true true

set_ANA_state non_optimized inaccessible
sleep 1
check_status false false true true true false
check_status true false true true true false

set_ANA_state inaccessible inaccessible
sleep 1