]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: update in-memory migration snap map after creating snap
authorMykola Golub <mgolub@suse.com>
Fri, 6 Jul 2018 08:56:48 +0000 (11:56 +0300)
committerJason Dillaman <dillaman@redhat.com>
Tue, 14 Aug 2018 22:29:45 +0000 (18:29 -0400)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/operation/SnapshotCreateRequest.cc

index 63ddd8848c4d38ec785745fe045a2a20a223fe00..dc11b28f7d3bd2adcf300b211ba8e70fca76477d 100644 (file)
@@ -310,6 +310,17 @@ void SnapshotCreateRequest<I>::update_snap_context() {
   image_ctx.snapc.snaps.swap(snaps);
   image_ctx.data_ctx.selfmanaged_snap_set_write_ctx(
     image_ctx.snapc.seq, image_ctx.snaps);
+
+  if (!image_ctx.migration_info.empty()) {
+    auto it = image_ctx.migration_info.snap_map.find(CEPH_NOSNAP);
+    assert(it != image_ctx.migration_info.snap_map.end());
+    assert(!it->second.empty());
+    if (it->second[0] == CEPH_NOSNAP) {
+      ldout(cct, 5) << this << " " << __func__
+                    << ": updating migration snap_map" << dendl;
+      it->second[0] = m_snap_id;
+    }
+  }
 }
 
 } // namespace operation