]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
* more partial canges, untested
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 29 Jun 2007 16:43:57 +0000 (16:43 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 29 Jun 2007 16:43:57 +0000 (16:43 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1459 29311d96-e01e-0410-9327-a35deaab8ce9

branches/sage/cephmds2/TODO
branches/sage/cephmds2/mds/Locker.cc
branches/sage/cephmds2/mds/Locker.h
branches/sage/cephmds2/mds/MDCache.cc
branches/sage/cephmds2/mds/Migrator.cc

index e972c9bf81b8d6522cf72db5b4ab1e2f00c09ac6..1be4677f036aed24bdce80998c212d9c3e8b54c0 100644 (file)
@@ -52,6 +52,7 @@ sage mds
 
 - make locks auth_pin for unstable states.
 
+
 - fix rename to delay the _apply.
   - need to fix locking vs migration first.
 
index ffe721c502e3738ccb4f77777a6ef52029ee4537..2332208dde482fc86f622d2097ed18913288fde7 100644 (file)
@@ -584,7 +584,7 @@ void Locker::handle_inode_file_caps(MInodeFileCaps *m)
   else
     in->mds_caps_wanted.erase(m->get_from());
 
-  file_eval(&in->filelock);  // ** may or may not be auth_pinned **
+  try_file_eval(&in->filelock);  // ** may or may not be auth_pinned **
   delete m;
 }
 
@@ -674,7 +674,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
   }  
 
   // reevaluate, waiters
-  file_eval(&in->filelock);  // ** may or may not be auth_pinned **
+  try_file_eval(&in->filelock);  // ** may or may not be auth_pinned **
   in->finish_waiting(CInode::WAIT_CAPS, 0);
 
   delete m;
@@ -844,7 +844,7 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
     } else {
       dout(7) << "handle_simple_lock " << *lock << " on " << *lock->get_parent() << " from " << from
              << ", last one" << endl;
-      simple_eval(lock);
+      simple_eval_gather(lock);
     }
     break;
 
@@ -864,6 +864,33 @@ public:
   }
 };
 
+void Locker::simple_eval_gather(SimpleLock *lock)
+{
+  dout(10) << "simple_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
+
+  // finished gathering?
+  if (lock->get_state() == LOCK_GLOCKR &&
+      !lock->is_gathering() &&
+      !lock->is_rdlocked()) {
+    dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << endl;
+
+    // replica: tell auth
+    if (!lock->get_parent()->is_auth()) {
+      int auth = lock->get_parent()->authority().first;
+      if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) 
+       mds->send_message_mds(new MLock(lock, LOCK_AC_LOCKACK, mds->get_nodeid()), 
+                             lock->get_parent()->authority().first, MDS_PORT_LOCKER);
+    }
+    
+    lock->set_state(LOCK_LOCK);
+    lock->finish_waiters(SimpleLock::WAIT_STABLE|SimpleLock::WAIT_WR);
+
+    // re-eval?
+    if (lock->get_parent()->can_auth_pin())
+      simple_eval(lock);
+  }
+}
+
 void Locker::simple_eval(SimpleLock *lock)
 {
   dout(10) << "simple_eval " << *lock << " on " << *lock->get_parent() << endl;
@@ -893,24 +920,6 @@ void Locker::simple_eval(SimpleLock *lock)
   }
   */
 
-  // finished gathering?
-  if (lock->get_state() == LOCK_GLOCKR &&
-      !lock->is_gathering() &&
-      !lock->is_rdlocked()) {
-    dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << endl;
-
-    // replica: tell auth
-    if (!lock->get_parent()->is_auth()) {
-      int auth = lock->get_parent()->authority().first;
-      if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) 
-       mds->send_message_mds(new MLock(lock, LOCK_AC_LOCKACK, mds->get_nodeid()), 
-                             lock->get_parent()->authority().first, MDS_PORT_LOCKER);
-    }
-    
-    lock->set_state(LOCK_LOCK);
-    lock->finish_waiters(SimpleLock::WAIT_STABLE|SimpleLock::WAIT_WR);
-  }
-
   // stable -> sync?
   if (lock->get_parent()->is_auth() &&
       lock->is_stable() &&
@@ -1029,7 +1038,7 @@ void Locker::simple_rdlock_finish(SimpleLock *lock, MDRequest *mdr)
   
   // last one?
   if (!lock->is_rdlocked())
-    simple_eval(lock);
+    simple_eval_gather(lock);
 }
 
 bool Locker::simple_xlock_start(SimpleLock *lock, MDRequest *mdr)
