thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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