summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-12-01 14:34:14 +0100
committerJuan Quintela <quintela@redhat.com>2015-12-03 00:03:00 +0100
commit4e39f57c0010b689ffa15658ff063006b45309db (patch)
treecfde9aa52861f9f9d05a8c2efd39b1bff84b1380
parentcf22132367a188426ac07cf1805b214dd2d0cc80 (diff)
downloadfocaccia-qemu-4e39f57c0010b689ffa15658ff063006b45309db.tar.gz
focaccia-qemu-4e39f57c0010b689ffa15658ff063006b45309db.zip
migration: Clean up use of g_poll() in socket_writev_buffer()
socket_writev_buffer() writes in a loop, using g_poll() to block.  If
g_poll() fails, it tries to write more before the file descriptor is
ready.  In theory, this could go into a tight loop.  In practice,
errors other than EINTR are really unlikely, and when they happen,
we're probably screwed anyway, so we can just as well loop.

Clean it up a bit: retry poll on EINTR, keep ignoring other errors.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r--migration/qemu-file-unix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c
index c503b027a9..6ca53e7d67 100644
--- a/migration/qemu-file-unix.c
+++ b/migration/qemu-file-unix.c
@@ -72,7 +72,8 @@ static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt,
             pfd.fd = s->fd;
             pfd.events = G_IO_OUT | G_IO_ERR;
             pfd.revents = 0;
-            g_poll(&pfd, 1 /* 1 fd */, -1 /* no timeout */);
+            TFR(err = g_poll(&pfd, 1, -1 /* no timeout */));
+            /* Errors other than EINTR intentionally ignored */
         }
      }