yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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