]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mds: document EXCL -> (MIX or SYNC) transition decision
authorSage Weil <sage@inktank.com>
Thu, 13 Dec 2012 20:47:42 +0000 (12:47 -0800)
committerSage Weil <sage@inktank.com>
Thu, 13 Dec 2012 20:48:04 +0000 (12:48 -0800)
commitaa2214c36baf3e9fc0e1a0da05fd4d617f9eb28e
treea3ca20241cd7044c730485acd43736dbf91cd1b4
parent83ee85b8405e9eef9c0cc9e7a551c8ff3d29870c
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>
src/mds/Locker.cc