qemu-kvm/kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch
Danilo C. L. de Paula 1442ce8243 * Fri Sep 06 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-7.el8
- kvm-trace-Clarify-DTrace-SystemTap-help-message.patch [bz#1516220]
- kvm-socket-Add-backlog-parameter-to-socket_listen.patch [bz#1726898]
- kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch [bz#1726898]
- kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch [bz#1726898]
- kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch [bz#1726898]
- kvm-multifd-Use-number-of-channels-as-listen-backlog.patch [bz#1726898]
- kvm-pseries-Fix-compat_pvr-on-reset.patch [bz#1744107]
- kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch [bz#1744107]
- Resolves: bz#1516220
  (-trace help prints an incomplete list of trace events)
- Resolves: bz#1726898
  (Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then)
- Resolves: bz#1744107
  (Migration from P8(qemu4.1) to P9(qemu4.1), after migration, qemu crash on destination with error message "qemu-kvm: error while loading state for instance 0x1 of device 'cpu'")
2019-09-06 00:33:12 +01:00

174 lines
7.2 KiB
Diff

From 307f4596dc70dcabac9da3ec680d377e1df21397 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Wed, 4 Sep 2019 10:26:03 +0100
Subject: [PATCH 3/8] socket: Add num connections to qio_channel_socket_sync()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Juan Quintela <quintela@redhat.com>
Message-id: <20190904102606.15744-3-quintela@redhat.com>
Patchwork-id: 90272
O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 2/5] socket: Add num connections to qio_channel_socket_sync()
Bugzilla: 1726898
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 4e2d8bf6f143138ad121545a7cf4525e36040039)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
include/io/channel-socket.h | 2 ++
io/channel-socket.c | 7 ++++---
io/net-listener.c | 2 +-
io/trace-events | 2 +-
scsi/qemu-pr-helper.c | 3 ++-
tests/test-char.c | 4 ++--
tests/test-io-channel-socket.c | 2 +-
tests/tpm-emu.c | 2 +-
8 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h
index d7134d2..ed88e5b 100644
--- a/include/io/channel-socket.h
+++ b/include/io/channel-socket.h
@@ -123,6 +123,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
* qio_channel_socket_listen_sync:
* @ioc: the socket channel object
* @addr: the address to listen to
+ * @num: the expected ammount of connections
* @errp: pointer to a NULL-initialized error object
*
* Attempt to listen to the address @addr. This method
@@ -132,6 +133,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
*/
int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
SocketAddress *addr,
+ int num,
Error **errp);
/**
diff --git a/io/channel-socket.c b/io/channel-socket.c
index a533c8b..6258c25 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -197,12 +197,13 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
SocketAddress *addr,
+ int num,
Error **errp)
{
int fd;
- trace_qio_channel_socket_listen_sync(ioc, addr);
- fd = socket_listen(addr, 1, errp);
+ trace_qio_channel_socket_listen_sync(ioc, addr, num);
+ fd = socket_listen(addr, num, errp);
if (fd < 0) {
trace_qio_channel_socket_listen_fail(ioc);
return -1;
@@ -226,7 +227,7 @@ static void qio_channel_socket_listen_worker(QIOTask *task,
SocketAddress *addr = opaque;
Error *err = NULL;
- qio_channel_socket_listen_sync(ioc, addr, &err);
+ qio_channel_socket_listen_sync(ioc, addr, 1, &err);
qio_task_set_error(task, err);
}
diff --git a/io/net-listener.c b/io/net-listener.c
index d8cfe52..dc81150 100644
--- a/io/net-listener.c
+++ b/io/net-listener.c
@@ -82,7 +82,7 @@ int qio_net_listener_open_sync(QIONetListener *listener,
for (i = 0; i < nresaddrs; i++) {
QIOChannelSocket *sioc = qio_channel_socket_new();
- if (qio_channel_socket_listen_sync(sioc, resaddrs[i],
+ if (qio_channel_socket_listen_sync(sioc, resaddrs[i], 1,
err ? NULL : &err) == 0) {
success = true;
diff --git a/io/trace-events b/io/trace-events
index 3783905..2e6aa1d 100644
--- a/io/trace-events
+++ b/io/trace-events
@@ -17,7 +17,7 @@ qio_channel_socket_connect_sync(void *ioc, void *addr) "Socket connect sync ioc=
qio_channel_socket_connect_async(void *ioc, void *addr) "Socket connect async ioc=%p addr=%p"
qio_channel_socket_connect_fail(void *ioc) "Socket connect fail ioc=%p"
qio_channel_socket_connect_complete(void *ioc, int fd) "Socket connect complete ioc=%p fd=%d"
-qio_channel_socket_listen_sync(void *ioc, void *addr) "Socket listen sync ioc=%p addr=%p"
+qio_channel_socket_listen_sync(void *ioc, void *addr, int num) "Socket listen sync ioc=%p addr=%p num=%d"
qio_channel_socket_listen_async(void *ioc, void *addr) "Socket listen async ioc=%p addr=%p"
qio_channel_socket_listen_fail(void *ioc) "Socket listen fail ioc=%p"
qio_channel_socket_listen_complete(void *ioc, int fd) "Socket listen complete ioc=%p fd=%d"
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index a256ce4..a8a74d1 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -1005,7 +1005,8 @@ int main(int argc, char **argv)
.u.q_unix.path = socket_path,
};
server_ioc = qio_channel_socket_new();
- if (qio_channel_socket_listen_sync(server_ioc, &saddr, &local_err) < 0) {
+ if (qio_channel_socket_listen_sync(server_ioc, &saddr,
+ 1, &local_err) < 0) {
object_unref(OBJECT(server_ioc));
error_report_err(local_err);
return 1;
diff --git a/tests/test-char.c b/tests/test-char.c
index f9440cd..af131fc 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -666,7 +666,7 @@ char_socket_addr_to_opt_str(SocketAddress *addr, bool fd_pass,
char *optstr;
g_assert(!reconnect);
if (is_listen) {
- qio_channel_socket_listen_sync(ioc, addr, &error_abort);
+ qio_channel_socket_listen_sync(ioc, addr, 1, &error_abort);
} else {
qio_channel_socket_connect_sync(ioc, addr, &error_abort);
}
@@ -891,7 +891,7 @@ static void char_socket_client_test(gconstpointer opaque)
*/
ioc = qio_channel_socket_new();
g_assert_nonnull(ioc);
- qio_channel_socket_listen_sync(ioc, config->addr, &error_abort);
+ qio_channel_socket_listen_sync(ioc, config->addr, 1, &error_abort);
addr = qio_channel_socket_get_local_address(ioc, &error_abort);
g_assert_nonnull(addr);
diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c
index d2053c4..6eebcee 100644
--- a/tests/test-io-channel-socket.c
+++ b/tests/test-io-channel-socket.c
@@ -57,7 +57,7 @@ static void test_io_channel_setup_sync(SocketAddress *listen_addr,
QIOChannelSocket *lioc;
lioc = qio_channel_socket_new();
- qio_channel_socket_listen_sync(lioc, listen_addr, &error_abort);
+ qio_channel_socket_listen_sync(lioc, listen_addr, 1, &error_abort);
if (listen_addr->type == SOCKET_ADDRESS_TYPE_INET) {
SocketAddress *laddr = qio_channel_socket_get_local_address(
diff --git a/tests/tpm-emu.c b/tests/tpm-emu.c
index 125e697..c43ac4a 100644
--- a/tests/tpm-emu.c
+++ b/tests/tpm-emu.c
@@ -76,7 +76,7 @@ void *tpm_emu_ctrl_thread(void *data)
QIOChannelSocket *lioc = qio_channel_socket_new();
QIOChannel *ioc;
- qio_channel_socket_listen_sync(lioc, s->addr, &error_abort);
+ qio_channel_socket_listen_sync(lioc, s->addr, 1, &error_abort);
g_mutex_lock(&s->data_mutex);
s->data_cond_signal = true;
--
1.8.3.1