]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix bounds on import
authorSage Weil <sage.weil@dreamhost.com>
Tue, 22 Mar 2011 21:47:15 +0000 (14:47 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 1 Apr 2011 21:34:32 +0000 (14:34 -0700)
The add_ambiguous_import() call was clobbering the bounds field for
EImportStart::replay(), screwing up the subtree auth adjustment.  Make the
argument const.

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

index f263ed5ca052ebbca5b3f7fdb02070537b5e1a14..18f206ec4845a6ae5e2b14b81b28f85dfc1d2e58 100644 (file)
@@ -2811,10 +2811,10 @@ void MDCache::disambiguate_imports()
 }
 
 
-void MDCache::add_ambiguous_import(dirfrag_t base, vector<dirfrag_t>& bounds) 
+void MDCache::add_ambiguous_import(dirfrag_t base, const vector<dirfrag_t>& bounds) 
 {
   assert(my_ambiguous_imports.count(base) == 0);
-  my_ambiguous_imports[base].swap(bounds);
+  my_ambiguous_imports[base] = bounds;
 }
 
 
@@ -5593,26 +5593,29 @@ void MDCache::try_trim_non_auth_subtree(CDir *dir)
     try_subtree_merge(dir);
   } else {
     // can we trim this subtree (and possibly our ancestors) too?
-    CInode *diri;
     while (true) {
-      dout(10) << " closing empty subtree " << *dir << dendl;
-      remove_subtree(dir);
-      dir->mark_clean();
-      diri = dir->get_inode();
-      diri->close_dirfrag(dir->get_frag());
-
+      CInode *diri = dir->get_inode();
       if (diri->is_base())
        break;
 
-      dir = get_subtree_root(diri->get_parent_dir());
-      if (dir->get_dir_auth().first == mds->whoami)
+      CDir *psub = get_subtree_root(diri->get_parent_dir());
+      dout(10) << " parent subtree is " << *psub << dendl;
+      if (psub->get_dir_auth().first == mds->whoami)
        break;  // we are auth, keep.
 
-      dout(10) << " parent subtree also non-auth: " << *dir << dendl;
-      if (trim_non_auth_subtree(dir))
+      dout(10) << " closing empty non-auth subtree " << *dir << dendl;
+      remove_subtree(dir);
+      dir->mark_clean();
+      diri->close_dirfrag(dir->get_frag());
+
+      dout(10) << " parent subtree also non-auth: " << *psub << dendl;
+      if (trim_non_auth_subtree(psub))
        break;
+      dir = psub;
     }
   }
+
+  show_subtrees();
 }
 
 
index 48010792d691e7e453c08359dd3aead9e1597b77..cfb5aee5513231b9ac26797d6c9be3ed368b341c 100644 (file)
@@ -691,7 +691,7 @@ public:
   }
 
   // ambiguous imports
-  void add_ambiguous_import(dirfrag_t base, vector<dirfrag_t>& bounds);
+  void add_ambiguous_import(dirfrag_t base, const vector<dirfrag_t>& bounds);
   void add_ambiguous_import(CDir *base, const set<CDir*>& bounds);
   bool have_ambiguous_import(dirfrag_t base) {
     return my_ambiguous_imports.count(base);
index 116daa69be9b28f78b847eda078acc00a9f2258c..6a739e01bd11d81e6e0b007677cb091be979dad2 100644 (file)
@@ -1077,7 +1077,7 @@ void EImportStart::update_segment()
 
 void EImportStart::replay(MDS *mds)
 {
-  dout(10) << "EImportStart.replay " << base << dendl;
+  dout(10) << "EImportStart.replay " << base << " bounds " << bounds << dendl;
   //metablob.print(*_dout);
   metablob.replay(mds, _segment);