]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle export pin on unjournaled directory
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 5 May 2017 23:10:27 +0000 (19:10 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 5 May 2017 23:10:27 +0000 (19:10 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/CDir.cc
src/mds/CInode.cc

index 979b8caae5c1920e7d9c6f4ffa7767663ca225d9..cf82a57a45ccc67d717f56eb6976ba3ea980828b 100644 (file)
@@ -1231,10 +1231,7 @@ void CDir::add_waiter(uint64_t tag, MDSInternalContextBase *c)
     }
   }
 
-  if (tag & WAIT_CREATED) {
-    assert(state_test(STATE_CREATING));
-    assert(state_test(STATE_FRAGMENTING));
-  }
+  assert(!(tag & WAIT_CREATED) || state_test(STATE_CREATING));
 
   MDSCacheObject::add_waiter(tag, c);
 }
@@ -1349,11 +1346,9 @@ void CDir::mark_new(LogSegment *ls)
   ls->new_dirfrags.push_back(&item_new);
   state_clear(STATE_CREATING);
 
-  if (state_test(CDir::STATE_FRAGMENTING)) {
-    list<MDSInternalContextBase*> ls;
-    take_waiting(CDir::WAIT_CREATED, ls);
-    cache->mds->queue_waiters(ls);
-  }
+  list<MDSInternalContextBase*> waiters;
+  take_waiting(CDir::WAIT_CREATED, waiters);
+  cache->mds->queue_waiters(waiters);
 }
 
 void CDir::mark_clean()
index 4566d7885c7fdca7f66ac9ae2dda933b67f79a1b..50ff269f67e96186b33a7a1155f5db615d81b502 100644 (file)
@@ -4417,14 +4417,21 @@ private:
 void CInode::maybe_export_pin()
 {
   if (g_conf->mds_bal_export_pin && is_dir() && is_normal()) {
-    dout(20) << "maybe_export_pin " << *this << dendl;
-    mds_rank_t pin = get_projected_inode()->export_pin;
+    mds_rank_t pin = get_export_pin(false);
+    dout(20) << "maybe_export_pin export_pin=" << pin << " on " << *this << dendl;
     if (pin == mdcache->mds->get_nodeid()) {
       for (auto it = dirfrags.begin(); it != dirfrags.end(); it++) {
         CDir *cd = it->second;
+        dout(20) << "dirfrag: " << *cd << dendl;
+        if (cd->state_test(CDir::STATE_CREATING)) {
+          /* inode is not journaled yet */
+          cd->add_waiter(CDir::WAIT_CREATED, new C_CInode_ExportPin(this));
+          dout(15) << "aux subtree pin of " << *cd << " delayed for finished creation" << dendl;
+          continue;
+        }
         if (cd->state_test(CDir::STATE_AUXSUBTREE)) continue;
         CDir *subtree = mdcache->get_subtree_root(cd);
-        if (!subtree) continue;
+        assert(subtree);
         if (subtree->is_ambiguous_auth()) {
           subtree->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_CInode_ExportPin(this));
           dout(15) << "aux subtree pin of " << *cd << " delayed for single auth on subtree " << *subtree << dendl;