]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: explicitly close images to check for unexpected errors 5131/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 2 Jul 2015 16:59:45 +0000 (12:59 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 2 Jul 2015 16:59:45 +0000 (12:59 -0400)
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 <dillaman@redhat.com>
src/rbd.cc

index 4355c4f0847871722af875e7709613baed675e9b..ce608bb0d4f95a85f7f226f3f0d68d2f0a3dff0f 100644 (file)
@@ -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;
 }