diff options
author | Sage Weil <sage@inktank.com> | 2013-07-18 16:24:00 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-19 08:09:09 -0700 |
commit | 053659d05e0349053ef703b414f44965f368b9f0 (patch) | |
tree | 5b40ceb611a475ad4f8ddeb3753be21e38279b3f | |
parent | f0feabe81faa0152f6f3f4615354e1ef201c0113 (diff) | |
download | ceph-053659d05e0349053ef703b414f44965f368b9f0.tar.gz |
msg/Pipe: work around incorrect features reported by earlier versions
If we see a peer reporting features ~0ull, we know they are deluded in a
particular way and should infer what features they *actually* have. Do
this right when the features come over the wire to catch all users.
Fixes: #5655
Signed-off-by: Samuel Just <sam.just@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/include/ceph_features.h | 22 | ||||
-rw-r--r-- | src/msg/Pipe.cc | 18 |
2 files changed, 35 insertions, 5 deletions
diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index f72e1028898..362a459bde6 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -41,6 +41,28 @@ #define CEPH_FEATURE_OSD_PACKED_RECOVERY (1ULL<<34) /* + * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature + * vector to evaluate to 64 bit ~0. To cope, we designate 1ULL << 63 + * to mean 33 bit ~0, and introduce a helper below to do the + * translation. + * + * This was introduced by commit + * 9ea02b84104045c2ffd7e7f4e7af512953855ecd v0.58-657-g9ea02b8 + * and fixed by commit + * 4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c + */ +#define CEPH_FEATURE_RESERVED (1ULL<<63) + +static inline unsigned long long ceph_sanitize_features(unsigned long long f) { + if (f & CEPH_FEATURE_RESERVED) { + /* everything through OSD_SNAPMAPPER */ + return 0x1ffffffffull; + } else { + return f; + } +} + +/* * Features supported. Should be everything above. */ #define CEPH_FEATURES_ALL \ diff --git a/src/msg/Pipe.cc b/src/msg/Pipe.cc index 03ee79a15c2..6f271c812f3 100644 --- a/src/msg/Pipe.cc +++ b/src/msg/Pipe.cc @@ -313,6 +313,9 @@ int Pipe::accept() goto fail_unlocked; } + // sanitize features + connect.features = ceph_sanitize_features(connect.features); + authorizer.clear(); if (connect.authorizer_len) { bp = buffer::create(connect.authorizer_len); @@ -920,12 +923,17 @@ int Pipe::connect() ldout(msgr->cct,2) << "connect read reply " << strerror_r(errno, buf, sizeof(buf)) << dendl; goto fail; } + + // sanitize features + reply.features = ceph_sanitize_features(reply.features); + ldout(msgr->cct,20) << "connect got reply tag " << (int)reply.tag - << " connect_seq " << reply.connect_seq - << " global_seq " << reply.global_seq - << " proto " << reply.protocol_version - << " flags " << (int)reply.flags - << dendl; + << " connect_seq " << reply.connect_seq + << " global_seq " << reply.global_seq + << " proto " << reply.protocol_version + << " flags " << (int)reply.flags + << " features " << reply.features + << dendl; authorizer_reply.clear(); |