From a26c7a5cacebf8814e20a2f3d5b69c20d8798871 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 20 Sep 2016 14:34:16 -0400 Subject: [PATCH 1/2] cls/rbd: set_features should adjust the mask to known features Signed-off-by: Jason Dillaman --- src/cls/rbd/cls_rbd.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index f7bf2e3341101..c90bc33532632 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -414,6 +414,9 @@ int set_features(cls_method_context_t hctx, bufferlist *in, bufferlist *out) return r; } + // newer clients might attempt to mask off features we don't support + mask &= RBD_FEATURES_ALL; + uint64_t enabled_features = features & mask; if ((enabled_features & RBD_FEATURES_MUTABLE) != enabled_features) { CLS_ERR("Attempting to enable immutable feature: %" PRIu64, From 8cb2ccda1b847e0f33c0d34bf57e9ec29bbbb43b Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 20 Sep 2016 14:47:36 -0400 Subject: [PATCH 2/2] librbd: update_features should handle Infernalis OSDs Fixes: http://tracker.ceph.com/issues/17330 Signed-off-by: Jason Dillaman --- src/librbd/internal.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 78b0057db841d..ecc0f28a6793e 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -1849,6 +1849,13 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force, << "mask=" << features_mask << dendl; r = librbd::cls_client::set_features(&ictx->md_ctx, ictx->header_oid, new_features, features_mask); + if (!enabled && r == -EINVAL) { + // NOTE: infernalis OSDs will not accept a mask with new features, so + // re-attempt with a reduced mask. + features_mask &= ~RBD_FEATURE_JOURNALING; + r = librbd::cls_client::set_features(&ictx->md_ctx, ictx->header_oid, + new_features, features_mask); + } if (r < 0) { lderr(cct) << "failed to update features: " << cpp_strerror(r) << dendl;