]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
hobject_t: decode future hobject_t::get_min() properly
authorSage Weil <sage@redhat.com>
Mon, 3 Aug 2015 17:05:45 +0000 (13:05 -0400)
committerSamuel Just <sjust@redhat.com>
Mon, 3 Aug 2015 21:54:50 +0000 (14:54 -0700)
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 <sage@redhat.com>
src/common/hobject.cc
src/common/hobject.h

index fda169bf6d6777a1af825aadb2290b4caedd6a49..866c9928316f406c59d6a75c6f4921e2083a8ccf 100644 (file)
@@ -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);
index 94aa6bf782863594c589dee969672493c9cf0c59..07ceb3a15ac17c5eba47fdb879fdc3c28ed74284 100644 (file)
@@ -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;