bdev/compress: Fix error paths in vbdev_reduce_load_cb()

Error paths were not implemented correctly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I419338a717209b6bb1de3979a9b53dc7f076276a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-03-26 10:04:15 +09:00 committed by Tomasz Zawadzki
parent 3934784dbc
commit 99e6fe4102

View File

@ -1760,9 +1760,7 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
SPDK_ERRLOG("for vol %s, error %u\n",
spdk_bdev_get_name(meta_ctx->base_bdev), reduce_errno);
}
free(meta_ctx);
spdk_bdev_module_examine_done(&compress_if);
return;
goto err;
}
/* this status means that the vol could not be loaded because
@ -1780,6 +1778,7 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
meta_ctx->base_bdev, &meta_ctx->base_desc);
if (rc) {
SPDK_ERRLOG("could not open bdev %s\n", spdk_bdev_get_name(meta_ctx->base_bdev));
free(meta_ctx->comp_bdev.name);
goto err;
}
@ -1792,21 +1791,20 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
meta_ctx->comp_bdev.module);
if (rc) {
SPDK_ERRLOG("could not claim bdev %s\n", spdk_bdev_get_name(meta_ctx->base_bdev));
spdk_bdev_close(meta_ctx->base_desc);
free(meta_ctx->comp_bdev.name);
goto err;
}
meta_ctx->orphaned = true;
TAILQ_INSERT_TAIL(&g_vbdev_comp, meta_ctx, link);
err:
spdk_bdev_module_examine_done(&compress_if);
return;
}
if (_set_pmd(meta_ctx) == false) {
SPDK_ERRLOG("could not find required pmd\n");
free(meta_ctx);
spdk_bdev_module_examine_done(&compress_if);
return;
goto err;
}
/* Update information following volume load. */
@ -1815,6 +1813,10 @@ err:
sizeof(struct spdk_reduce_vol_params));
vbdev_compress_claim(meta_ctx);
spdk_bdev_module_examine_done(&compress_if);
return;
err:
free(meta_ctx);
spdk_bdev_module_examine_done(&compress_if);
}
/* Examine_disk entry point: will do a metadata load to see if this is ours,