Commit 7552ee55 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf_tgt: fail if NVMe controller is not found



For subsystems in Direct mode, make sure the NVMe controller specified
is actually located during the probe call.

Change-Id: I7d5212ea628eadba3e720172a5ead8902eaaf6d0
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 53ec54c9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ probe_cb(void *cb_ctx, struct spdk_pci_device *dev, struct spdk_nvme_ctrlr_opts
	    found_dev == ctx->device &&
	    found_func == ctx->function) {
		if (!spdk_pci_device_has_non_uio_driver(dev)) {
			ctx->found = true;
			return true;
		}
		SPDK_ERRLOG("Requested device is still bound to the kernel. Unbind your NVMe devices first.\n");
@@ -473,6 +474,11 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
		if (spdk_nvme_probe(&ctx, probe_cb, attach_cb, NULL)) {
			SPDK_ERRLOG("One or more controllers failed in spdk_nvme_probe()\n");
		}

		if (!ctx.found) {
			SPDK_ERRLOG("Could not find NVMe controller for Subsystem%d\n", sp->num);
			return -1;
		}
	} else {
		struct spdk_bdev *bdev;
		const char *namespace, *sn, *val;