Commit 0a2ad541 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

libceph: cleanup old messages according to reconnect seq

when reopen a connection, use 'reconnect seq' to clean up
messages that have already been received by peer.

Link: http://tracker.ceph.com/issues/18690Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 293dffaa
...@@ -2228,10 +2228,18 @@ static void process_ack(struct ceph_connection *con) ...@@ -2228,10 +2228,18 @@ static void process_ack(struct ceph_connection *con)
struct ceph_msg *m; struct ceph_msg *m;
u64 ack = le64_to_cpu(con->in_temp_ack); u64 ack = le64_to_cpu(con->in_temp_ack);
u64 seq; u64 seq;
bool reconnect = (con->in_tag == CEPH_MSGR_TAG_SEQ);
struct list_head *list = reconnect ? &con->out_queue : &con->out_sent;
while (!list_empty(&con->out_sent)) { /*
m = list_first_entry(&con->out_sent, struct ceph_msg, * In the reconnect case, con_fault() has requeued messages
list_head); * 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); seq = le64_to_cpu(m->hdr.seq);
if (seq > ack) if (seq > ack)
break; break;
...@@ -2240,6 +2248,7 @@ static void process_ack(struct ceph_connection *con) ...@@ -2240,6 +2248,7 @@ static void process_ack(struct ceph_connection *con)
m->ack_stamp = jiffies; m->ack_stamp = jiffies;
ceph_msg_remove(m); ceph_msg_remove(m);
} }
prepare_read_tag(con); prepare_read_tag(con);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment