Commit 0773385e authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Tomasz Zawadzki
Browse files

nvmf: don't ignore reservation load errors



Also, change the return value of nvmf_ns_reservation_load_json() in case
the file doesn't exist. It is not a error, as already stated in a
comment in the function, and was only non-zero to skip
nvmf_ns_reservation_restore(). It is safe to call
nvmf_ns_reservation_restore() in this case, because the info struct is
empty so nothing will be restored.

Suggested-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I114f8db97aa5ce9e2c5c87b8b077b2d980464289
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21489


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 09e8e884
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -1858,14 +1858,17 @@ spdk_nvmf_subsystem_add_ns_ext(struct spdk_nvmf_subsystem *subsystem, const char

	if (nvmf_ns_is_ptpl_capable(ns)) {
		rc = nvmf_ns_reservation_load(ns, &info);
		if (!rc) {
		if (rc) {
			SPDK_ERRLOG("Subsystem load reservation failed\n");
			goto err;
		}

		rc = nvmf_ns_reservation_restore(ns, &info);
		if (rc) {
			SPDK_ERRLOG("Subsystem restore reservation failed\n");
			goto err;
		}
	}
	}

	for (transport = spdk_nvmf_transport_get_first(subsystem->tgt); transport;
	     transport = spdk_nvmf_transport_get_next(transport)) {
@@ -2235,7 +2238,7 @@ nvmf_ns_reservation_load_json(const struct spdk_nvmf_ns *ns,
	/* It's not an error if the file does not exist */
	if (!fd) {
		SPDK_NOTICELOG("File %s does not exist\n", file);
		return -ENOENT;
		return 0;
	}

	/* Load all persist file contents into a local buffer */