[PATCH] migration/multifd: close TLS channel before socket finalize

Chuan Zheng posted 1 patch 3 years, 5 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1604657935-56394-1-git-send-email-zhengchuan@huawei.com
Maintainers: Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
There is a newer version of this series
migration/multifd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
[PATCH] migration/multifd: close TLS channel before socket finalize
Posted by Chuan Zheng 3 years, 5 months ago
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(+)

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);
-- 
1.8.3.1


Re: [PATCH] migration/multifd: close TLS channel before socket finalize
Posted by no-reply@patchew.org 3 years, 5 months ago
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