@@ -1122,7 +1131,7 @@ void Locker::simple_xlock_finish(SimpleLock *lock, MDRequest *mdr)
   lock->finish_waiters(SimpleLock::WAIT_WR, 0); 
 
   // eval
-  simple_eval(lock);
+  simple_eval_gather(lock);
 }
 
 
@@ -1231,7 +1240,7 @@ void Locker::scatter_rdlock_finish(ScatterLock *lock, MDRequest *mdr)
     mdr->locks.erase(lock);
   }
   
-  scatter_eval(lock);
+  scatter_eval_gather(lock);
 }
 
 
@@ -1282,7 +1291,7 @@ void Locker::scatter_wrlock_finish(ScatterLock *lock, MDRequest *mdr)
     mdr->locks.erase(lock);
   }
   
-  scatter_eval(lock);
+  scatter_eval_gather(lock);
 }
 
 
@@ -1296,18 +1305,10 @@ public:
   }
 };
 
-void Locker::scatter_eval(ScatterLock *lock)
-{
-  dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << endl;
 
-  // unstable and ambiguous auth?
-  if (!lock->is_stable() &&
-      lock->get_parent()->is_ambiguous_auth()) {
-    dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
-    //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
-    lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_ScatterEval(this, lock));
-    return;
-  }
+void Locker::scatter_eval_gather(ScatterLock *lock)
+{
+  dout(10) << "scatter_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
 
   if (!lock->get_parent()->is_auth()) {
     // REPLICA
@@ -1406,22 +1407,41 @@ void Locker::scatter_eval(ScatterLock *lock)
     }
 
 
-    // stable -> ???
-    if (lock->is_stable()) {
-      if (((CInode*)lock->get_parent())->has_subtree_root_dirfrag()) {
-       // i _should_ be scattered.
-       if (!lock->is_rdlocked() &&
-           !lock->is_xlocked()) {
-         dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << endl;
-         scatter_scatter(lock);
-       }
-      } else {
-       // i _should_ be sync.
-       if (!lock->is_wrlocked() &&
-           !lock->is_xlocked()) {
-         dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << endl;
-         scatter_sync(lock);
-       }
+    // re-eval?
+    if (lock->is_stable() &&
+       lock->get_parent()->can_auth_pin())
+      scatter_eval(lock);
+  }
+}
+
+void Locker::scatter_eval(ScatterLock *lock)
+{
+  dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << endl;
+
+  // unstable and ambiguous auth?
+  if (!lock->is_stable() &&
+      lock->get_parent()->is_ambiguous_auth()) {
+    dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
+    //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
+    lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_ScatterEval(this, lock));
+    return;
+  }
+
+  if (lock->get_parent()->is_auth() &&
+      lock->is_stable()) {
+    if (((CInode*)lock->get_parent())->has_subtree_root_dirfrag()) {
+      // i _should_ be scattered.
+      if (!lock->is_rdlocked() &&
+         !lock->is_xlocked()) {
+       dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << endl;
+       scatter_scatter(lock);
+      }
+    } else {
+      // i _should_ be sync.
+      if (!lock->is_wrlocked() &&
+         !lock->is_xlocked()) {
+       dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << endl;
+       scatter_sync(lock);
       }
     }
   }
@@ -1800,7 +1820,7 @@ void Locker::file_rdlock_finish(FileLock *lock, MDRequest *mdr)
   mdr->locks.erase(lock);
 
   if (!lock->is_rdlocked()) 
-    file_eval(lock);
+    file_eval_gather(lock);
 }
 
 
