From: Haomai Wang Date: Wed, 4 May 2016 10:33:29 +0000 (+0800) Subject: AsyncConnection: continue to read when meeting EINTR X-Git-Tag: v11.0.0~138^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=410aed8d4afa513b307968fc1609e76f5a2dc163;p=ceph.git AsyncConnection: continue to read when meeting EINTR Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index d52f4b160c34..59ec5e0dca6a 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -154,10 +154,14 @@ void AsyncConnection::maybe_start_delay_thread() * return 0 means EAGAIN or EINTR */ ssize_t AsyncConnection::read_bulk(int fd, char *buf, unsigned len) { - ssize_t nread = ::read(fd, buf, len); + ssize_t nread; + again: + nread = ::read(fd, buf, len); if (nread == -1) { - if (errno == EAGAIN || errno == EINTR) { + if (errno == EAGAIN) { nread = 0; + } else if (errno == EINTR) { + goto again; } else { ldout(async_msgr->cct, 1) << __func__ << " reading from fd=" << fd << " : "<< strerror(errno) << dendl;