From: Sage Weil Date: Mon, 3 Aug 2015 17:05:45 +0000 (-0400) Subject: hobject_t: decode future hobject_t::get_min() properly X-Git-Tag: v0.94.4~83^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1357ed1bd0e250b942bcba0346c97c24bb79a5d1;p=ceph.git hobject_t: decode future hobject_t::get_min() properly The post-hammer wip-temp branch changed hobject_t::get_min() so that pool is INT64_MIN instead of -1 and neglected to deal with the encoding compat with older versions. Compensate on hammer by mapping INT64_MIN to -1 locally. See commit ff99af38df830e215359bfb8837bf310a2023a4d. Note that this means upgrades from hammer to post-hammer *must* include this fix prior to the upgrade. This will need to be well-documented in the release notes. Master gets a similar fix so that they map our min value to the new INT64_MIN one on decode. Fixes: #12536 (for hammer) Signed-off-by: Sage Weil --- diff --git a/src/common/hobject.cc b/src/common/hobject.cc index fda169bf6d6..866c9928316 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -130,6 +130,15 @@ void hobject_t::decode(bufferlist::iterator& bl) if (struct_v >= 4) { ::decode(nspace, bl); ::decode(pool, bl); + // newer OSDs have a different hobject_t::get_min(); decode it properly. + if (pool == INT64_MIN && + hash == 0 && + snap == 0 && + !max && + oid.name.empty()) { + pool = -1; + assert(is_min()); + } } DECODE_FINISH(bl); build_filestore_key_cache(); @@ -226,6 +235,15 @@ void ghobject_t::decode(bufferlist::iterator& bl) if (struct_v >= 4) { ::decode(hobj.nspace, bl); ::decode(hobj.pool, bl); + // newer OSDs have a different hobject_t::get_min(); decode it properly. + if (hobj.pool == INT64_MIN && + hobj.hash == 0 && + hobj.snap == 0 && + !hobj.max && + hobj.oid.name.empty()) { + hobj.pool = -1; + assert(hobj.is_min()); + } } if (struct_v >= 5) { ::decode(generation, bl); diff --git a/src/common/hobject.h b/src/common/hobject.h index 94aa6bf7828..07ceb3a15ac 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -29,6 +29,13 @@ namespace ceph { class Formatter; } +#ifndef UINT64_MAX +#define UINT64_MAX (18446744073709551615ULL) +#endif +#ifndef INT64_MIN +#define INT64_MIN ((int64_t)0x8000000000000000ll) +#endif + struct hobject_t { object_t oid; snapid_t snap;