From: Jason Dillaman Date: Fri, 21 Feb 2020 01:43:46 +0000 (-0500) Subject: librbd: fix broken group snapshot handling X-Git-Tag: v15.1.1~297^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33448%2Fhead;p=ceph.git librbd: fix broken group snapshot handling After commit ecf71d301f, only the snapshot namespace type and snapshot name are considered for snapshot ordering. This breaks the expectations in the group API when searching for a newly created snapshot. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/api/Group.cc b/src/librbd/api/Group.cc index aa341bc25328a..48a49cf74024e 100644 --- a/src/librbd/api/Group.cc +++ b/src/librbd/api/Group.cc @@ -39,9 +39,15 @@ template snap_t get_group_snap_id(I* ictx, const cls::rbd::SnapshotNamespace& in_snap_namespace) { ceph_assert(ceph_mutex_is_locked(ictx->image_lock)); - auto it = ictx->snap_ids.lower_bound({in_snap_namespace, ""}); - if (it != ictx->snap_ids.end() && it->first.first == in_snap_namespace) { - return it->second; + auto it = ictx->snap_ids.lower_bound({cls::rbd::GroupSnapshotNamespace{}, + ""}); + for (; it != ictx->snap_ids.end(); ++it) { + if (it->first.first == in_snap_namespace) { + return it->second; + } else if (boost::get(&it->first.first) == + nullptr) { + break; + } } return CEPH_NOSNAP; }