Skip to content

Commit

Permalink
Merge branch 'wip-17330' into wip-mgolub-testing
Browse files Browse the repository at this point in the history
librbd: backward/forward compatibility for update_features #11155
  • Loading branch information
Mykola Golub committed Sep 21, 2016
2 parents 15cdeb9 + 8cb2ccd commit d6749d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cls/rbd/cls_rbd.cc
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions src/librbd/internal.cc
Expand Up @@ -1850,6 +1850,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;
Expand Down

0 comments on commit d6749d9

Please sign in to comment.