Remote snap dentry may hold reference to the stray directory inode,
the reference prevent the stray inode from being purged. After making
sure the stray directory inode is not referenced by any snapshot, we
know that all remote snap dentries should be stale, so we can unlink
them safely.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
(*p)->try_remove_dentries_for_stray();
}
}
+
+ if (!in->remote_parents.empty()) {
+ // unlink any stale remote snap dentry.
+ for (compact_set<CDentry*>::iterator p = in->remote_parents.begin();
+ p != in->remote_parents.end(); ) {
+ CDentry *remote_dn = *p;
+ ++p;
+ assert(remote_dn->last != CEPH_NOSNAP);
+ remote_dn->unlink_remote(remote_dn->get_linkage());
+ }
+ }
}
if (dn->is_replicated()) {
dout(20) << " replicated" << dendl;