@@ -1864,7 +1884,7 @@ void Locker::file_xlock_finish(FileLock *lock, MDRequest *mdr)
 
   //// drop lock?
   //if (!lock->is_waiter_for(SimpleLock::WAIT_STABLE)) 
-  file_eval(lock);
+  file_eval_gather(lock);
 }
 
 
@@ -1885,21 +1905,34 @@ public:
   }
 };
 
-
-void Locker::file_eval(FileLock *lock)
+void Locker::try_file_eval(FileLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
 
   // unstable and ambiguous auth?
   if (!lock->is_stable() &&
       in->is_ambiguous_auth()) {
-    dout(7) << "file_eval not stable and ambiguous auth, waiting on " << *in << endl;
+    dout(7) << "try_file_eval not stable and ambiguous auth, waiting on " << *in << endl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     in->add_waiter(CInode::WAIT_SINGLEAUTH, new C_Locker_FileEval(this, lock));
     return;
   }
 
+  if (!lock->get_parent()->can_auth_pin()) {
+    dout(7) << "try_file_eval can't auth_pin, waiting on " << *in << endl;
+    //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
+    in->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_Locker_FileEval(this, lock));
+    return;
+  }
+
+  file_eval(lock);
+}
+
+
 
+void Locker::file_eval_gather(FileLock *lock)
+{
+  CInode *in = (CInode*)lock->get_parent();
   int issued = in->get_caps_issued();
 
   // [auth] finished gather?
@@ -2019,10 +2052,30 @@ void Locker::file_eval(FileLock *lock)
     }
   }
 
+
+  // re-eval?
+  if (lock->get_parent()->is_auth() &&
+      lock->is_stable() &&
+      lock->get_parent()->can_auth_pin())
+    file_eval(lock);
+}
+
+void Locker::file_eval(FileLock *lock)
+{
+  CInode *in = (CInode*)lock->get_parent();
+
+  // unstable and ambiguous auth?
+  if (!lock->is_stable() &&
+      in->is_ambiguous_auth()) {
+    dout(7) << "file_eval not stable and ambiguous auth, waiting on " << *in << endl;
+    //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
+    in->add_waiter(CInode::WAIT_SINGLEAUTH, new C_Locker_FileEval(this, lock));
+    return;
+  }
+
   // !stable -> do nothing.
   if (!lock->is_stable()) return; 
 
-
   // stable.
   assert(lock->is_stable());
 
@@ -2410,7 +2463,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     lock->get_rdlock();
     lock->finish_waiters(SimpleLock::WAIT_RD|SimpleLock::WAIT_STABLE);
     lock->put_rdlock();
-    file_eval(lock);
+    file_eval_gather(lock);
     break;
     
   case LOCK_AC_LOCK:
@@ -2469,7 +2522,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     
     // waiters
     lock->finish_waiters(SimpleLock::WAIT_WR|SimpleLock::WAIT_STABLE);
-    file_eval(lock);
+    file_eval_gather(lock);
     break;
 
  
@@ -2490,7 +2543,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
              << ", last one" << endl;
-      file_eval(lock);
+      file_eval_gather(lock);
     }
     break;
     
@@ -2513,7 +2566,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
              << ", last one" << endl;
-      file_eval(lock);
+      file_eval_gather(lock);
     }
     break;
 
@@ -2528,7 +2581,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
              << ", last one" << endl;
-      file_eval(lock);
+      file_eval_gather(lock);
     }
     break;
 
index a2a26592aea3b8c91220ff36bc11e737c70e3992..f5d297186bc741587ea722d5e88fd8af0c94f715 100644 (file)
@@ -86,6 +86,7 @@ protected:
 
   // simple
 public:
+  void simple_eval_gather(SimpleLock *lock);
   void simple_eval(SimpleLock *lock);
   bool simple_rdlock_try(SimpleLock *lock, Context *con);
 protected:
