]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix ambiguous check when journaling subtree map
authorSage Weil <sage.weil@dreamhost.com>
Fri, 22 Jul 2011 15:41:18 +0000 (08:41 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 22 Jul 2011 15:41:18 +0000 (08:41 -0700)
We journal the EImportStart--and become ambiguous--when we set the state
to IMPORT_LOGGINGSTART; the subtree auth becomes ambiguous a few stages
before that.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mds/MDCache.cc
src/mds/Migrator.h

index 421439fe4dd3f3436469ae94103b5257d6d195f8..48ad1d450b69d5f6e7f68ec570d969036d9334a7 100644 (file)
@@ -2207,8 +2207,7 @@ ESubtreeMap *MDCache::create_subtree_map()
     if (dir->get_dir_auth().first != mds->whoami)
       continue;
 
-    if (dir->is_ambiguous_dir_auth() &&
-       migrator->is_importing(dir->dirfrag())) {
+    if (migrator->is_ambiguous_import(dir->dirfrag())) {
       dout(15) << " ambig subtree " << *dir << dendl;
       le->ambiguous_subtrees.insert(dir->dirfrag());
     } else {
@@ -2360,10 +2359,8 @@ void MDCache::send_resolve_now(int who)
     if (mds->is_resolve() && my_ambiguous_imports.count(dir->dirfrag()))
       continue;  // we'll add it below
     
-    if (migrator->is_importing(dir->dirfrag())) {
+    if (migrator->is_ambiguous_import(dir->dirfrag())) {
       // ambiguous (mid-import)
-      //  NOTE: because we are first authority, import state is at least IMPORT_LOGGINSTART.
-      assert(migrator->get_import_state(dir->dirfrag()) >= Migrator::IMPORT_LOGGINGSTART);
       set<CDir*> bounds;
       get_subtree_bounds(dir, bounds);
       vector<dirfrag_t> dfls;
index da33596a441e5b464f47c6d793ebbee247567f9f..7827667b208d20802658b69c0c20b508e281df5a 100644 (file)
@@ -143,6 +143,16 @@ public:
   }
   bool is_importing() { return !import_state.empty(); }
 
+  bool is_ambiguous_import(dirfrag_t df) {
+    map<dirfrag_t,int>::iterator p = import_state.find(df);
+    if (p == import_state.end())
+      return false;
+    if (p->second >= IMPORT_LOGGINGSTART &&
+       p->second < IMPORT_ABORTING)
+      return true;
+    return false;
+  }
+
   int get_import_state(dirfrag_t df) {
     assert(import_state.count(df));
     return import_state[df];