[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_w
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer() |
Date: |
Wed, 02 Dec 2015 10:04:41 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Markus Armbruster <address@hidden> 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 <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
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 */
> }
> }