[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 07/29] vhost-user: wrap some read/write with retr
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v4 07/29] vhost-user: wrap some read/write with retry handling |
Date: |
Fri, 13 Jul 2018 15:08:54 +0200 |
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/virtio/vhost-user.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 44795880d6..5b4188bc27 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -975,7 +975,10 @@ static void slave_read(void *opaque)
iov.iov_base = &hdr;
iov.iov_len = VHOST_USER_HDR_SIZE;
- size = recvmsg(u->slave_fd, &msgh, 0);
+ do {
+ size = recvmsg(u->slave_fd, &msgh, 0);
+ } while (size < 0 && (errno == EINTR || errno == EAGAIN));
+
if (size != VHOST_USER_HDR_SIZE) {
error_report("Failed to read from slave.");
goto err;
@@ -1004,7 +1007,10 @@ static void slave_read(void *opaque)
}
/* Read payload */
- size = read(u->slave_fd, &payload, hdr.size);
+ do {
+ size = read(u->slave_fd, &payload, hdr.size);
+ } while (size < 0 && (errno == EINTR || errno == EAGAIN));
+
if (size != hdr.size) {
error_report("Failed to read payload from slave.");
goto err;
@@ -1052,7 +1058,10 @@ static void slave_read(void *opaque)
iovec[1].iov_base = &payload;
iovec[1].iov_len = hdr.size;
- size = writev(u->slave_fd, iovec, ARRAY_SIZE(iovec));
+ do {
+ size = writev(u->slave_fd, iovec, ARRAY_SIZE(iovec));
+ } while (size < 0 && (errno == EINTR || errno == EAGAIN));
+
if (size != VHOST_USER_HDR_SIZE + hdr.size) {
error_report("Failed to send msg reply to slave.");
goto err;
--
2.18.0.129.ge3331758f1
- [Qemu-devel] [PATCH v4 00/29] vhost-user for input & GPU, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 01/29] chardev: avoid crash if no associated address, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 03/29] chardev: unref if underlying chardev has no parent, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 02/29] chardev: remove qemu_chr_fe_read_all() counter, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 04/29] dmabuf: add y0_top, pass it to spice, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 06/29] libvhost-user: exit by default on VHOST_USER_NONE, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 05/29] vhost-user: simplify vhost_user_init/vhost_user_cleanup, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 07/29] vhost-user: wrap some read/write with retry handling,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v4 08/29] Add vhost-user-backend, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 09/29] qio: add qio_channel_command_new_spawn_with_pre_exec(), Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 10/29] HACK: vhost-user-backend: allow to specify binary to execute, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 11/29] vhost-user: split vhost_user_read(), Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 12/29] vhost-user: add vhost_user_input_get_config(), Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 13/29] libvhost-user: export vug_source_new(), Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 14/29] contrib: add vhost-user-input, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 15/29] Add vhost-user-input-pci, Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 16/29] vhost-user: add vhost_user_gpu_set_socket(), Marc-André Lureau, 2018/07/13
- [Qemu-devel] [PATCH v4 17/29] vhost-user: add vhost_user_gpu_get_num_capsets(), Marc-André Lureau, 2018/07/13