From: Mykola Golub Date: Fri, 6 Jul 2018 08:56:48 +0000 (+0300) Subject: librbd: update in-memory migration snap map after creating snap X-Git-Tag: v14.0.1~590^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fccaa4838f62415a0e3684ef6cebeac5eea3d86f;p=ceph.git librbd: update in-memory migration snap map after creating snap Signed-off-by: Mykola Golub --- diff --git a/src/librbd/operation/SnapshotCreateRequest.cc b/src/librbd/operation/SnapshotCreateRequest.cc index 63ddd8848c4d3..dc11b28f7d3bd 100644 --- a/src/librbd/operation/SnapshotCreateRequest.cc +++ b/src/librbd/operation/SnapshotCreateRequest.cc @@ -310,6 +310,17 @@ void SnapshotCreateRequest::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