cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-gluster-Handle-changed-glfs_ftruncate-signature.patch

b38b0f
From a30344defca0e948400587280f67d4e6bcc5834f Mon Sep 17 00:00:00 2001
b38b0f
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
b38b0f
Date: Wed, 19 Jun 2019 17:15:07 +0200
b38b0f
Subject: [PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
b38b0f
MIME-Version: 1.0
b38b0f
Content-Type: text/plain; charset=UTF-8
b38b0f
Content-Transfer-Encoding: 8bit
b38b0f
b38b0f
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
b38b0f
Message-id: <20190619171508.31981-2-philmd@redhat.com>
b38b0f
Patchwork-id: 88737
b38b0f
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
b38b0f
Bugzilla: 1721983
b38b0f
RH-Acked-by: Max Reitz <mreitz@redhat.com>
b38b0f
RH-Acked-by: Niels de Vos <ndevos@redhat.com>
b38b0f
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
b38b0f
b38b0f
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
b38b0f
b38b0f
New versions of Glusters libgfapi.so have an updated glfs_ftruncate()
b38b0f
function that returns additional 'struct stat' structures to enable
b38b0f
advanced caching of attributes. This is useful for file servers, not so
b38b0f
much for QEMU. Nevertheless, the API has changed and needs to be
b38b0f
adopted.
b38b0f
b38b0f
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
b38b0f
Signed-off-by: Niels de Vos <ndevos@redhat.com>
b38b0f
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
b38b0f
(cherry picked from commit e014dbe74e0484188164c61ff6843f8a04a8cb9d)
b38b0f
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
b38b0f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b38b0f
---
b38b0f
 block/gluster.c |  4 ++++
b38b0f
 configure       | 18 ++++++++++++++++++
b38b0f
 2 files changed, 22 insertions(+)
b38b0f
b38b0f
diff --git a/block/gluster.c b/block/gluster.c
b38b0f
index 8c13002..e3ffa61 100644
b38b0f
--- a/block/gluster.c
b38b0f
+++ b/block/gluster.c
b38b0f
@@ -20,6 +20,10 @@
b38b0f
 #include "qemu/option.h"
b38b0f
 #include "qemu/cutils.h"
b38b0f
 
b38b0f
+#ifdef CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT
b38b0f
+# define glfs_ftruncate(fd, offset) glfs_ftruncate(fd, offset, NULL, NULL)
b38b0f
+#endif
b38b0f
+
b38b0f
 #define GLUSTER_OPT_FILENAME        "filename"
b38b0f
 #define GLUSTER_OPT_VOLUME          "volume"
b38b0f
 #define GLUSTER_OPT_PATH            "path"
b38b0f
diff --git a/configure b/configure
b38b0f
index 6d61b14..b3d337b 100755
b38b0f
--- a/configure
b38b0f
+++ b/configure
b38b0f
@@ -429,6 +429,7 @@ glusterfs_xlator_opt="no"
b38b0f
 glusterfs_discard="no"
b38b0f
 glusterfs_fallocate="no"
b38b0f
 glusterfs_zerofill="no"
b38b0f
+glusterfs_ftruncate_has_stat="no"
b38b0f
 gtk=""
b38b0f
 gtkabi=""
b38b0f
 gtk_gl="no"
b38b0f
@@ -3919,6 +3920,19 @@ if test "$glusterfs" != "no" ; then
b38b0f
       glusterfs_fallocate="yes"
b38b0f
       glusterfs_zerofill="yes"
b38b0f
     fi
b38b0f
+    cat > $TMPC << EOF
b38b0f
+#include <glusterfs/api/glfs.h>
b38b0f
+
b38b0f
+int
b38b0f
+main(void)
b38b0f
+{
b38b0f
+	/* new glfs_ftruncate() passes two additional args */
b38b0f
+	return glfs_ftruncate(NULL, 0, NULL, NULL);
b38b0f
+}
b38b0f
+EOF
b38b0f
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
b38b0f
+      glusterfs_ftruncate_has_stat="yes"
b38b0f
+    fi
b38b0f
   else
b38b0f
     if test "$glusterfs" = "yes" ; then
b38b0f
       feature_not_found "GlusterFS backend support" \
b38b0f
@@ -6622,6 +6636,10 @@ if test "$glusterfs_zerofill" = "yes" ; then
b38b0f
   echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
b38b0f
 fi
b38b0f
 
b38b0f
+if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
b38b0f
+  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
b38b0f
+fi
b38b0f
+
b38b0f
 if test "$libssh2" = "yes" ; then
b38b0f
   echo "CONFIG_LIBSSH2=m" >> $config_host_mak
b38b0f
   echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f