]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0037-kvm-nbd-strict-nbd_wr_syncv.patch
fix qemu 2.9 drive mirroring to nbd target
[pve-qemu.git] / debian / patches / extra / 0037-kvm-nbd-strict-nbd_wr_syncv.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Eric Blake <eblake@redhat.com>
3 Date: Wed, 19 Jul 2017 18:01:59 +0200
4 Subject: [PATCH] nbd: strict nbd_wr_syncv
5
6 RH-Author: Eric Blake <eblake@redhat.com>
7 Message-id: <20170719180202.23329-2-eblake@redhat.com>
8 Patchwork-id: 75817
9 O-Subject: [RHEV-7.4.z qemu-kvm-rhev PATCH 1/4] nbd: strict nbd_wr_syncv
10 Bugzilla: 1467509
11 RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
12 RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
13 RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
14
15 From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
16
17 nbd_wr_syncv is called either from coroutine or from client negotiation
18 code, when socket is in blocking mode. So, -EAGAIN is impossible.
19
20 Furthermore, EAGAIN is confusing, as, what to read/write again? With
21 EAGAIN as a return code we don't know how much data is already
22 read or written by the function, so in case of EAGAIN the whole
23 communication is broken.
24
25 Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26 Message-Id: <20170516094533.6160-2-vsementsov@virtuozzo.com>
27 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
28 (cherry picked from commit f250a42ddaee042ad2eb02022a3ebd18fcf987de)
29 Signed-off-by: Eric Blake <eblake@redhat.com>
30 Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
31 ---
32 nbd/common.c | 11 ++++++-----
33 1 file changed, 6 insertions(+), 5 deletions(-)
34
35 diff --git a/nbd/common.c b/nbd/common.c
36 index dccbb8e..4db45b3 100644
37 --- a/nbd/common.c
38 +++ b/nbd/common.c
39 @@ -20,6 +20,10 @@
40 #include "qapi/error.h"
41 #include "nbd-internal.h"
42
43 +/* nbd_wr_syncv
44 + * The function may be called from coroutine or from non-coroutine context.
45 + * When called from non-coroutine context @ioc must be in blocking mode.
46 + */
47 ssize_t nbd_wr_syncv(QIOChannel *ioc,
48 struct iovec *iov,
49 size_t niov,
50 @@ -42,11 +46,8 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,
51 len = qio_channel_writev(ioc, local_iov, nlocal_iov, &local_err);
52 }
53 if (len == QIO_CHANNEL_ERR_BLOCK) {
54 - if (qemu_in_coroutine()) {
55 - qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
56 - } else {
57 - return -EAGAIN;
58 - }
59 + assert(qemu_in_coroutine());
60 + qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
61 continue;
62 }
63 if (len < 0) {
64 --
65 1.8.3.1
66