void CDir::try_remove_dentries_for_stray()
{
dout(10) << __func__ << dendl;
- assert(inode->inode.nlink == 0);
+ assert(get_parent_dir()->inode->is_stray());
// clear dirty only when the directory was not snapshotted
bool clear_dirty = !inode->snaprealm;
}
// unlinked directory inode shouldn't have any entry
- if (inode->inode.nlink == 0 && !inode->snaprealm) {
+ if (!inode->is_base() && get_parent_dir()->inode->is_stray() &&
+ !inode->snaprealm) {
dout(7) << "fetch dirfrag for unlinked directory, mark complete" << dendl;
if (get_version() == 0) {
+ assert(inode->is_auth());
set_version(1);
if (state_test(STATE_REJOINUNDEF)) {
assert(is_auth());
assert(ignore_authpinnability || can_auth_pin());
- if (inode->inode.nlink == 0 && !inode->snaprealm) {
- dout(7) << "commit dirfrag for unlinked directory, mark clean" << dendl;
- try_remove_dentries_for_stray();
- if (c)
- cache->mds->queue_waiter(c);
- return;
- }
-
// note: queue up a noop if necessary, so that we always
// get an auth_pin.
if (!c)
if (r < 0) {
// the directory could be partly purged during MDS failover
if (r == -ENOENT && committed_version == 0 &&
- inode->inode.nlink == 0 && inode->snaprealm) {
- inode->state_set(CInode::STATE_MISSINGOBJS);
+ !inode->is_base() && get_parent_dir()->inode->is_stray()) {
r = 0;
+ if (inode->snaprealm)
+ inode->state_set(CInode::STATE_MISSINGOBJS);
}
if (r < 0) {
dout(1) << "commit error " << r << " v " << v << dendl;
}
// try drop dentries in this dirfrag if it's about to be purged
- if (inode->inode.nlink == 0 && inode->snaprealm)
+ if (!inode->is_base() && get_parent_dir()->inode->is_stray() &&
+ inode->snaprealm)
cache->maybe_eval_stray(inode, true);
// unpin if we kicked the last waiter.