diff mbox series

migration/multifd: close TLS channel before socket finalize

Message ID 1604657935-56394-1-git-send-email-zhengchuan@huawei.com
State Superseded
Headers show
Series migration/multifd: close TLS channel before socket finalize | expand

Commit Message

Zheng Chuan Nov. 6, 2020, 10:18 a.m. UTC
Since we now support tls multifd, when we cancel migration, the TLS
sockets will be left as CLOSE-WAIT On Src which results in socket
leak.
Fix it by closing TLS channel before socket finalize.

Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
---
 migration/multifd.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

no-reply@patchew.org Nov. 6, 2020, 10:06 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/1604657935-56394-1-git-send-email-zhengchuan@huawei.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1604657935-56394-1-git-send-email-zhengchuan@huawei.com
Subject: [PATCH] migration/multifd: close TLS channel before socket finalize

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/1604657935-56394-1-git-send-email-zhengchuan@huawei.com -> patchew/1604657935-56394-1-git-send-email-zhengchuan@huawei.com
Switched to a new branch 'test'
4684928 migration/multifd: close TLS channel before socket finalize

=== OUTPUT BEGIN ===
ERROR: suspect code indent for conditional statements (5, 9)
#25: FILE: migration/multifd.c:528:
+     if (ioc &&
[...]
+         /*

total: 1 errors, 0 warnings, 26 lines checked

Commit 468492886fac (migration/multifd: close TLS channel before socket finalize) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/1604657935-56394-1-git-send-email-zhengchuan@huawei.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
diff mbox series

Patch

diff --git a/migration/multifd.c b/migration/multifd.c
index 68b171f..832e475 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -523,6 +523,19 @@  static void multifd_send_terminate_threads(Error *err)
     }
 }
 
+static void multifd_tls_socket_close(QIOChannel *ioc, Error *err)
+{
+     if (ioc &&
+         object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+         /*
+          * TLS channel is special, we need close it before
+          * socket finalize.
+          */
+         qio_channel_close(ioc, &err);
+     }
+}
+
 void multifd_save_cleanup(void)
 {
     int i;
@@ -542,6 +555,7 @@  void multifd_save_cleanup(void)
         MultiFDSendParams *p = &multifd_send_state->params[i];
         Error *local_err = NULL;
 
+        multifd_tls_socket_close(p->c, NULL);
         socket_send_channel_destroy(p->c);
         p->c = NULL;
         qemu_mutex_destroy(&p->mutex);