From: Jason Dillaman Date: Mon, 12 Feb 2018 20:01:28 +0000 (-0500) Subject: cls/rbd: don't clear CLONE_CHILD op feature if still a child X-Git-Tag: v13.0.2~277^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e57a735bfeac42038266b7fe8a29c0cce75b7941;p=ceph.git cls/rbd: don't clear CLONE_CHILD op feature if still a child After removing the last snapshot linked to a parent image, don't clear the CLONE_CHILD op feature bit if the image HEAD is still linked to the parent. Signed-off-by: Jason Dillaman --- diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index dda49c96e6e7..0cb447f43547 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -2002,8 +2002,15 @@ int snapshot_remove(cls_method_context_t hctx, bufferlist *in, bufferlist *out) return r; } + cls_rbd_parent parent; + r = read_key(hctx, "parent", &parent); + if (r < 0 && r != -ENOENT) { + return r; + } + bool has_parent = (r >= 0 && parent.pool != -1); + uint64_t op_features_mask = 0ULL; - if (!has_child_snaps) { + if (!has_child_snaps && !has_parent) { // disable clone child op feature if no longer associated op_features_mask |= RBD_OPERATION_FEATURE_CLONE_CHILD; }