]> Pileus Git - ~andy/linux/commit
libceph: init sent and completed when starting
authorAlex Elder <elder@inktank.com>
Thu, 9 May 2013 19:56:32 +0000 (14:56 -0500)
committerAlex Elder <elder@inktank.com>
Mon, 13 May 2013 17:52:23 +0000 (12:52 -0500)
commitc10ebbf55b40503a46fb8b29824c9ca1ca089826
treec95d75a5793d78f0ade48a8fc2517669da69d0aa
parentc48f3f86e248b1649ad22151dd45ef2610101ed3
libceph: init sent and completed when starting

The rbd code has a need to be able to restart an osd request that
has already been started and completed once before.  This currently
wouldn't work right because the osd client code assumes an osd
request will be started exactly once  Certain fields in a request
are never cleared and this leads to trouble if you try to reuse it.

Specifically, the r_sent, r_got_reply, and r_completed fields are
never cleared.  The r_sent field records the osd incarnation at the
time the request was sent to that osd.  If that's non-zero, the
message won't get re-mapped to a target osd properly, and won't be
put on the unsafe requests list the first time it's sent as it
should.  The r_got_reply field is used in handle_reply() to ensure
the reply to a request is processed only once.  And the r_completed
field is used for lingering requests to avoid calling the callback
function every time the osd client re-sends the request on behalf of
its initiator.

Each osd request passes through ceph_osdc_start_request() when
responsibility for the request is handed over to the osd client for
completion.  We can safely zero these three fields there each time a
request gets started.

One last related change--clear the r_linger flag when a request
is no longer registered as a linger request.

This resolves:
    http://tracker.ceph.com/issues/5026

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
net/ceph/osd_client.c