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 <loic@dachary.org>
}
}
-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;
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);