libceph: resend all writes after the osdmap loses the full flag
authorJosh Durgin <josh.durgin@inktank.com>
Tue, 10 Dec 2013 17:35:13 +0000 (09:35 -0800)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Fri, 13 Dec 2013 21:04:28 +0000 (23:04 +0200)
commit9a1ea2dbff11547a8e664f143c1ffefc586a577a
tree54535e0308abc52c7f6a471e4ca9b1d72274e489
parentd29adb34a94715174c88ca93e8aba955850c9bde
libceph: resend all writes after the osdmap loses the full flag

With the current full handling, there is a race between osds and
clients getting the first map marked full. If the osd wins, it will
return -ENOSPC to any writes, but the client may already have writes
in flight. This results in the client getting the error and
propagating it up the stack. For rbd, the block layer turns this into
EIO, which can cause corruption in filesystems above it.

To avoid this race, osds are being changed to drop writes that came
from clients with an osdmap older than the last osdmap marked full.
In order for this to work, clients must resend all writes after they
encounter a full -> not full transition in the osdmap. osds will wait
for an updated map instead of processing a request from a client with
a newer map, so resent writes will not be dropped by the osd unless
there is another not full -> full transition.

This approach requires both osds and clients to be fixed to avoid the
race. Old clients talking to osds with this fix may hang instead of
returning EIO and potentially corrupting an fs. New clients talking to
old osds have the same behavior as before if they encounter this race.

Fixes: http://tracker.ceph.com/issues/6938

Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
net/ceph/osd_client.c