]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: handle aux subtree when splitting/merging dirfrag
authorYan, Zheng <zyan@redhat.com>
Fri, 5 May 2017 03:35:16 +0000 (11:35 +0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Sat, 6 May 2017 03:15:19 +0000 (23:15 -0400)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CDir.cc
src/mds/CDir.h
src/mds/MDCache.cc

index cf82a57a45ccc67d717f56eb6976ba3ea980828b..9ffe8f1db4acd5bda882cff37c8291b95e8810a3 100644 (file)
@@ -1012,7 +1012,16 @@ void CDir::merge(list<CDir*>& subs, list<MDSInternalContextBase*>& waiters, bool
 {
   dout(10) << "merge " << subs << dendl;
 
-  set_dir_auth(subs.front()->get_dir_auth());
+  mds_authority_t new_auth = CDIR_AUTH_DEFAULT;
+  for (auto dir : subs) {
+    if (dir->get_dir_auth() != CDIR_AUTH_DEFAULT ||
+       dir->get_dir_auth() != new_auth) {
+      assert(new_auth == CDIR_AUTH_DEFAULT);
+      new_auth = dir->get_dir_auth();
+    }
+  }
+
+  set_dir_auth(new_auth);
   prepare_new_fragment(replay);
 
   nest_info_t rstatdiff;
@@ -1021,8 +1030,7 @@ void CDir::merge(list<CDir*>& subs, list<MDSInternalContextBase*>& waiters, bool
   version_t rstat_version = inode->get_projected_inode()->rstat.version;
   version_t dirstat_version = inode->get_projected_inode()->dirstat.version;
 
-  for (list<CDir*>::iterator p = subs.begin(); p != subs.end(); ++p) {
-    CDir *dir = *p;
+  for (auto dir : subs) {
     dout(10) << " subfrag " << dir->get_frag() << " " << *dir << dendl;
     assert(!dir->is_auth() || dir->is_complete() || replay);
 
index 447ca3cb8a6e13e9638c272aef38cd1b0ca0edd2..4a788b0cb2677a368adfd323cee04d6536b3d842 100644 (file)
@@ -137,6 +137,7 @@ public:
   (STATE_DIRTY|
    STATE_EXPORTBOUND |
    STATE_IMPORTBOUND |
+   STATE_AUXSUBTREE |
    STATE_REJOINUNDEF);
 
   // -- rep spec --
index 4954fdc22eada0a8ef8d78b5f09e365399a88c44..b9057a7ebe9c8fe5741fed4ae749c7aeb8f94aa0 100644 (file)
@@ -10631,8 +10631,10 @@ void MDCache::adjust_dir_fragments(CInode *diri,
        subtrees[parent_subtree].erase(dir);
        for (list<CDir*>::iterator p = resultfrags.begin();
             p != resultfrags.end();
-            ++p)
+            ++p) {
+         assert((*p)->is_subtree_root());
          subtrees[parent_subtree].insert(*p);
+       }
       }
       
       // adjust my bounds.
@@ -10686,6 +10688,7 @@ void MDCache::adjust_dir_fragments(CInode *diri,
     diri->add_dirfrag(f);
 
     if (was_subtree) {
+      assert(f->is_subtree_root());
       subtrees[f].swap(new_bounds);
       if (parent_subtree)
        subtrees[parent_subtree].insert(f);