From: Jason Dillaman Date: Mon, 19 Feb 2018 13:27:58 +0000 (-0500) Subject: rbd: don't overwrite the error code from the remove action X-Git-Tag: v13.0.2~230^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20481%2Fhead;p=ceph.git rbd: don't overwrite the error code from the remove action Signed-off-by: Jason Dillaman --- diff --git a/src/tools/rbd/action/Remove.cc b/src/tools/rbd/action/Remove.cc index 397b05a75fd5..c19696d71992 100644 --- a/src/tools/rbd/action/Remove.cc +++ b/src/tools/rbd/action/Remove.cc @@ -84,11 +84,11 @@ int execute(const po::variables_map &vm, if (r == -ENOTEMPTY) { librbd::Image image; std::vector snaps; - r = utils::open_image(io_ctx, image_name, true, &image); - if (r >= 0) { - r = image.snap_list(snaps); + int image_r = utils::open_image(io_ctx, image_name, true, &image); + if (image_r >= 0) { + image_r = image.snap_list(snaps); } - if (r >= 0) { + if (image_r >= 0) { snaps.erase(std::remove_if(snaps.begin(), snaps.end(), [&image](const librbd::snap_info_t& snap) { return is_auto_delete_snapshot(&image, @@ -124,8 +124,8 @@ int execute(const po::variables_map &vm, std::string pool_name = ""; librados::Rados rados(io_ctx); librados::IoCtx pool_io_ctx; - r = rados.ioctx_create2(group_info.pool, pool_io_ctx); - if (r < 0) { + image_r = rados.ioctx_create2(group_info.pool, pool_io_ctx); + if (image_r < 0) { pool_name = ""; } else { pool_name = pool_io_ctx.get_pool_name(); @@ -142,7 +142,7 @@ int execute(const po::variables_map &vm, } else { std::cerr << "rbd: delete error: " << cpp_strerror(r) << std::endl; } - return r ; + return r; } return 0; }