]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: trim non-auth swallowed subtrees during resolve
authorSage Weil <sage@newdream.net>
Sat, 30 Apr 2011 00:30:45 +0000 (17:30 -0700)
committerSage Weil <sage@newdream.net>
Sat, 30 Apr 2011 00:46:24 +0000 (17:46 -0700)
Consider:
 - peer auth for /foo
 - ambiguous import /foo/bar
 - peer claims /foo, swallows /foo/bar.
 - disambiguate_imports sees we didn't get /foo/bar, cancels ambiguous
   import.
 -> we are left with /foo/bar (and content) in cache, even tho it is
   non-auth.

Fix by pulling the try_trim_non_auth_subtree() back out of
cancel_ambiguous_import, and trimming the containing subtree in the
disambiguate (resolve completion) case.  (For the journal replay case the
subtree structure is deterministic and no such check is needed.)

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDCache.cc
src/mds/journal.cc

index 695ce557cf5225400975db45998a74eb9cf213d1..bf81d281914b14e59e33df502c3a95a69d28f3bb 100644 (file)
@@ -2821,6 +2821,15 @@ void MDCache::disambiguate_imports()
     if (dir->authority() != me_ambig) {
       dout(10) << "ambiguous import auth known, must not be me " << *dir << dendl;
       cancel_ambiguous_import(dir);
+
+      // subtree may have been swallowed by another node claiming dir
+      // as their own.
+      CDir *root = get_subtree_root(dir);
+      if (root != dir)
+       dout(10) << "  subtree root is " << *root << dendl;
+      assert(root->dir_auth.first != mds->whoami);  // no us!
+      try_trim_non_auth_subtree(root);
+
       mds->mdlog->start_submit_entry(new EImportFinish(dir, false));
     } else {
       dout(10) << "ambiguous import auth unclaimed, must be me " << *dir << dendl;
@@ -2881,8 +2890,6 @@ void MDCache::cancel_ambiguous_import(CDir *dir)
           << " " << *dir
           << dendl;
   my_ambiguous_imports.erase(df);
-
-  try_trim_non_auth_subtree(dir);
 }
 
 void MDCache::finish_ambiguous_import(dirfrag_t df)
index 242f718ea25e0b2a0d12cac52426cea845f229d2..0e66e2262e2e1c515795f5eecff6d0a21294954e 100644 (file)
@@ -1225,7 +1225,8 @@ void EImportFinish::replay(MDS *mds)
       mds->mdcache->get_ambiguous_import_bounds(base, bounds);
       mds->mdcache->adjust_bounded_subtree_auth(dir, bounds, pair<int,int>(CDIR_AUTH_UNKNOWN, CDIR_AUTH_UNKNOWN));
       mds->mdcache->cancel_ambiguous_import(dir);
-    }
+      mds->mdcache->try_trim_non_auth_subtree(dir);
+   }
   } else {
     dout(10) << "EImportFinish.replay " << base << " success=" << success
             << " on subtree not marked as ambiguous"