diff options
author | Yan, Zheng <zyan@redhat.com> | 2017-05-05 06:47:37 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-05-24 12:10:51 -0400 |
commit | 0a2ad541071f99eaf4589c3551176fca191c1ee2 (patch) | |
tree | fbd9e51e711507478de1f4e4e59de34035a34639 | |
parent | 293dffaad8d500e1a5336eeb90d544cf40d4fbd8 (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>
-rw-r--r-- | net/ceph/messenger.c | 15 |
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) | |||
2228 | struct ceph_msg *m; | 2228 | struct ceph_msg *m; |
2229 | u64 ack = le64_to_cpu(con->in_temp_ack); | 2229 | u64 ack = le64_to_cpu(con->in_temp_ack); |
2230 | u64 seq; | 2230 | u64 seq; |
2231 | bool reconnect = (con->in_tag == CEPH_MSGR_TAG_SEQ); | ||
2232 | struct list_head *list = reconnect ? &con->out_queue : &con->out_sent; | ||
2231 | 2233 | ||
2232 | while (!list_empty(&con->out_sent)) { | 2234 | /* |
2233 | m = list_first_entry(&con->out_sent, struct ceph_msg, | 2235 | * In the reconnect case, con_fault() has requeued messages |
2234 | list_head); | 2236 | * in out_sent. We should cleanup old messages according to |
2237 | * the reconnect seq. | ||
2238 | */ | ||
2239 | while (!list_empty(list)) { | ||
2240 | m = list_first_entry(list, struct ceph_msg, list_head); | ||
2241 | if (reconnect && m->needs_out_seq) | ||
2242 | break; | ||
2235 | seq = le64_to_cpu(m->hdr.seq); | 2243 | seq = le64_to_cpu(m->hdr.seq); |
2236 | if (seq > ack) | 2244 | if (seq > ack) |
2237 | break; | 2245 | break; |
@@ -2240,6 +2248,7 @@ static void process_ack(struct ceph_connection *con) | |||
2240 | m->ack_stamp = jiffies; | 2248 | m->ack_stamp = jiffies; |
2241 | ceph_msg_remove(m); | 2249 | ceph_msg_remove(m); |
2242 | } | 2250 | } |
2251 | |||
2243 | prepare_read_tag(con); | 2252 | prepare_read_tag(con); |
2244 | } | 2253 | } |
2245 | 2254 | ||