From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a43LM-0000Ue-9L for qemu-devel@nongnu.org; Wed, 02 Dec 2015 04:04:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a43LI-0006FZ-8d for qemu-devel@nongnu.org; Wed, 02 Dec 2015 04:04:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a43LI-0006FU-35 for qemu-devel@nongnu.org; Wed, 02 Dec 2015 04:04:52 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 0CCC564 for ; Wed, 2 Dec 2015 09:04:50 +0000 (UTC) From: Juan Quintela In-Reply-To: <1448976854-10346-1-git-send-email-armbru@redhat.com> (Markus Armbruster's message of "Tue, 1 Dec 2015 14:34:14 +0100") References: <1448976854-10346-1-git-send-email-armbru@redhat.com> Date: Wed, 02 Dec 2015 10:04:41 +0100 Message-ID: <87k2oxkyqe.fsf@emacs.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer() Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: amit.shah@redhat.com, qemu-devel@nongnu.org Markus Armbruster wrote: > 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 Reviewed-by: Juan Quintela Included in next migration pull request. Thanks. > --- > Let me stress once again: this is *not* a bug fix, it's cleanup! If > you don't like it, you can safely ignore it. We'll then mark the spot > as intentional in the Coverity dashboard. > > migration/qemu-file-unix.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c > index c503b02..6ca53e7 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 */ > } > }