From 699bbe18963317caf16678a2f4f2f3cdbfc30a23 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 26 Jul 2011 10:52:49 -0700 Subject: [PATCH] mds: only create up renamed diri frag subtrees if they differ from parent Commit 00ec86a2041 opens up subtrees with CDIR_AUTH_UNDEF blindly for any renamed dir inode. This is correct on the rename target, but not on a random observer, where we end up with the parent and child having the same auth. Oddly the comment seemed to have it right. Fix the code. Signed-off-by: Sage Weil --- src/mds/journal.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 6fe73f46163ae..650fdf1f66688 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -646,17 +646,19 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg) } // if we are the srci importer, we'll also have some dirfrags we have to open up... - for (list::iterator p = renamed_dir_frags.begin(); p != renamed_dir_frags.end(); ++p) { - CDir *dir = renamed_diri->get_dirfrag(*p); - if (dir) { - // we already had the inode before, and we already adjusted this subtree accordingly. - dout(10) << " already had+adjusted rename import bound " << *dir << dendl; - assert(olddir); - continue; + if (renamed_diri->authority() != CDIR_AUTH_UNDEF) { + for (list::iterator p = renamed_dir_frags.begin(); p != renamed_dir_frags.end(); ++p) { + CDir *dir = renamed_diri->get_dirfrag(*p); + if (dir) { + // we already had the inode before, and we already adjusted this subtree accordingly. + dout(10) << " already had+adjusted rename import bound " << *dir << dendl; + assert(olddir); + continue; + } + dir = renamed_diri->get_or_open_dirfrag(mds->mdcache, *p); + dout(10) << " creating new rename import bound " << *dir << dendl; + mds->mdcache->adjust_subtree_auth(dir, CDIR_AUTH_UNDEF, false); } - dir = renamed_diri->get_or_open_dirfrag(mds->mdcache, *p); - dout(10) << " creating new rename import bound " << *dir << dendl; - mds->mdcache->adjust_subtree_auth(dir, CDIR_AUTH_UNDEF, false); } } -- 2.39.5