]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0037-nbd-strict-nbd_wr_syncv.patch
bump version to 2.9.1-9
[pve-qemu.git] / debian / patches / extra / 0037-nbd-strict-nbd_wr_syncv.patch
CommitLineData
b45e13fe 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b45e13fe 2From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
507c6de3
WB
3Date: Tue, 16 May 2017 12:45:29 +0300
4Subject: [PATCH] nbd: strict nbd_wr_syncv
b45e13fe
AD
5
6nbd_wr_syncv is called either from coroutine or from client negotiation
7code, when socket is in blocking mode. So, -EAGAIN is impossible.
8
9Furthermore, EAGAIN is confusing, as, what to read/write again? With
10EAGAIN as a return code we don't know how much data is already
11read or written by the function, so in case of EAGAIN the whole
12communication is broken.
13
14Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
15Message-Id: <20170516094533.6160-2-vsementsov@virtuozzo.com>
16Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
b45e13fe
AD
17---
18 nbd/common.c | 11 ++++++-----
19 1 file changed, 6 insertions(+), 5 deletions(-)
20
21diff --git a/nbd/common.c b/nbd/common.c
507c6de3 22index dccbb8e9de..4db45b3ede 100644
b45e13fe
AD
23--- a/nbd/common.c
24+++ b/nbd/common.c
25@@ -20,6 +20,10 @@
26 #include "qapi/error.h"
27 #include "nbd-internal.h"
28
29+/* nbd_wr_syncv
30+ * The function may be called from coroutine or from non-coroutine context.
31+ * When called from non-coroutine context @ioc must be in blocking mode.
32+ */
33 ssize_t nbd_wr_syncv(QIOChannel *ioc,
34 struct iovec *iov,
35 size_t niov,
36@@ -42,11 +46,8 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,
37 len = qio_channel_writev(ioc, local_iov, nlocal_iov, &local_err);
38 }
39 if (len == QIO_CHANNEL_ERR_BLOCK) {
40- if (qemu_in_coroutine()) {
41- qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
42- } else {
43- return -EAGAIN;
44- }
45+ assert(qemu_in_coroutine());
46+ qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
47 continue;
48 }
49 if (len < 0) {
50--
507c6de3 512.11.0
b45e13fe 52