@@ -104,6 +105,7 @@ public:
 
   // scatter
 public:
+  void scatter_eval_gather(ScatterLock *lock);
   void scatter_eval(ScatterLock *lock);
 protected:
   void handle_scatter_lock(ScatterLock *lock, MLock *m);
@@ -118,7 +120,9 @@ protected:
 
   // file
 public:
+  void file_eval_gather(FileLock *lock);
   void file_eval(FileLock *lock);
+  void try_file_eval(FileLock *lock);
 protected:
   void handle_file_lock(FileLock *lock, MLock *m);
   bool file_sync(FileLock *lock);
index 28e46609dc8d04e1bdeb99420ca7e44f6a222e12..2a6eeff95da223c8b36fff64c333eb7600fc12b7 100644 (file)
@@ -2821,21 +2821,21 @@ void MDCache::inode_remove_replica(CInode *in, int from)
   // note: this code calls _eval more often than it needs to!
   // fix lock
   if (in->authlock.remove_replica(from))
-    mds->locker->simple_eval(&in->authlock);
+    mds->locker->simple_eval_gather(&in->authlock);
   if (in->linklock.remove_replica(from))
-    mds->locker->simple_eval(&in->linklock);
+    mds->locker->simple_eval_gather(&in->linklock);
   if (in->dirfragtreelock.remove_replica(from))
-    mds->locker->simple_eval(&in->dirfragtreelock);
+    mds->locker->simple_eval_gather(&in->dirfragtreelock);
   if (in->filelock.remove_replica(from))
-    mds->locker->simple_eval(&in->filelock);
+    mds->locker->simple_eval_gather(&in->filelock);
   
   // alone now?
   if (!in->is_replicated()) {
-    mds->locker->simple_eval(&in->authlock);
-    mds->locker->simple_eval(&in->linklock);
-    mds->locker->simple_eval(&in->dirfragtreelock);
-    mds->locker->file_eval(&in->filelock);
-    mds->locker->scatter_eval(&in->dirlock);
+    mds->locker->simple_eval_gather(&in->authlock);
+    mds->locker->simple_eval_gather(&in->linklock);
+    mds->locker->simple_eval_gather(&in->dirfragtreelock);
+    mds->locker->file_eval_gather(&in->filelock);
+    mds->locker->scatter_eval_gather(&in->dirlock);
   }
 }
 
index c14aa6fc28aefe48b528604ca73346e99b2fba74..83189d094acbd6cdd6946390ca589fbb34857914 100644 (file)
@@ -1719,11 +1719,6 @@ void Migrator::import_finish(CDir *dir, bool now)
   dout(5) << "finishing any waiters on imported data" << endl;
   dir->finish_waiting(CDir::WAIT_IMPORTED);
 
-  // log it
-  if (mds->logger) {
-    //mds->logger->set("nex", cache->exports.size());
-    //mds->logger->set("nim", cache->imports.size());
-  }
   cache->show_subtrees();
   audit();
 
@@ -1782,6 +1777,7 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int ol
     in->remove_replica(mds->get_nodeid());
   
   // twiddle locks
+  /*
   if (in->authlock.do_import(oldauth, mds->get_nodeid()))
     mds->locker->simple_eval(&in->authlock);
   if (in->linklock.do_import(oldauth, mds->get_nodeid()))
@@ -1790,6 +1786,7 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int ol
     mds->locker->simple_eval(&in->dirfragtreelock);
   if (in->dirlock.do_import(oldauth, mds->get_nodeid()))
     mds->locker->scatter_eval(&in->dirlock);
+  */
 
   // caps
   for (set<int>::iterator it = merged_client_caps.begin();
@@ -1807,8 +1804,10 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int ol
   }
 
   // filelock
+  /*
   if (in->filelock.do_import(oldauth, mds->get_nodeid()))
     mds->locker->simple_eval(&in->filelock);
+  */
 }