From 7ae075f24707dcc5877acf70198293f3ef948296 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 18 Mar 2009 13:46:04 -0700 Subject: [PATCH] mds: remember scatter requests We want to make sure a REQSCATTER is remembered the next time we reconsider the lock state, even if it arrives when the lock is unstable (say, during EXCL->LOCK or some other transition that won't affect the replica state and elicit a new REQSCATTER). --- src/mds/Locker.cc | 8 ++++++-- src/mds/ScatterLock.h | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 1e0b382671fd1..dd05e09f33284 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -490,6 +490,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first) lock->encode_locked_state(softdata); send_lock_message(lock, LOCK_AC_MIX, softdata); } + ((ScatterLock*)lock)->clear_scatter_wanted(); break; // to sync @@ -2861,8 +2862,8 @@ void Locker::file_eval(ScatterLock *lock) else if (lock->get_state() != LOCK_MIX && //!lock->is_rdlocked() && //!lock->is_waiter_for(SimpleLock::WAIT_WR) && - (wanted & CEPH_CAP_GRD) && - (wanted & CEPH_CAP_GWR)) { + (lock->get_scatter_wanted() || + (wanted & (CEPH_CAP_GRD|CEPH_CAP_GWR)))) { dout(7) << "file_eval stable, bump to mixed " << *lock << " on " << *lock->get_parent() << dendl; file_mixed(lock); @@ -2910,6 +2911,7 @@ void Locker::file_mixed(ScatterLock *lock) // change lock lock->set_state(LOCK_MIX); + lock->clear_scatter_wanted(); issue_caps(in); } else { // gather? @@ -2952,6 +2954,7 @@ void Locker::file_mixed(ScatterLock *lock) else { in->try_drop_loner(); lock->set_state(LOCK_MIX); + lock->clear_scatter_wanted(); if (in->is_replicated()) { bufferlist softdata; lock->encode_locked_state(softdata); @@ -3167,6 +3170,7 @@ void Locker::handle_file_lock(ScatterLock *lock, MLock *m) } else { dout(7) << "handle_file_lock ignoring scatter request on " << *lock << " on " << *lock->get_parent() << dendl; + lock->set_scatter_wanted(); } break; diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index fa07b3f97310f..3fa61ae30e112 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -20,6 +20,7 @@ class ScatterLock : public SimpleLock { bool dirty, flushing; + bool scatter_wanted; utime_t last_scatter; public: @@ -28,12 +29,16 @@ public: ScatterLock(MDSCacheObject *o, int t, int ws) : SimpleLock(o, t, ws), - dirty(false), flushing(false), + dirty(false), flushing(false), scatter_wanted(false), xlistitem_updated(this) {} ~ScatterLock() { xlistitem_updated.remove_myself(); // FIXME this should happen sooner, i think... } + void set_scatter_wanted() { scatter_wanted = true; } + void clear_scatter_wanted() { scatter_wanted = false; } + bool get_scatter_wanted() { return scatter_wanted; } + void mark_dirty() { if (!dirty) { if (!flushing) -- 2.39.5