blobfs: return error to caller when loading a bs which isn't blobfs

Also release the IO channels with filesystem data structure.

Change-Id: I75a5d427fe4837ad7d85444d09ded9ab41e0ca8e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464851
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2019-08-12 04:12:43 -04:00 committed by Ben Walker
parent 62202dda32
commit 5adac19ad0

View File

@ -761,7 +761,8 @@ load_cb(void *ctx, struct spdk_blob_store *bs, int bserrno)
if (bserrno != 0) {
args->fn.fs_op_with_handle(args->arg, NULL, bserrno);
free_fs_request(req);
free(fs);
spdk_fs_free_io_channels(fs);
spdk_fs_io_device_unregister(fs);
return;
}
@ -771,11 +772,12 @@ load_cb(void *ctx, struct spdk_blob_store *bs, int bserrno)
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "assigning bstype\n");
spdk_bs_set_bstype(bs, blobfs_type);
} else if (memcmp(&bstype, &blobfs_type, sizeof(bstype))) {
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "not blobfs\n");
SPDK_ERRLOG("not blobfs\n");
SPDK_LOGDUMP(SPDK_LOG_BLOB, "bstype", &bstype, sizeof(bstype));
args->fn.fs_op_with_handle(args->arg, NULL, bserrno);
args->fn.fs_op_with_handle(args->arg, NULL, -EINVAL);
free_fs_request(req);
free(fs);
spdk_fs_free_io_channels(fs);
spdk_fs_io_device_unregister(fs);
return;
}