|
|
29b115 |
From e70f01749addd7d0b7aa7fa4fdedb664f98e6b9b Mon Sep 17 00:00:00 2001
|
|
|
29b115 |
From: Leonardo Bras <leobras@redhat.com>
|
|
|
29b115 |
Date: Mon, 20 Jun 2022 02:39:43 -0300
|
|
|
29b115 |
Subject: [PATCH 16/18] QIOChannelSocket: Fix zero-copy send so socket flush
|
|
|
29b115 |
works
|
|
|
29b115 |
MIME-Version: 1.0
|
|
|
29b115 |
Content-Type: text/plain; charset=UTF-8
|
|
|
29b115 |
Content-Transfer-Encoding: 8bit
|
|
|
29b115 |
|
|
|
29b115 |
RH-Author: Leonardo Brás <leobras@redhat.com>
|
|
|
29b115 |
RH-MergeRequest: 95: MSG_ZEROCOPY + Multifd
|
|
|
29b115 |
RH-Commit: [10/11] a2dfac987e24026b1a78e90b86234ca206b6401f (LeoBras/centos-qemu-kvm)
|
|
|
29b115 |
RH-Bugzilla: 1968509
|
|
|
29b115 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
29b115 |
|
|
|
29b115 |
Somewhere between v6 and v7 the of the zero-copy-send patchset a crucial
|
|
|
29b115 |
part of the flushing mechanism got missing: incrementing zero_copy_queued.
|
|
|
29b115 |
|
|
|
29b115 |
Without that, the flushing interface becomes a no-op, and there is no
|
|
|
29b115 |
guarantee the buffer is really sent.
|
|
|
29b115 |
|
|
|
29b115 |
This can go as bad as causing a corruption in RAM during migration.
|
|
|
29b115 |
|
|
|
29b115 |
Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX")
|
|
|
29b115 |
Reported-by: 徐闯 <xuchuangxclwt@bytedance.com>
|
|
|
29b115 |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
29b115 |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
29b115 |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
29b115 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
29b115 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
29b115 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
29b115 |
(cherry picked from commit 4f5a09714c983a3471fd12e3c7f3196e95c650c1)
|
|
|
29b115 |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
29b115 |
---
|
|
|
29b115 |
io/channel-socket.c | 5 +++++
|
|
|
29b115 |
1 file changed, 5 insertions(+)
|
|
|
29b115 |
|
|
|
29b115 |
diff --git a/io/channel-socket.c b/io/channel-socket.c
|
|
|
29b115 |
index 7490e5943d..8ae8b212cf 100644
|
|
|
29b115 |
--- a/io/channel-socket.c
|
|
|
29b115 |
+++ b/io/channel-socket.c
|
|
|
29b115 |
@@ -612,6 +612,11 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
|
|
|
29b115 |
"Unable to write to socket");
|
|
|
29b115 |
return -1;
|
|
|
29b115 |
}
|
|
|
29b115 |
+
|
|
|
29b115 |
+ if (flags & QIO_CHANNEL_WRITE_FLAG_ZERO_COPY) {
|
|
|
29b115 |
+ sioc->zero_copy_queued++;
|
|
|
29b115 |
+ }
|
|
|
29b115 |
+
|
|
|
29b115 |
return ret;
|
|
|
29b115 |
}
|
|
|
29b115 |
#else /* WIN32 */
|
|
|
29b115 |
--
|
|
|
29b115 |
2.35.3
|
|
|
29b115 |
|