From: Sage Weil Date: Mon, 24 Aug 2009 21:02:01 +0000 (-0700) Subject: mds: propagate scatterlock data w/o changing lock state in scatter_nudge X-Git-Tag: v0.14~128 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e433110bd5cabc98745c540dee5c6fb19c28039f;p=ceph.git mds: propagate scatterlock data w/o changing lock state in scatter_nudge If we can take the wrlock already, there's no need to adjust the lock state... just call scatter_writebehind. --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 4562fb1d360d..86e96eadb98e 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -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 "