static const int STATE_FRAGMENTING = (1<<1);
static const int STATE_PURGING = (1<<2);
static const int STATE_BADREMOTEINO = (1<<3);
+ static const int STATE_EVALUATINGSTRAY = (1<<4);
// stray dentry needs notification of releasing reference
static const int STATE_STRAY = STATE_NOTIFYREF;
}
};
-bool StrayManager::eval_stray(CDentry *dn, bool delay)
+bool StrayManager::__eval_stray(CDentry *dn, bool delay)
{
dout(10) << "eval_stray " << *dn << dendl;
CDentry::linkage_t *dnl = dn->get_projected_linkage();
}
}
+bool StrayManager::eval_stray(CDentry *dn, bool delay)
+{
+ // avoid nested eval_stray
+ if (dn->state_test(CDentry::STATE_EVALUATINGSTRAY))
+ return false;
+
+ dn->state_set(CDentry::STATE_EVALUATINGSTRAY);
+ bool ret = __eval_stray(dn, delay);
+ dn->state_clear(CDentry::STATE_EVALUATINGSTRAY);
+ return ret;
+}
+
void StrayManager::eval_remote_stray(CDentry *stray_dn, CDentry *remote_dn)
{
assert(stray_dn != NULL);
*/
void reintegrate_stray(CDentry *dn, CDentry *rlink);
+ /**
+ * Evaluate a stray dentry for purging or reintegration.
+ *
+ * purging: If the inode has no linkage, and no more references, then
+ * we may decide to purge it.
+ *
+ * reintegration: If the inode still has linkage, then it means someone else
+ * (a hard link) is still referring to it, and we should
+ * think about reintegrating that inode into the remote dentry.
+ *
+ * @returns true if the dentry will be purged (caller should never
+ * take more refs after this happens), else false.
+ */
+ bool __eval_stray(CDentry *dn, bool delay=false);
+
// My public interface is for consumption by MDCache
public:
StrayManager(MDS *mds);
void set_logger(PerfCounters *l) {logger = l;}
+ bool eval_stray(CDentry *dn, bool delay=false);
+
/**
* Where eval_stray was previously invoked with delay=true, call
* eval_stray again for any dentries that were put on the
*/
void advance_delayed();
- /**
- * Evaluate a stray dentry for purging or reintegration.
- *
- * purging: If the inode has no linkage, and no more references, then
- * we may decide to purge it.
- *
- * reintegration: If the inode still has linkage, then it means someone else
- * (a hard link) is still referring to it, and we should
- * think about reintegrating that inode into the remote dentry.
- *
- * @returns true if the dentry will be purged (caller should never
- * take more refs after this happens), else false.
- */
- bool eval_stray(CDentry *dn, bool delay=false);
-
/**
* When a metadata op touches a remote dentry that points to
* a stray, call in here to evaluate it for migration (move