From: Sage Weil Date: Mon, 3 Aug 2015 15:53:09 +0000 (-0400) Subject: common/hobject_t: correctly decode pre-infernalis hobject_t min X-Git-Tag: v9.1.0~425^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ca6bf60e92734b5f34b2d29eea64eec5864800a;p=ceph.git common/hobject_t: correctly decode pre-infernalis hobject_t min In commit ff99af38df830e215359bfb8837bf310a2023a4d we changed the value of hobject_t() (the min value) but did not handle compatibility properly. Compensate by correctly decoding older OSDs' notion of hobject_t min and mapping it to ours. The hammer stable branch will have to compensate similarly so that it can map our min value to its old min. Fixes: #12536 Signed-off-by: Sage Weil --- diff --git a/src/common/hobject.cc b/src/common/hobject.cc index 102ac5e4a3ce..4035e9806a67 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -130,6 +130,18 @@ void hobject_t::decode(bufferlist::iterator& bl) if (struct_v >= 4) { ::decode(nspace, bl); ::decode(pool, bl); + // for compat with hammer, which did not handle the transition + // from pool -1 -> pool INT64_MIN for MIN properly. this object + // name looks a bit like a pgmeta object for the meta collection, + // but those do not ever exist (and is_pgmeta() pool >= 0). + if (pool == -1 && + snap == 0 && + hash == 0 && + !max && + oid.name.empty()) { + pool = INT64_MIN; + assert(is_min()); + } } DECODE_FINISH(bl); build_filestore_key_cache(); @@ -231,6 +243,16 @@ void ghobject_t::decode(bufferlist::iterator& bl) if (struct_v >= 4) { ::decode(hobj.nspace, bl); ::decode(hobj.pool, bl); + // for compat with hammer, which did not handle the transition from + // pool -1 -> pool INT64_MIN for MIN properly (see hobject_t::decode()). + if (hobj.pool == -1 && + hobj.snap == 0 && + hobj.hash == 0 && + !hobj.max && + hobj.oid.name.empty()) { + hobj.pool = INT64_MIN; + assert(hobj.is_min()); + } } if (struct_v >= 5) { ::decode(generation, bl);