diff options
author | Sage Weil <sage@inktank.com> | 2012-12-13 12:47:42 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-13 12:48:04 -0800 |
commit | aa2214c36baf3e9fc0e1a0da05fd4d617f9eb28e (patch) | |
tree | a3ca20241cd7044c730485acd43736dbf91cd1b4 | |
parent | 83ee85b8405e9eef9c0cc9e7a551c8ff3d29870c (diff) | |
download | ceph-aa2214c36baf3e9fc0e1a0da05fd4d617f9eb28e.tar.gz |
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 <sage@inktank.com>
-rw-r--r-- | src/mds/Locker.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index a8ec19f765e..d5d5e6b4c37 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); |