* [PATCH] libceph: cleanup old messages according to reconnect seq
@ 2017-05-05 11:08 Yan, Zheng
2017-05-24 15:26 ` Ilya Dryomov
0 siblings, 1 reply; 2+ messages in thread
From: Yan, Zheng @ 2017-05-05 11:08 UTC (permalink / raw)
To: ceph-devel; +Cc: jlayton, idryomov, Yan, Zheng
when reopen a connection, use 'reconnect seq' to clean up
messages that have already been received by peer.
Fixes: http://tracker.ceph.com/issues/18690
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
net/ceph/messenger.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index f76bb33..af9c5a1 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2230,10 +2230,17 @@ static void process_ack(struct ceph_connection *con)
struct ceph_msg *m;
u64 ack = le64_to_cpu(con->in_temp_ack);
u64 seq;
-
- while (!list_empty(&con->out_sent)) {
- m = list_first_entry(&con->out_sent, struct ceph_msg,
- list_head);
+ bool reconnect = (con->in_tag == CEPH_MSGR_TAG_SEQ);
+ struct list_head *list = reconnect ? &con->out_queue : &con->out_sent;
+ /*
+ * In the reconnect case, con_fault() has requeued messages
+ * in out_sent. We should cleanup old messages according to
+ * the reconnect seq.
+ */
+ while (!list_empty(list)) {
+ m = list_first_entry(list, struct ceph_msg, list_head);
+ if (reconnect && m->needs_out_seq)
+ break;
seq = le64_to_cpu(m->hdr.seq);
if (seq > ack)
break;
@@ -2242,6 +2249,7 @@ static void process_ack(struct ceph_connection *con)
m->ack_stamp = jiffies;
ceph_msg_remove(m);
}
+
prepare_read_tag(con);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libceph: cleanup old messages according to reconnect seq
2017-05-05 11:08 [PATCH] libceph: cleanup old messages according to reconnect seq Yan, Zheng
@ 2017-05-24 15:26 ` Ilya Dryomov
0 siblings, 0 replies; 2+ messages in thread
From: Ilya Dryomov @ 2017-05-24 15:26 UTC (permalink / raw)
To: Yan, Zheng; +Cc: Ceph Development, Jeff Layton, idryomov
On Fri, May 5, 2017 at 1:08 PM, Yan, Zheng <zyan@redhat.com> wrote:
> when reopen a connection, use 'reconnect seq' to clean up
> messages that have already been received by peer.
>
> Fixes: http://tracker.ceph.com/issues/18690
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
> net/ceph/messenger.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index f76bb33..af9c5a1 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -2230,10 +2230,17 @@ static void process_ack(struct ceph_connection *con)
> struct ceph_msg *m;
> u64 ack = le64_to_cpu(con->in_temp_ack);
> u64 seq;
> -
> - while (!list_empty(&con->out_sent)) {
> - m = list_first_entry(&con->out_sent, struct ceph_msg,
> - list_head);
> + bool reconnect = (con->in_tag == CEPH_MSGR_TAG_SEQ);
> + struct list_head *list = reconnect ? &con->out_queue : &con->out_sent;
> + /*
> + * In the reconnect case, con_fault() has requeued messages
> + * in out_sent. We should cleanup old messages according to
> + * the reconnect seq.
> + */
> + while (!list_empty(list)) {
> + m = list_first_entry(list, struct ceph_msg, list_head);
> + if (reconnect && m->needs_out_seq)
> + break;
> seq = le64_to_cpu(m->hdr.seq);
> if (seq > ack)
> break;
> @@ -2242,6 +2249,7 @@ static void process_ack(struct ceph_connection *con)
> m->ack_stamp = jiffies;
> ceph_msg_remove(m);
> }
> +
> prepare_read_tag(con);
> }
>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Thanks,
Ilya
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-24 15:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 11:08 [PATCH] libceph: cleanup old messages according to reconnect seq Yan, Zheng
2017-05-24 15:26 ` Ilya Dryomov
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.