From: Loic Dachary Date: Tue, 13 Aug 2013 14:52:18 +0000 (+0200) Subject: ReplicatedPG: add Context to cleanup the PG after an ObjectContext deletion X-Git-Tag: v0.69~76^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95349c028ef049e28f651773cbf28f49a872013c;p=ceph.git ReplicatedPG: add Context to cleanup the PG after an ObjectContext deletion ReplicatedPG::C_PG_ObjectContext is added to encapsulate a call to ReplicatedPG::object_context_destructor_callback method which is reponsible for * manually de-allocating the SnapSetContext of the ObjectContext if any. It will eventually be managed by a SharedPtrRegistry. ReplicatedPG::C_PG_ObjectContext must be added to the destructor_callback member of ObjectContext immediately after it is created. http://tracker.ceph.com/issues/5510 refs #5510 Signed-off-by: Loic Dachary --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 6c81997c931..a1bba507033 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4678,7 +4678,16 @@ int ReplicatedPG::find_object_context(const hobject_t& oid, } } -void ReplicatedPG::add_object_context_to_pg_stat(ObjectContext *obc, pg_stat_t *pgstat) +void ReplicatedPG::object_context_destructor_callback(ObjectContext *obc) +{ + dout(10) << "object_context_destructor_callback " << obc << " " + << obc->obs.oi.soid << dendl; + + if (obc->ssc) + put_snapset_context(obc->ssc); +} + +void ReplicatedPG::add_object_context_to_pg_stat(ObjectContextRef obc, pg_stat_t *pgstat) { object_info_t& oi = obc->obs.oi; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 133be172a98..0fbe5afd9ca 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -302,6 +302,17 @@ protected: ObjectContextRef get_object_context(const hobject_t& soid, bool can_create); void context_registry_on_change(); + void object_context_destructor_callback(ObjectContext *obc); + struct C_PG_ObjectContext : public Context { + ReplicatedPGRef pg; + ObjectContext *obc; + C_PG_ObjectContext(ReplicatedPG *p, ObjectContext *o) : + pg(p), obc(o) {} + void finish(int r) { + pg->object_context_destructor_callback(obc); + } + }; + int find_object_context(const hobject_t& oid, ObjectContextRef *pobc, bool can_create, snapid_t *psnapid=NULL);