From 8a256742044048975362ffd2e93296beb0300135 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 2 Jul 2015 12:59:45 -0400 Subject: [PATCH] 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 --- src/rbd.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- 2.47.3