Blame SOURCES/kvm-block-gluster-limit-the-transfer-size-to-512-MiB.patch

Pablo Greco e6a3ae
From 1788135e55dd9e68e54ba32582702df09819a8fe Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Stefano Garzarella <sgarzare@redhat.com>
Pablo Greco e6a3ae
Date: Tue, 16 Jul 2019 08:13:10 +0100
Pablo Greco e6a3ae
Subject: [PATCH 16/39] block/gluster: limit the transfer size to 512 MiB
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Stefano Garzarella <sgarzare@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190716081310.29528-2-sgarzare@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89533
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/1] block/gluster: limit the transfer size to 512 MiB
Pablo Greco e6a3ae
Bugzilla: 1728657
Pablo Greco e6a3ae
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Several versions of GlusterFS (3.12? -> 6.0.1) fail when the
Pablo Greco e6a3ae
transfer size is greater or equal to 1024 MiB, so we are
Pablo Greco e6a3ae
limiting the transfer size to 512 MiB to avoid this rare issue.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1691320
Pablo Greco e6a3ae
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit de23e72bb7515888fdea2a58c58a2e02370123bd)
Pablo Greco e6a3ae
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block/gluster.c | 16 ++++++++++++++++
Pablo Greco e6a3ae
 1 file changed, 16 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block/gluster.c b/block/gluster.c
Pablo Greco e6a3ae
index a6ac2b1..9b29d96 100644
Pablo Greco e6a3ae
--- a/block/gluster.c
Pablo Greco e6a3ae
+++ b/block/gluster.c
Pablo Greco e6a3ae
@@ -9,6 +9,7 @@
Pablo Greco e6a3ae
  */
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #include "qemu/osdep.h"
Pablo Greco e6a3ae
+#include "qemu/units.h"
Pablo Greco e6a3ae
 #include <glusterfs/api/glfs.h>
Pablo Greco e6a3ae
 #include "block/block_int.h"
Pablo Greco e6a3ae
 #include "block/qdict.h"
Pablo Greco e6a3ae
@@ -41,6 +42,12 @@
Pablo Greco e6a3ae
 #define GLUSTER_DEBUG_MAX           9
Pablo Greco e6a3ae
 #define GLUSTER_OPT_LOGFILE         "logfile"
Pablo Greco e6a3ae
 #define GLUSTER_LOGFILE_DEFAULT     "-" /* handled in libgfapi as /dev/stderr */
Pablo Greco e6a3ae
+/*
Pablo Greco e6a3ae
+ * Several versions of GlusterFS (3.12? -> 6.0.1) fail when the transfer size
Pablo Greco e6a3ae
+ * is greater or equal to 1024 MiB, so we are limiting the transfer size to 512
Pablo Greco e6a3ae
+ * MiB to avoid this rare issue.
Pablo Greco e6a3ae
+ */
Pablo Greco e6a3ae
+#define GLUSTER_MAX_TRANSFER        (512 * MiB)
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #define GERR_INDEX_HINT "hint: check in 'server' array index '%d'\n"
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -887,6 +894,11 @@ out:
Pablo Greco e6a3ae
     return ret;
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+static void qemu_gluster_refresh_limits(BlockDriverState *bs, Error **errp)
Pablo Greco e6a3ae
+{
Pablo Greco e6a3ae
+    bs->bl.max_transfer = GLUSTER_MAX_TRANSFER;
Pablo Greco e6a3ae
+}
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
Pablo Greco e6a3ae
                                        BlockReopenQueue *queue, Error **errp)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
@@ -1527,6 +1539,7 @@ static BlockDriver bdrv_gluster = {
Pablo Greco e6a3ae
     .bdrv_co_pwrite_zeroes        = qemu_gluster_co_pwrite_zeroes,
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
     .bdrv_co_block_status         = qemu_gluster_co_block_status,
Pablo Greco e6a3ae
+    .bdrv_refresh_limits          = qemu_gluster_refresh_limits,
Pablo Greco e6a3ae
     .create_opts                  = &qemu_gluster_create_opts,
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -1556,6 +1569,7 @@ static BlockDriver bdrv_gluster_tcp = {
Pablo Greco e6a3ae
     .bdrv_co_pwrite_zeroes        = qemu_gluster_co_pwrite_zeroes,
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
     .bdrv_co_block_status         = qemu_gluster_co_block_status,
Pablo Greco e6a3ae
+    .bdrv_refresh_limits          = qemu_gluster_refresh_limits,
Pablo Greco e6a3ae
     .create_opts                  = &qemu_gluster_create_opts,
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -1585,6 +1599,7 @@ static BlockDriver bdrv_gluster_unix = {
Pablo Greco e6a3ae
     .bdrv_co_pwrite_zeroes        = qemu_gluster_co_pwrite_zeroes,
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
     .bdrv_co_block_status         = qemu_gluster_co_block_status,
Pablo Greco e6a3ae
+    .bdrv_refresh_limits          = qemu_gluster_refresh_limits,
Pablo Greco e6a3ae
     .create_opts                  = &qemu_gluster_create_opts,
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -1620,6 +1635,7 @@ static BlockDriver bdrv_gluster_rdma = {
Pablo Greco e6a3ae
     .bdrv_co_pwrite_zeroes        = qemu_gluster_co_pwrite_zeroes,
Pablo Greco e6a3ae
 #endif
Pablo Greco e6a3ae
     .bdrv_co_block_status         = qemu_gluster_co_block_status,
Pablo Greco e6a3ae
+    .bdrv_refresh_limits          = qemu_gluster_refresh_limits,
Pablo Greco e6a3ae
     .create_opts                  = &qemu_gluster_create_opts,
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae