]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: encode object_info with required (not up) features 13114/head
authorSage Weil <sage@redhat.com>
Wed, 25 Jan 2017 23:46:09 +0000 (18:46 -0500)
committerSage Weil <sage@redhat.com>
Wed, 25 Jan 2017 23:46:09 +0000 (18:46 -0500)
Using up features means we might have an old OSD down, we encode
a new oi with addr2 entity_addr_t, and then come up and be unable
to decode.

Fixes: http://tracker.ceph.com/issues/18644
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PrimaryLogPG.cc

index cfd88d4b5684f09faac0b96fcecf22e0089ad9cf..5b1477727bb286a07a6709e43eb646b35a80d0d2 100644 (file)
@@ -354,7 +354,8 @@ void PrimaryLogPG::on_local_recover(
       recovery_info.oi.prior_version = recovery_info.oi.version;
       recovery_info.oi.version = latest->version;
       bufferlist bl;
-      ::encode(recovery_info.oi, bl, get_osdmap()->get_up_osd_features());
+      ::encode(recovery_info.oi, bl,
+              get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
       assert(!pool.info.require_rollback());
       t->setattr(coll, ghobject_t(recovery_info.soid), OI_ATTR, bl);
       if (obc)
@@ -3540,7 +3541,7 @@ PrimaryLogPG::OpContextUPtr PrimaryLogPG::trim_object(bool first, const hobject_
     coi.prior_version = coi.version;
     coi.version = ctx->at_version;
     bl.clear();
-    ::encode(coi, bl, get_osdmap()->get_up_osd_features());
+    ::encode(coi, bl, get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
     t->setattr(coid, OI_ATTR, bl);
 
     ctx->log.push_back(
@@ -3609,7 +3610,8 @@ PrimaryLogPG::OpContextUPtr PrimaryLogPG::trim_object(bool first, const hobject_
     attrs[SS_ATTR].claim(bl);
 
     bl.clear();
-    ::encode(ctx->snapset_obc->obs.oi, bl, get_osdmap()->get_up_osd_features());
+    ::encode(ctx->snapset_obc->obs.oi, bl,
+            get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
     attrs[OI_ATTR].claim(bl);
     t->setattrs(snapoid, attrs);
   }
@@ -6229,7 +6231,7 @@ void PrimaryLogPG::_make_clone(
   object_info_t *poi)
 {
   bufferlist bv;
-  ::encode(*poi, bv, get_osdmap()->get_up_osd_features());
+  ::encode(*poi, bv, get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
 
   t->clone(coid, head);
   setattr_maybe_cache(obc, ctx, t, OI_ATTR, bv);
@@ -6682,7 +6684,8 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
 
       map<string, bufferlist> attrs;
       bufferlist bv(sizeof(ctx->new_obs.oi));
-      ::encode(ctx->snapset_obc->obs.oi, bv, get_osdmap()->get_up_osd_features());
+      ::encode(ctx->snapset_obc->obs.oi, bv,
+              get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
       ctx->op_t->create(snapoid);
       attrs[OI_ATTR].claim(bv);
       attrs[SS_ATTR].claim(bss);
@@ -6720,7 +6723,8 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
 
     map <string, bufferlist> attrs;
     bufferlist bv(sizeof(ctx->new_obs.oi));
-    ::encode(ctx->new_obs.oi, bv, get_osdmap()->get_up_osd_features());
+    ::encode(ctx->new_obs.oi, bv,
+            get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
     attrs[OI_ATTR].claim(bv);
 
     if (soid.snap == CEPH_NOSNAP) {
@@ -8822,7 +8826,7 @@ void PrimaryLogPG::handle_watch_timeout(WatchRef watch)
   oi.prior_version = obc->obs.oi.version;
   oi.version = ctx->at_version;
   bufferlist bl;
-  ::encode(oi, bl, get_osdmap()->get_up_osd_features());
+  ::encode(oi, bl, get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
   t->setattr(obc->obs.oi.soid, OI_ATTR, bl);
 
   // apply new object state.
@@ -10470,7 +10474,9 @@ uint64_t PrimaryLogPG::recover_primary(uint64_t max, ThreadPool::TPHandle &handl
 
              ObjectStore::Transaction t;
              bufferlist b2;
-             obc->obs.oi.encode(b2, get_osdmap()->get_up_osd_features());
+             obc->obs.oi.encode(
+               b2,
+               get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
              assert(!pool.info.require_rollback());
              t.setattr(coll, ghobject_t(soid), OI_ATTR, b2);
 
@@ -11634,7 +11640,8 @@ void PrimaryLogPG::hit_set_persist()
   bufferlist bss;
   ::encode(ctx->new_snapset, bss);
   bufferlist boi(sizeof(ctx->new_obs.oi));
-  ::encode(ctx->new_obs.oi, boi, get_osdmap()->get_up_osd_features());
+  ::encode(ctx->new_obs.oi, boi,
+          get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
 
   ctx->op_t->create(oid);
   if (bl.length()) {