From: Sage Weil Date: Wed, 25 Jan 2017 23:46:09 +0000 (-0500) Subject: osd/PrimaryLogPG: encode object_info with required (not up) features X-Git-Tag: v12.0.0~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47066ef310e2dea3501657851bf3c2b96efb0669;p=ceph.git osd/PrimaryLogPG: encode object_info with required (not up) features 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index cfd88d4b5684..5b1477727bb2 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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 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 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()) {