]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only create up renamed diri frag subtrees if they differ from parent
authorSage Weil <sage@newdream.net>
Tue, 26 Jul 2011 17:52:49 +0000 (10:52 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 27 Jul 2011 03:44:17 +0000 (20:44 -0700)
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 <sage@newdream.net>
src/mds/journal.cc

index 6fe73f46163aea5f57453f3d6918bc38455a964b..650fdf1f66688bf58eb03c692deb0be6a2954560 100644 (file)
@@ -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<frag_t>::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<frag_t>::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);
     }
   }