summaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2017-05-05 18:47:37 +0800
committerIlya Dryomov <idryomov@gmail.com>2017-05-24 18:10:51 +0200
commit0a2ad541071f99eaf4589c3551176fca191c1ee2 (patch)
treefbd9e51e711507478de1f4e4e59de34035a34639 /net/ceph
parent293dffaad8d500e1a5336eeb90d544cf40d4fbd8 (diff)
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/18690 Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d7ab481b2508..588a91930051 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2228,10 +2228,18 @@ static void process_ack(struct ceph_connection *con)
struct ceph_msg *m;
u64 ack = le64_to_cpu(con->in_temp_ack);
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,
- list_head);
+ /*
+ * 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;
@@ -2240,6 +2248,7 @@ static void process_ack(struct ceph_connection *con)
m->ack_stamp = jiffies;
ceph_msg_remove(m);
}
+
prepare_read_tag(con);
}