libceph: complete lingering requests only once
PATCH 1/1 libceph: complete lingering requests only once
An osd request marked to linger will be re-submitted in the event a connection to the target osd gets dropped. Currently, if there is a callback function associated with a request it will be called each time a request is submitted--which for lingering requests can be more than once.
Change it so a request--including lingering ones--will get completed (from the perspective of the user of the osd client) exactly once.
This resolves:
http://tracker.ceph.com/issues/3967
--- include/linux/ceph/osd_client.h | 1 + net/ceph/osd_client.c | 5 +++++ 2 files changed, 6 insertions(+)
(quoted diff) +0 -0
b/include/linux/ceph/osd_client.h
index 1dd5d46..a79f833 100644
include/linux/ceph/osd_client.h +1 -0
@@ -85,6 +85,7 @@ struct ceph_osd_request {s32 r_reply_op_result[CEPH_OSD_MAX_OP ];int r_got_reply;int r_linger; +int r_completed;struct ceph_osd_client *r_osdc;struct kref r_kref;
net/ceph/osd_client.c +0 -0
@@ -1174,6 +1174,7 @@ static void handle_reply(struct ceph_osd_client
*osdc, struct ceph_msg *msg,
u32 reassert_epoch;
u64 reassert_version;
u32 osdmap_epoch;
+ int already_completed;
int i;
tid = le64_to_cpu(msg->hdr.tid);
@@ -1282,7 +1283,11 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
((flags & CEPH_OSD_FLAG_WRITE) == 0))
__unregister_request(osdc, req);
+ already_completed = req->r_completed;
+ req->r_completed = 1;
mutex_unlock(&osdc->request_mutex);
+ if (already_completed)
+ goto done;
if (req->r_callback)
req->r_callback(req, msg);
Signature · 1 line
1.7.9.5
Quoted 58 lines · Alex Elder
An osd request marked to linger will be re-submitted in the event a connection to the target osd gets dropped. Currently, if there is a callback function associated with a request it will be called each time a request is submitted--which for lingering requests can be more than once.
Change it so a request--including lingering ones--will get completed (from the perspective of the user of the osd client) exactly once.
This resolves:
http://tracker.ceph.com/issues/3967Signed-off-by Alex Elder <[email protected]>--- include/linux/ceph/osd_client.h | 1 + net/ceph/osd_client.c | 5 +++++ 2 files changed, 6 insertions(+)include/linux/ceph/osd_client.h +1
-0@@ -85,6 +85,7 @@ struct ceph_osd_request {s32 r_reply_op_result[CEPH_OSD_MAX_OP ];int r_got_reply;int r_linger; +int r_completed;struct ceph_osd_client *r_osdc;struct kref r_kref;net/ceph/osd_client.c +1
-0@@ -1174,6 +1174,7 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, u32 reassert_epoch;u64 reassert_version;u32 osdmap_epoch; +int already_completed;int i;tid = le64_to_cpu(msg->hdr.tid);net/ceph/osd_client.c +4
-0@@ -1282,7 +1283,11 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, ((flags & CEPH_OSD_FLAG_WRITE) == 0))__unregister_request (osdc, req); + already_completed = req->r_completed; + req->r_completed =1 ;mutex_unlock (&osdc->request_mutex); +if (already_completed) + goto done;if (req->r_callback)req->r_callback(req, msg);