From bafff04248df9f2e2713b4792e3a16a7b0b7b72c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Mar 2011 14:47:15 -0700 Subject: [PATCH] mds: fix bounds on import 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 --- src/mds/MDCache.cc | 29 ++++++++++++++++------------- src/mds/MDCache.h | 2 +- src/mds/journal.cc | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index f263ed5ca052e..18f206ec4845a 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2811,10 +2811,10 @@ void MDCache::disambiguate_imports() } -void MDCache::add_ambiguous_import(dirfrag_t base, vector& bounds) +void MDCache::add_ambiguous_import(dirfrag_t base, const vector& 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(); } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 48010792d691e..cfb5aee551323 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -691,7 +691,7 @@ public: } // ambiguous imports - void add_ambiguous_import(dirfrag_t base, vector& bounds); + void add_ambiguous_import(dirfrag_t base, const vector& bounds); void add_ambiguous_import(CDir *base, const set& bounds); bool have_ambiguous_import(dirfrag_t base) { return my_ambiguous_imports.count(base); diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 116daa69be9b2..6a739e01bd11d 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -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); -- 2.39.5