request->take_other_inode(&other_in);
delete request;
- if (other_in) {
- if (other_in->dir &&
- (op == CEPH_MDS_OP_RMDIR ||
- op == CEPH_MDS_OP_RENAME ||
- op == CEPH_MDS_OP_RMSNAP))
- _try_to_trim_inode(other_in.get(), false);
+ if (other_in &&
+ (op == CEPH_MDS_OP_RMDIR ||
+ op == CEPH_MDS_OP_RENAME ||
+ op == CEPH_MDS_OP_RMSNAP)) {
+ _try_to_trim_inode(other_in.get(), false);
}
}
}
in->cap_item.remove_myself();
in->snaprealm_item.remove_myself();
- in->snapdir_parent.reset();
+ if (in->snapdir_parent) {
+ in->snapdir_parent->flags &= ~I_SNAPDIR_OPEN;
+ in->snapdir_parent.reset();
+ }
if (in == root) {
root = 0;
root_ancestor = 0;
}
}
+ if (ref > 0 && (in->flags & I_SNAPDIR_OPEN)) {
+ InodeRef snapdir = open_snapdir(in);
+ _try_to_trim_inode(snapdir.get(), false);
+ --ref;
+ }
+
if (ref > 0 && in->ll_ref > 0 && sched_inval) {
set<Dentry*>::iterator q = in->dn_set.begin();
while (q != in->dn_set.end()) {
in->dirfragtree.clear();
in->snapdir_parent = diri;
+ diri->flags |= I_SNAPDIR_OPEN;
inode_map[vino] = in;
if (use_faked_inos())
_assign_faked_ino(in);