Commit fc3e26a5 authored by Michael Piszczek's avatar Michael Piszczek Committed by Tomasz Zawadzki
Browse files

nvmf: Ignore missing persistent reservation file



It is not a error if the file does not exist.  This adds back the check
that was previously removed.
Also fixes typo (persist).

Fixes issue #3427

Change-Id: I2c40fb7f6eea17072e5825309af92bfc4d79ea7f
Signed-off-by: default avatarMichael Piszczek <mpiszczek@ddn.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24073


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 076ae917
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2555,10 +2555,16 @@ nvmf_ns_reservation_load_json(const struct spdk_nvmf_ns *ns,
	const char *file = ns->ptpl_file;
	uint32_t i;

	/* It's not an error if the file does not exist */
	if (access(file, F_OK) != 0) {
		SPDK_DEBUGLOG(nvmf, "File %s does not exist\n", file);
		return 0;
	}

	/* Load all persist file contents into a local buffer */
	json = spdk_posix_file_load_from_name(file, &json_size);
	if (!json) {
		SPDK_ERRLOG("Load persit file %s failed\n", file);
		SPDK_ERRLOG("Load persist file %s failed\n", file);
		return -ENOMEM;
	}