]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: propagate error from snap_set
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 21 Oct 2011 21:33:30 +0000 (14:33 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Mon, 24 Oct 2011 22:32:47 +0000 (15:32 -0700)
Previously rbd_snap_set always returned 0, even when the snapshot did
not exist.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/librbd.cc

index 39bc5f2b9286d8c231f6baf828016673d8ca3e69..d5f79ea6c18581cf593471329e20e187285d0ba7 100644 (file)
@@ -1191,10 +1191,14 @@ int snap_set(ImageCtx *ictx, const char *snap_name)
     return r;
 
   Mutex::Locker l(ictx->lock);
-  if (snap_name)
-    ictx->snap_set(snap_name);
-  else
+  if (snap_name) {
+    r = ictx->snap_set(snap_name);
+    if (r < 0) {
+      return r;
+    }
+  } else {
     ictx->snap_unset();
+  }
 
   ictx->data_ctx.snap_set_read(ictx->snapid);