From fccaa4838f62415a0e3684ef6cebeac5eea3d86f Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Fri, 6 Jul 2018 11:56:48 +0300 Subject: [PATCH] librbd: update in-memory migration snap map after creating snap Signed-off-by: Mykola Golub --- src/librbd/operation/SnapshotCreateRequest.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- 2.39.5