Blame SOURCES/kvm-QIOChannelSocket-Fix-zero-copy-send-so-socket-flush-.patch

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