]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: exit if parent snap is gone during clone 6968/head
authorxiexingguo <258156334@qq.com>
Fri, 18 Dec 2015 10:37:06 +0000 (18:37 +0800)
committerxiexingguo <258156334@qq.com>
Fri, 18 Dec 2015 15:01:38 +0000 (23:01 +0800)
Fixes: #14118
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/librbd/internal.cc

index 37ded6c246c4c10881f511bbf5715170dadbd1a3..00e8f684d6f7f59656dc7c0cb02c8e627c3731ac 100644 (file)
@@ -1549,7 +1549,7 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
     p_imctx->snap_lock.get_read();
     p_features = p_imctx->features;
     size = p_imctx->get_image_size(p_imctx->snap_id);
-    p_imctx->is_snap_protected(p_imctx->snap_id, &snap_protected);
+    r = p_imctx->is_snap_protected(p_imctx->snap_id, &snap_protected);
     p_imctx->snap_lock.put_read();
 
     if ((p_features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) {
@@ -1557,6 +1557,12 @@ int invoke_async_request(ImageCtx *ictx, const std::string& request_type,
       r = -ENOSYS;
       goto err_close_parent;
     }
+    
+    if (r < 0) {
+      // we lost the race with snap removal?
+      lderr(cct) << "unable to locate parent's snapshot" << dendl;
+      goto err_close_parent;
+    }
 
     if (!snap_protected) {
       lderr(cct) << "parent snapshot must be protected" << dendl;