]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/hobject_t: correctly decode pre-infernalis hobject_t min 5509/head
authorSage Weil <sage@redhat.com>
Mon, 3 Aug 2015 15:53:09 +0000 (11:53 -0400)
committerSage Weil <sage@redhat.com>
Mon, 3 Aug 2015 15:53:09 +0000 (11:53 -0400)
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 <sage@redhat.com>
src/common/hobject.cc

index 102ac5e4a3ce1eaae752f213488ee05cb48e4bef..4035e9806a67fb95e5d6d2f4a45b8e7b7609d056 100644 (file)
@@ -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);