It's possible we have non-auth metadata only because we have a subtree
nested beneath. If we rename a directory out of a non-auth subtree, we
should try to trim any non-auth content from that subtree that may now
be possible due to the child subtrees being linked elsewhere.
Fixes: #1146
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
if (olddir) {
assert(renamed_diri);
mds->mdcache->adjust_subtree_after_rename(renamed_diri, olddir, false);
+
+ // see if we can discard the subtree we renamed out of
+ CDir *root = mds->mdcache->get_subtree_root(olddir);
+ if (root->get_dir_auth() == CDIR_AUTH_UNDEF)
+ mds->mdcache->try_trim_non_auth_subtree(root);
+
} else {
// we imported a diri we haven't seen before
assert(!renamed_diri);