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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449519
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2019-03-29 01:27:14 -04:00 committed by Jim Harris
parent 27a23a33f9
commit 4cfd17a7ce

View File

@ -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)
{