]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: no early complete from scatter_nudge after partial work
authorSage Weil <sage@newdream.net>
Mon, 22 Mar 2010 19:08:25 +0000 (12:08 -0700)
committerSage Weil <sage@newdream.net>
Mon, 22 Mar 2010 20:35:03 +0000 (13:35 -0700)
Do not complete the Context if we only accomplish partial work.
Instead, keep going until we block.

src/mds/Locker.cc
src/mds/journal.cc

index 9b70a0931b7f74e0eec8537ea75208845c1ecffc..f3eef4ba2f6de1b11ee3b4b639c4f11ff5f256de 100644 (file)
@@ -2946,44 +2946,47 @@ void Locker::scatter_nudge(ScatterLock *lock, Context *c, bool forcelockchange)
   }
 
   if (p->is_auth()) {
-    if (c)
-      lock->add_waiter(SimpleLock::WAIT_STABLE, c);
-    if (lock->is_stable()) {
-      // can we do it now?
-      //  (only if we're not replicated.. if we are, we really do need
-      //   to nudge the lock state!)
-      if (!forcelockchange && lock->can_wrlock(-1)) {
-       dout(10) << "scatter_nudge auth, propagating " << *lock << " on " << *p << dendl;
-       scatter_writebehind(lock);
-       return;
-      }
-
-      // adjust lock state
-      dout(10) << "scatter_nudge auth, scatter/unscattering " << *lock << " on " << *p << dendl;
-      switch (lock->get_type()) {
-      case CEPH_LOCK_IFILE:
-       if (p->is_replicated() && lock->get_state() != LOCK_MIX)
-         file_mixed((ScatterLock*)lock);
-       else if (lock->get_state() != LOCK_LOCK)
-         simple_lock((ScatterLock*)lock);
-       else
-         simple_sync((ScatterLock*)lock);
-       break;
+    while (true) {
+      if (lock->is_stable()) {
+       // can we do it now?
+       //  (only if we're not replicated.. if we are, we really do need
+       //   to nudge the lock state!)
+       if (!forcelockchange && lock->can_wrlock(-1)) {
+         dout(10) << "scatter_nudge auth, propagating " << *lock << " on " << *p << dendl;
+         scatter_writebehind(lock);
+         return;
+       }
 
-      case CEPH_LOCK_IDFT:
-      case CEPH_LOCK_INEST:
-       if (p->is_replicated() && lock->get_state() != LOCK_MIX)
-         file_mixed(lock);
-       else if (lock->get_state() != LOCK_LOCK)
-         simple_lock(lock);
-       else
-         simple_sync(lock);
-       break;
-      default:
-       assert(0);
+       // adjust lock state
+       dout(10) << "scatter_nudge auth, scatter/unscattering " << *lock << " on " << *p << dendl;
+       switch (lock->get_type()) {
+       case CEPH_LOCK_IFILE:
+         if (p->is_replicated() && lock->get_state() != LOCK_MIX)
+           file_mixed((ScatterLock*)lock);
+         else if (lock->get_state() != LOCK_LOCK)
+           simple_lock((ScatterLock*)lock);
+         else
+           simple_sync((ScatterLock*)lock);
+         break;
+         
+       case CEPH_LOCK_IDFT:
+       case CEPH_LOCK_INEST:
+         if (p->is_replicated() && lock->get_state() != LOCK_MIX)
+           file_mixed(lock);
+         else if (lock->get_state() != LOCK_LOCK)
+           simple_lock(lock);
+         else
+           simple_sync(lock);
+         break;
+       default:
+         assert(0);
+       }
+      } else {
+       dout(10) << "scatter_nudge auth, waiting for stable " << *lock << " on " << *p << dendl;
+       if (c)
+         lock->add_waiter(SimpleLock::WAIT_STABLE, c);
+       return;
       }
-    } else {
-      dout(10) << "scatter_nudge auth, waiting for stable " << *lock << " on " << *p << dendl;
     }
   } else {
     dout(10) << "scatter_nudge replica, requesting scatter/unscatter of " 
index 44ce5b0579c7a8c0395d703566f1c3e18787ce36..ba16fd44c37fb493938cb06ead87a2277485f06c 100644 (file)
@@ -296,13 +296,9 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     }
   }
 
-  if (gather && gather->empty()) {
-    delete gather;
-    gather = NULL;
-  }
-
   if (gather) {
     dout(6) << "LogSegment(" << offset << ").try_to_expire waiting" << dendl;
+    assert(!gather->empty());
     mds->mdlog->flush();
   } else {
     dout(6) << "LogSegment(" << offset << ").try_to_expire success" << dendl;