]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: propagate scatterlock data w/o changing lock state in scatter_nudge
authorSage Weil <sage@newdream.net>
Mon, 24 Aug 2009 21:02:01 +0000 (14:02 -0700)
committerSage Weil <sage@newdream.net>
Mon, 24 Aug 2009 21:02:01 +0000 (14:02 -0700)
If we can take the wrlock already, there's no need to adjust the
lock state... just call scatter_writebehind.

src/mds/Locker.cc

index 4562fb1d360d3e8eaa0d7c9c1ef351dff65014f0..86e96eadb98e4edf8202a9faafd67ffc11bd53e8 100644 (file)
@@ -2827,6 +2827,9 @@ void Locker::scatter_writebehind_finish(ScatterLock *lock, Mutation *mut)
   mut->cleanup();
   delete mut;
 
+  if (lock->is_stable())
+    lock->finish_waiters(ScatterLock::WAIT_STABLE);
+
   //scatter_eval_gather(lock);
 }
 
@@ -2910,10 +2913,18 @@ void Locker::scatter_nudge(ScatterLock *lock, Context *c)
   }
 
   if (p->is_auth()) {
-    dout(10) << "scatter_nudge auth, scatter/unscattering " << *lock << " on " << *p << dendl;
     if (c)
       lock->add_waiter(SimpleLock::WAIT_STABLE, c);
     if (lock->is_stable()) {
+      // can we do it now?
+      if (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)
@@ -2936,6 +2947,8 @@ void Locker::scatter_nudge(ScatterLock *lock, Context *c)
       default:
        assert(0);
       }
+    } else {
+      dout(10) << "scatter_nudge auth, waiting for stable " << *lock << " on " << *p << dendl;
     }
   } else {
     dout(10) << "scatter_nudge replica, requesting scatter/unscatter of "