nvmf: make sure nvmf target workable when it run as secondary porcess.
This patch do the following optimization: 1 when the nvmf target run as secondary process, the nvme probe will not call the probe callback function, which will skip the step to set up the ctx->found, so we set up it when we call attach callback. 2 when the nvmf target run as secondary process, every time when we try to probe one device, it will iterate all the attached devices and call the attach callback, for nvmf target, it will cause the overwrite of the nvme controller for the nvmf subsystem, so we need to compare the attached deivce with the device which we try to attach, if they are not the same one, just return. Change-Id: I606ba75b1dab7fd1b1e4e1cfcf63248a506725d1 Signed-off-by: cunyinch <cunyin.chang@intel.com> Reviewed-on: https://review.gerrithub.io/362807 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
54dbc8cff9
commit
f4f3bef1cc
@ -257,7 +257,10 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
struct spdk_pci_device *pci_dev;
|
||||
|
||||
spdk_pci_addr_parse(&pci_addr, trid->traddr);
|
||||
|
||||
if (ctx->trid.traddr[0] != '\0' && strcmp(trid->traddr, ctx->trid.traddr)) {
|
||||
SPDK_WARNLOG("Attached device is not expected\n");
|
||||
return;
|
||||
}
|
||||
SPDK_NOTICELOG("Attaching NVMe device %p at %s to subsystem %s\n",
|
||||
ctrlr,
|
||||
trid->traddr,
|
||||
@ -285,6 +288,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("Failed to add controller to subsystem\n");
|
||||
}
|
||||
ctx->found = true;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user