[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/28] libvhost-user: Send messages with no data
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 16/28] libvhost-user: Send messages with no data |
Date: |
Wed, 23 May 2018 17:43:12 +0300 |
From: "Dr. David Alan Gilbert" <address@hidden>
The response to a VHOST_USER_POSTCOPY_ADVISE contains a fd but doesn't
actually contain any data. FIx vu_message_write so that it doesn't
do a 0-byte write() call, since this was ending up with rc=0
that was confusing the error handling code.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
contrib/libvhost-user/libvhost-user.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/contrib/libvhost-user/libvhost-user.c
b/contrib/libvhost-user/libvhost-user.c
index beeed0c..54e643d 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -323,13 +323,15 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg
*vmsg)
rc = sendmsg(conn_fd, &msg, 0);
} while (rc < 0 && (errno == EINTR || errno == EAGAIN));
- do {
- if (vmsg->data) {
- rc = write(conn_fd, vmsg->data, vmsg->size);
- } else {
- rc = write(conn_fd, p + VHOST_USER_HDR_SIZE, vmsg->size);
- }
- } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
+ if (vmsg->size) {
+ do {
+ if (vmsg->data) {
+ rc = write(conn_fd, vmsg->data, vmsg->size);
+ } else {
+ rc = write(conn_fd, p + VHOST_USER_HDR_SIZE, vmsg->size);
+ }
+ } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
+ }
if (rc <= 0) {
vu_panic(dev, "Error while writing: %s", strerror(errno));
--
MST
- [Qemu-devel] [PULL 04/28] vhost: add trace for IOTLB miss, (continued)
- [Qemu-devel] [PULL 04/28] vhost: add trace for IOTLB miss, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 05/28] update-linux-headers.sh: drop kvm_para.h hacks, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 06/28] include/standard-headers: add asm-x86/kvm_para.h, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 08/28] linux-headers: drop kvm_para.h, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 09/28] update-linux-headers.sh: unistd.h, kvm consistency, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 07/28] x86/cpu: use standard-headers/asm-x86.kvm_para.h, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 12/28] vhost-user: add Net prefix to internal state structure, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 14/28] virtio: support setting memory region based host notifier, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 13/28] vhost-user: support receiving file descriptors in slave_read, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 11/28] linux-headers: add kvm header for mips, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 16/28] libvhost-user: Send messages with no data,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 15/28] vhost-user+postcopy: Use qemu_set_nonblock, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 10/28] linux-headers: add unistd.h on all arches, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 17/28] hw/virtio: Fix brace Werror with clang 6.0.0, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 20/28] intel-iommu: send PSI always even if across PDEs, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 19/28] nvdimm: fix typo in label-size definition, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 18/28] contrib/vhost-user-blk: enable protocol feature for vhost-user-blk, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 21/28] intel-iommu: remove IntelIOMMUNotifierNode, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 23/28] intel-iommu: only do page walk for MAP notifiers, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 22/28] intel-iommu: add iommu lock, Michael S. Tsirkin, 2018/05/23
- [Qemu-devel] [PULL 24/28] intel-iommu: introduce vtd_page_walk_info, Michael S. Tsirkin, 2018/05/23