From: Jason Dillaman Date: Thu, 2 Jul 2015 16:59:45 +0000 (-0400) Subject: rbd: explicitly close images to check for unexpected errors X-Git-Tag: v9.0.2~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5131%2Fhead;p=ceph.git rbd: explicitly close images to check for unexpected errors While errors shouldn't occur during image close, it is possible that they could occur. In this case, the user should be informed. Signed-off-by: Jason Dillaman --- diff --git a/src/rbd.cc b/src/rbd.cc index 4355c4f08478..ce608bb0d4f9 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -1615,7 +1615,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx, } } - r = 0; + r = image.close(); done: if (!from_stdin) { @@ -3964,5 +3964,11 @@ if (!set_conf_param(v, p1, p2, p3)) { \ } break; } + + r = image.close(); + if (r < 0) { + cerr << "rbd: error while closing image: " << cpp_strerror(-r) << std::endl; + return -r; + } return 0; }