From aa2214c36baf3e9fc0e1a0da05fd4d617f9eb28e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 13 Dec 2012 12:47:42 -0800 Subject: [PATCH] mds: document EXCL -> (MIX or SYNC) transition decision Previously (in w26f6a8e48ae575f17c850e28e969d55bceefbc0f), for reasons that are somewhat obscured by passage of time, we did + if ((other_wanted & (CEPH_CAP_GRD|CEPH_CAP_GWR)) || But then we noticed that the loner may want to RD/WR and we are losing the loner status for some other reason. So just recently in b48dfeba3f99451815a5e2a538bea15cd87220d2 we changed it to + if (((other_wanted|loner_wanted) & (CEPH_CAP_GRD|CEPH_CAP_GWR)) || Then we noticed that a non-loner wanting to read and a loner wanting to read (i.e., no writers!) would lead to MIX, even when we want SYNC. So in 07b36992da35e8b54acf76af6c893a0d86f048fb we changed to + if (((other_wanted|loner_wanted) & CEPH_CAP_GWR) || This appears to be correct. The possible choices (wrt caps wanted): loner other want R R SYNC R R|W MIX R W MIX R|W R MIX R|W R|W MIX R|W W MIX W R MIX W R|W MIX W W MIX Which means any writer -> we want MIX. We only want SYNC when there is nobody who wants to write. Because you can't write in SYNC. Which in retrospect seems obvious. Signed-off-by: Sage Weil --- src/mds/Locker.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index a8ec19f765ebd..d5d5e6b4c3753 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -4036,6 +4036,17 @@ void Locker::file_eval(ScatterLock *lock, bool *need_issue) (in->inode.is_dir() && in->multiple_nonstale_caps())) { // FIXME.. :/ dout(20) << " should lose it" << dendl; // we should lose it. + // loner other want + // R R SYNC + // R R|W MIX + // R W MIX + // R|W R MIX + // R|W R|W MIX + // R|W W MIX + // W R MIX + // W R|W MIX + // W W MIX + // -> any writer means MIX; RD doesn't matter. if (((other_wanted|loner_wanted) & CEPH_CAP_GWR) || lock->is_waiter_for(SimpleLock::WAIT_WR)) scatter_mix(lock, need_issue); -- 2.39.5