Commit d8f6e798 authored by Alex Michon's avatar Alex Michon Committed by Jim Harris
Browse files

nvme: Fix discovery loop when target has no entry



When a target returns no discovery entry, we may enter in a loop of
discovery because we don't correctly set start_genctr. So the exit
condition of the loop `ctx->start_genctr == ctx->end_genctr` is never
achieved.

Change-Id: I1fed834f6a2da1099bddcf7599408f01831288a1
Signed-off-by: default avatarAlex Michon <amichon@kalrayinc.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25457


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent ff2e6bfe
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ discovery_log_header_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
		return;
	}

	ctx->start_genctr = ctx->log_page->genctr;

	numrec = from_le64(&ctx->log_page->numrec);

	if (numrec == 0) {
@@ -102,8 +104,6 @@ discovery_log_header_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
		return;
	}

	ctx->start_genctr = ctx->log_page->genctr;

	/*
	 * Now that we know how many entries should be in the log page, we can allocate
	 * the full log page buffer.