[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/20] nbd: strict nbd_wr_syncv
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/20] nbd: strict nbd_wr_syncv |
Date: |
Fri, 19 May 2017 13:21:02 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
nbd_wr_syncv is called either from coroutine or from client negotiation
code, when socket is in blocking mode. So, -EAGAIN is impossible.
Furthermore, EAGAIN is confusing, as, what to read/write again? With
EAGAIN as a return code we don't know how much data is already
read or written by the function, so in case of EAGAIN the whole
communication is broken.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
nbd/common.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/nbd/common.c b/nbd/common.c
index dccbb8e..4db45b3 100644
--- a/nbd/common.c
+++ b/nbd/common.c
@@ -20,6 +20,10 @@
#include "qapi/error.h"
#include "nbd-internal.h"
+/* nbd_wr_syncv
+ * The function may be called from coroutine or from non-coroutine context.
+ * When called from non-coroutine context @ioc must be in blocking mode.
+ */
ssize_t nbd_wr_syncv(QIOChannel *ioc,
struct iovec *iov,
size_t niov,
@@ -42,11 +46,8 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,
len = qio_channel_writev(ioc, local_iov, nlocal_iov, &local_err);
}
if (len == QIO_CHANNEL_ERR_BLOCK) {
- if (qemu_in_coroutine()) {
- qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
- } else {
- return -EAGAIN;
- }
+ assert(qemu_in_coroutine());
+ qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
continue;
}
if (len < 0) {
--
1.8.3.1
- [Qemu-devel] [PULL 00/20] Misc patches for 2017-05-19, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 03/20] mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 01/20] mc146818rtc: update periodic timer only if it is needed, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 04/20] mc146818rtc: drop unnecessary '#ifdef TARGET_I386', Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 02/20] mc146818rtc: precisely count the clock for periodic timer, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 05/20] mc146818rtc: embrace all x86 specific code, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 07/20] msix: trace control bit write op, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 08/20] kvm: irqchip: skip update msi when disabled, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 06/20] kvm: irqchip: trace changes on msi add/remove, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 09/20] Check the return value of fcntl in qemu_set_cloexec, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 10/20] nbd: strict nbd_wr_syncv,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/20] nbd: add errp parameter to nbd_wr_syncv(), Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 14/20] nbd/client.c: use errp instead of LOG, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 11/20] nbd: read_sync and friends: return 0 on success, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 16/20] virtio-scsi: Unset hotplug handler when unrealize, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 13/20] nbd: add errp to read_sync, write_sync and drop_sync, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 15/20] exec: simplify phys_page_find() params, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 17/20] vhost-user-scsi: Introduce vhost-user-scsi host device, Paolo Bonzini, 2017/05/19
- [Qemu-devel] [PULL 19/20] target/i386: enable A20 automatically in system management mode, Paolo Bonzini, 2017/05/19