From: Jianpeng Ma Date: Wed, 25 Oct 2017 16:34:45 +0000 (+0800) Subject: msg/async: only system can accept more data, continue send. X-Git-Tag: v13.0.1~412^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3350b3504542196cadfa33d9592cca93463d3d1b;p=ceph.git msg/async: only system can accept more data, continue send. Signed-off-by: Jianpeng Ma --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 3f09648d0578..30eec2f3f30a 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -2412,18 +2412,21 @@ void AsyncConnection::handle_write() } while (can_write == WriteStatus::CANWRITE); write_lock.unlock(); - uint64_t left = ack_left; - if (left) { - ceph_le64 s; - s = in_seq; - outcoming_bl.append(CEPH_MSGR_TAG_ACK); - outcoming_bl.append((char*)&s, sizeof(s)); - ldout(async_msgr->cct, 10) << __func__ << " try send msg ack, acked " << left << " messages" << dendl; - ack_left -= left; - left = ack_left; - r = _try_send(left); - } else if (is_queued()) { - r = _try_send(); + // if r > 0 mean data still lefted, so no need _try_send. + if (r == 0) { + uint64_t left = ack_left; + if (left) { + ceph_le64 s; + s = in_seq; + outcoming_bl.append(CEPH_MSGR_TAG_ACK); + outcoming_bl.append((char*)&s, sizeof(s)); + ldout(async_msgr->cct, 10) << __func__ << " try send msg ack, acked " << left << " messages" << dendl; + ack_left -= left; + left = ack_left; + r = _try_send(left); + } else if (is_queued()) { + r = _try_send(); + } } logger->tinc(l_msgr_running_send_time, ceph::mono_clock::now() - start);