Skip to contentSkip to conversation

ObjectContext : check that all references are gone

DISCUSSION Loic Dachary 2 participants 3 messages Jul 15, 2013 – Jul 16, 2013

lore
Share & tools
lore
#0 lore raw

Hi Sage,

You mentionned that there is code somewhere checking the fact that all references to an ObjectContext are gone and that replacing manual reference counting with shared_ptr should preserve this ( i.e. in relation to https://github.com/ceph/ceph/pull/414 "replace ObjectContext pointers with shared_ptr" ). However, I've not been able to find such code. Would you be so kind as to show me where it is ?

Cheers

Signature · 2 lines
Loïc Dachary, Artisan Logiciel Libre
All that is necessary for the triumph of evil is that good people do nothing.
#1 lore raw
Quoted 5 lines · Loic Dachary

Hi Sage,

You mentionned that there is code somewhere checking the fact that all references to an ObjectContext are gone and that replacing manual reference counting with shared_ptr should preserve this ( i.e. in relation to https://github.com/ceph/ceph/pull/414 "replace ObjectContext pointers with shared_ptr" ). However, I've not been able to find such code. Would you be so kind as to show me where it is ?

Cheers

It's in ReplicatedPG.cc:

void ReplicatedPG::on_flushed()
{
assert(object_contexts.empty());
}

which is called from the Reset state of the PG peering state machine.

sage

#2 lore raw
Quoted 7 lines · Sage Weil
Quoted 5 lines · Loic Dachary

Hi Sage,

You mentionned that there is code somewhere checking the fact that all references to an ObjectContext are gone and that replacing manual reference counting with shared_ptr should preserve this ( i.e. in relation to https://github.com/ceph/ceph/pull/414 "replace ObjectContext pointers with shared_ptr" ). However, I've not been able to find such code. Would you be so kind as to show me where it is ?

Cheers

Quoted 8 lines

It's in ReplicatedPG.cc:

void ReplicatedPG::on_flushed()
{
assert(object_contexts.empty());
}

which is called from the Reset state of the PG peering state machine.

It is still here:

https://github.com/dachary/ceph/blob/1a7e390965e6b03f72360f016b2e7d852c455784/src/osd/ReplicatedPG.cc#L6659

and should be ok. Although the de-allocation happens after the last shared_ptr<> goes out of scope instead of being deleted by an explicit call to put_object_context, I believe it happens before on_flushed() is invoked at

https://github.com/dachary/ceph/blob/1a7e390965e6b03f72360f016b2e7d852c455784/src/osd/PG.cc#L5225

I can't imagine a case where it would assert with the proposed patch.

Cheers

Quoted 3 lines

sage

Signature · 2 lines
Loïc Dachary, Artisan Logiciel Libre
All that is necessary for the triumph of evil is that good people do nothing.