Blame SOURCES/kvm-block-nbd-client-split-connection-from-initializatio.patch

383d26
From a5b79479ab6a364899c6a5c7444c86c00bf0e42d Mon Sep 17 00:00:00 2001
383d26
From: John Snow <jsnow@redhat.com>
383d26
Date: Wed, 27 Mar 2019 17:23:00 +0100
383d26
Subject: [PATCH 122/163] block/nbd-client: split connection from
383d26
 initialization
383d26
383d26
RH-Author: John Snow <jsnow@redhat.com>
383d26
Message-id: <20190327172308.31077-48-jsnow@redhat.com>
383d26
Patchwork-id: 85206
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 47/55] block/nbd-client: split connection from initialization
383d26
Bugzilla: 1691009
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
383d26
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
383d26
383d26
Split connection code to reuse it for reconnect.
383d26
383d26
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
383d26
Reviewed-by: Eric Blake <eblake@redhat.com>
383d26
Message-Id: <20190201130138.94525-4-vsementsov@virtuozzo.com>
383d26
Signed-off-by: Eric Blake <eblake@redhat.com>
383d26
(cherry picked from commit b0e4b5a58fde6c0ed9edb9b683cfbbd8ab45c35d)
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block/nbd-client.c | 33 ++++++++++++++++++++++++---------
383d26
 1 file changed, 24 insertions(+), 9 deletions(-)
383d26
383d26
diff --git a/block/nbd-client.c b/block/nbd-client.c
383d26
index d86c412..22e5042 100644
383d26
--- a/block/nbd-client.c
383d26
+++ b/block/nbd-client.c
383d26
@@ -1011,13 +1011,13 @@ static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
383d26
     return sioc;
383d26
 }
383d26
 
383d26
-int nbd_client_init(BlockDriverState *bs,
383d26
-                    SocketAddress *saddr,
383d26
-                    const char *export,
383d26
-                    QCryptoTLSCreds *tlscreds,
383d26
-                    const char *hostname,
383d26
-                    const char *x_dirty_bitmap,
383d26
-                    Error **errp)
383d26
+static int nbd_client_connect(BlockDriverState *bs,
383d26
+                              SocketAddress *saddr,
383d26
+                              const char *export,
383d26
+                              QCryptoTLSCreds *tlscreds,
383d26
+                              const char *hostname,
383d26
+                              const char *x_dirty_bitmap,
383d26
+                              Error **errp)
383d26
 {
383d26
     NBDClientSession *client = nbd_get_client_session(bs);
383d26
     int ret;
383d26
@@ -1070,8 +1070,6 @@ int nbd_client_init(BlockDriverState *bs,
383d26
         bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP;
383d26
     }
383d26
 
383d26
-    qemu_co_mutex_init(&client->send_mutex);
383d26
-    qemu_co_queue_init(&client->free_sema);
383d26
     client->sioc = sioc;
383d26
 
383d26
     if (!client->ioc) {
383d26
@@ -1104,3 +1102,20 @@ int nbd_client_init(BlockDriverState *bs,
383d26
         return ret;
383d26
     }
383d26
 }
383d26
+
383d26
+int nbd_client_init(BlockDriverState *bs,
383d26
+                    SocketAddress *saddr,
383d26
+                    const char *export,
383d26
+                    QCryptoTLSCreds *tlscreds,
383d26
+                    const char *hostname,
383d26
+                    const char *x_dirty_bitmap,
383d26
+                    Error **errp)
383d26
+{
383d26
+    NBDClientSession *client = nbd_get_client_session(bs);
383d26
+
383d26
+    qemu_co_mutex_init(&client->send_mutex);
383d26
+    qemu_co_queue_init(&client->free_sema);
383d26
+
383d26
+    return nbd_client_connect(bs, saddr, export, tlscreds, hostname,
383d26
+                              x_dirty_bitmap, errp);
383d26
+}
383d26
-- 
383d26
1.8.3.1
383d26