void StrayManager::_enqueue(CDentry *dn, bool trunc)
{
+ assert(started);
+
CInode *in = dn->get_linkage()->get_inode();
if (in->snaprealm &&
!in->snaprealm->have_past_parents_open() &&
return;
}
- if (!started) {
- // If the MDS is not yet active, defer executing this purge
- // in order to avoid the mdlog writes we do on purge completion.
- mds->wait_for_active(
- new MDSInternalContextWrapper(mds,
- new FunctionContext([this, dn, trunc](int r){
- // It is safe to hold on to this CDentry* pointer
- // because the dentry is pinned with PIN_PURGING
- _enqueue(dn, trunc);
- })
- )
- );
-
- return;
- }
-
if (trunc) {
truncate(dn);
} else {
void StrayManager::advance_delayed()
{
+ if (!started)
+ return;
+
for (elist<CDentry*>::iterator p = delayed_eval_stray.begin(); !p.end(); ) {
CDentry *dn = *p;
++p;
return false;
}
+ if (!started)
+ delay = true;
+
if (dn->item_stray.is_on_list()) {
if (delay)
return false;
{
dout(10) << __func__ << dendl;
started = true;
+ purge_queue.activate();
}
bool StrayManager::eval_stray(CDentry *dn, bool delay)