diff options
author | Sage Weil <sage@newdream.net> | 2009-08-05 01:07:24 +0200 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-08-05 01:07:24 +0200 |
commit | f8501abc7245aab51204a1f7ef38ea90bc8d3dc2 (patch) | |
tree | d22bc43dc3da0e94b8e49efba14baf319d0392b5 | |
parent | Makefile: reorg (diff) | |
download | ceph-f8501abc7245aab51204a1f7ef38ea90bc8d3dc2.tar.xz ceph-f8501abc7245aab51204a1f7ef38ea90bc8d3dc2.zip |
mds: set primary lock state to LOCK from strong replica when appropriate
This is needed only because we identify_files_to_recover() before
sending the rejoin acks, and that may twiddle the lock state, so
we need to be in a compatible state.
-rw-r--r-- | src/mds/MDCache.cc | 14 | ||||
-rw-r--r-- | src/mds/ScatterLock.h | 10 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index a0b8ab768ec..dd77483250e 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -3440,13 +3440,13 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong) << " on " << *in << dendl; } - // scatterlock? - if (is.filelock == LOCK_MIX || - is.filelock == LOCK_MIX_LOCK) // replica still has wrlocks - in->filelock.set_state(LOCK_MIX); - if (is.nestlock == LOCK_MIX || - is.nestlock == LOCK_MIX_LOCK) // replica still has wrlocks - in->nestlock.set_state(LOCK_MIX); + // scatterlocks? + // infer state from replica state: + // * go to MIX if they might have wrlocks + // * go to LOCK if they are LOCK (just bc identify_files_to_recover might start twiddling filelock) + in->filelock.infer_state_from_strong_rejoin(is.filelock, true); // maybe also go to LOCK + in->nestlock.infer_state_from_strong_rejoin(is.nestlock, false); + in->dirfragtreelock.infer_state_from_strong_rejoin(is.dftlock, false); // auth pin? if (strong->authpinned_inodes.count(in->vino())) { diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index 211be26da46..d31bf72752c 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -67,6 +67,16 @@ public: void set_last_scatter(utime_t t) { last_scatter = t; } utime_t get_last_scatter() { return last_scatter; } + void infer_state_from_strong_rejoin(int rstate, bool locktoo) { + if (rstate == LOCK_MIX || + rstate == LOCK_MIX_LOCK || // replica still has wrlocks? + rstate == LOCK_MIX_SYNC || // " + rstate == LOCK_MIX_TSYN) // " + state = LOCK_MIX; + else if (locktoo && rstate == LOCK_LOCK) + state = LOCK_LOCK; + } + void print(ostream& out) { out << "("; _print(out); |