From 741abc3c8b08f30a43a0133eac9df40c48a5750e Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Fri, 16 Apr 2021 23:57:24 +0800 Subject: [PATCH] bdev/rbd: Add the missing "rados_shutdown" call. Add the missing rados_shutdown call in bdev_rbd_init function. Signed-off-by: Ziye Yang Change-Id: I0222d2453d1547cfd735f15237eca124cbc23479 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7430 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu Reviewed-by: --- module/bdev/rbd/bdev_rbd.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/module/bdev/rbd/bdev_rbd.c b/module/bdev/rbd/bdev_rbd.c index 5449c269a..c44be7607 100644 --- a/module/bdev/rbd/bdev_rbd.c +++ b/module/bdev/rbd/bdev_rbd.c @@ -191,7 +191,7 @@ static int bdev_rbd_init(const char *user_id, const char *rbd_pool_name, const char *const *config, const char *rbd_name, rbd_image_info_t *info) { - int ret; + int ret = 0; rados_t cluster = NULL; rados_ioctx_t io_ctx = NULL; rbd_image_t image = NULL; @@ -206,21 +206,18 @@ bdev_rbd_init(const char *user_id, const char *rbd_pool_name, const char *const ret = rbd_open(io_ctx, rbd_name, &image, NULL); if (ret < 0) { SPDK_ERRLOG("Failed to open specified rbd device\n"); - goto err; + goto end; } ret = rbd_stat(image, info, sizeof(*info)); rbd_close(image); if (ret < 0) { SPDK_ERRLOG("Failed to stat specified rbd device\n"); - goto err; } - rados_ioctx_destroy(io_ctx); - return 0; -err: +end: rados_ioctx_destroy(io_ctx); rados_shutdown(cluster); - return -1; + return ret; } static void