From: Haomai Wang Date: Tue, 11 Nov 2014 15:54:17 +0000 (+0800) Subject: AsyncMessenger: Fix large bufferlist send segment fault X-Git-Tag: v0.90~51^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d12fa35d00ff22a9ce50933cf2ce61e2f18c0b0d;p=ceph.git AsyncMessenger: Fix large bufferlist send segment fault If send long bufferlist exceed IOV_LEN(1024), try_send will stuck in looping send the first IOV_LEN(1024) ptrs and raise segment fault. Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index e1c82fc8d9355..7bd4341b894bf 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -237,9 +237,11 @@ int AsyncConnection::_try_send(bufferlist send_bl, bool send) int r = 0; uint64_t sended = 0; list::const_iterator pb = outcoming_bl.buffers().begin(); - while (outcoming_bl.length() > sended) { + uint64_t left_pbrs = outcoming_bl.buffers().size(); + while (left_pbrs) { struct msghdr msg; - int size = MIN(outcoming_bl.buffers().size(), IOV_LEN); + uint64_t size = MIN(left_pbrs, IOV_LEN); + left_pbrs -= size; memset(&msg, 0, sizeof(msg)); msg.msg_iovlen = 0; msg.msg_iov = msgvec;