From: Jason Dillaman Date: Thu, 16 Nov 2017 20:39:24 +0000 (-0500) Subject: librbd: ensure deep-copy can remove an unprotected snapshot X-Git-Tag: v13.0.1~134^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b872078e670eb76f6c548f2033009d2420161a09;p=ceph.git librbd: ensure deep-copy can remove an unprotected snapshot Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/deep_copy/SnapshotCopyRequest.cc b/src/librbd/deep_copy/SnapshotCopyRequest.cc index 00327194d030..517b789faa67 100644 --- a/src/librbd/deep_copy/SnapshotCopyRequest.cc +++ b/src/librbd/deep_copy/SnapshotCopyRequest.cc @@ -189,6 +189,17 @@ void SnapshotCopyRequest::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; }