Commit 4cfd17a7 authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

examples/nvme: hot added drive cannot be attached



When test hotplug, the timeout callback will set the attach callback
to NULL, so it will not add the drive back to hotplug tool automatically
sometimes.

Change-Id: I91a7c29059a7f680b2a0b7b79cf0a62c5638dcda
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449519


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 27a23a33
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -79,13 +79,7 @@ task_complete(struct perf_task *task);

static void
timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
	   struct spdk_nvme_qpair *qpair, uint16_t cid)
{
	/* leave hotplug monitor loop, use the timeout_cb to monitor the hotplug */
	if (spdk_nvme_probe(NULL, NULL, NULL, NULL, NULL) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
	}
}
	   struct spdk_nvme_qpair *qpair, uint16_t cid);

static void
register_dev(struct spdk_nvme_ctrlr *ctrlr)
@@ -328,6 +322,16 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
	spdk_nvme_detach(ctrlr);
}

static void
timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
	   struct spdk_nvme_qpair *qpair, uint16_t cid)
{
	/* leave hotplug monitor loop, use the timeout_cb to monitor the hotplug */
	if (spdk_nvme_probe(NULL, NULL, probe_cb, attach_cb, remove_cb) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
	}
}

static void
io_loop(void)
{