summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mds/MDCache.cc14
-rw-r--r--src/mds/ScatterLock.h10
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);