]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: ensure deep-copy can remove an unprotected snapshot
authorJason Dillaman <dillaman@redhat.com>
Thu, 16 Nov 2017 20:39:24 +0000 (15:39 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 21 Nov 2017 14:17:40 +0000 (09:17 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/deep_copy/SnapshotCopyRequest.cc

index 00327194d030cadcc8ca31a68a7a314064dbebf8..517b789faa67bda595ef09c240797fb1facabc0d 100644 (file)
@@ -189,6 +189,17 @@ void SnapshotCopyRequest<I>::handle_snap_unprotect(int r) {
     finish(r);
     return;
   }
+
+  {
+    // avoid the need to refresh to delete the newly unprotected snapshot
+    RWLock::RLocker snap_locker(m_dst_image_ctx->snap_lock);
+    auto snap_info_it = m_dst_image_ctx->snap_info.find(m_prev_snap_id);
+    if (snap_info_it != m_dst_image_ctx->snap_info.end()) {
+      snap_info_it->second.protection_status =
+        RBD_PROTECTION_STATUS_UNPROTECTED;
+    }
+  }
+
   if (handle_cancellation()) {
     return;
   }