All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: complete lingering requests only once
@ 2013-02-28 14:41 Alex Elder
  2013-03-05  1:36 ` Josh Durgin
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2013-02-28 14:41 UTC (permalink / raw)
  To: ceph-devel

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

Signed-off-by: Alex Elder <elder@inktank.com>
---
 include/linux/ceph/osd_client.h |    1 +
 net/ceph/osd_client.c           |    5 +++++
 2 files changed, 6 insertions(+)

diff --git a/include/linux/ceph/osd_client.h
b/include/linux/ceph/osd_client.h
index 1dd5d46..a79f833 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -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;
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 1d9ebf9..a28c976a 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -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);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libceph: complete lingering requests only once
  2013-02-28 14:41 [PATCH] libceph: complete lingering requests only once Alex Elder
@ 2013-03-05  1:36 ` Josh Durgin
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Durgin @ 2013-03-05  1:36 UTC (permalink / raw)
  To: Alex Elder; +Cc: ceph-devel

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 02/28/2013 06:41 AM, Alex Elder wrote:
> 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
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   include/linux/ceph/osd_client.h |    1 +
>   net/ceph/osd_client.c           |    5 +++++
>   2 files changed, 6 insertions(+)
>
> diff --git a/include/linux/ceph/osd_client.h
> b/include/linux/ceph/osd_client.h
> index 1dd5d46..a79f833 100644
> --- a/include/linux/ceph/osd_client.h
> +++ b/include/linux/ceph/osd_client.h
> @@ -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;
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 1d9ebf9..a28c976a 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -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);
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-05  1:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 14:41 [PATCH] libceph: complete lingering requests only once Alex Elder
2013-03-05  1:36 ` Josh Durgin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.