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

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