* [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer()
@ 2015-12-01 13:34 Markus Armbruster
2015-12-01 13:39 ` Paolo Bonzini
2015-12-02 9:04 ` Juan Quintela
0 siblings, 2 replies; 3+ messages in thread
From: Markus Armbruster @ 2015-12-01 13:34 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, quintela
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>
---
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 */
}
}
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer()
2015-12-01 13:34 [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer() Markus Armbruster
@ 2015-12-01 13:39 ` Paolo Bonzini
2015-12-02 9:04 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-12-01 13:39 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: amit.shah, quintela
On 01/12/2015 14:34, 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 <armbru@redhat.com>
> ---
> 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 */
> }
> }
>
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer()
2015-12-01 13:34 [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer() Markus Armbruster
2015-12-01 13:39 ` Paolo Bonzini
@ 2015-12-02 9:04 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2015-12-02 9:04 UTC (permalink / raw)
To: Markus Armbruster; +Cc: amit.shah, qemu-devel
Markus Armbruster <armbru@redhat.com> 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 <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
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 */
> }
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-02 9:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 13:34 [Qemu-devel] [PATCH] migration: Clean up use of g_poll() in socket_writev_buffer() Markus Armbruster
2015-12-01 13:39 ` Paolo Bonzini
2015-12-02 9:04 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).