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

4636b8
From afbc21e30ba77c76a6cce13b95940e32e43213bc Mon Sep 17 00:00:00 2001
4636b8
From: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Date: Mon, 17 Feb 2020 14:52:04 -0500
4636b8
Subject: [PATCH 01/12] gluster: Handle changed glfs_ftruncate signature
4636b8
4636b8
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Message-id: <20200217145205.21347-2-mlevitsk@redhat.com>
4636b8
Patchwork-id: 93894
4636b8
O-Subject: [RHEL-7.9 qemu-kvm-rhev PATCH 1/2] gluster: Handle changed glfs_ftruncate signature
4636b8
Bugzilla: 1802216
4636b8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4636b8
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
4636b8
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
4636b8
4636b8
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
4636b8
4636b8
New versions of Glusters libgfapi.so have an updated glfs_ftruncate()
4636b8
function that returns additional 'struct stat' structures to enable
4636b8
advanced caching of attributes. This is useful for file servers, not so
4636b8
much for QEMU. Nevertheless, the API has changed and needs to be
4636b8
adopted.
4636b8
4636b8
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
4636b8
Signed-off-by: Niels de Vos <ndevos@redhat.com>
4636b8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4636b8
(cherry picked from commit e014dbe74e0484188164c61ff6843f8a04a8cb9d)
4636b8
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
4636b8
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
4636b8
---
4636b8
 block/gluster.c |  4 ++++
4636b8
 configure       | 18 ++++++++++++++++++
4636b8
 2 files changed, 22 insertions(+)
4636b8
4636b8
diff --git a/block/gluster.c b/block/gluster.c
4636b8
index 8c13002fd4..e3ffa6136e 100644
4636b8
--- a/block/gluster.c
4636b8
+++ b/block/gluster.c
4636b8
@@ -20,6 +20,10 @@
4636b8
 #include "qemu/option.h"
4636b8
 #include "qemu/cutils.h"
4636b8
 
4636b8
+#ifdef CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT
4636b8
+# define glfs_ftruncate(fd, offset) glfs_ftruncate(fd, offset, NULL, NULL)
4636b8
+#endif
4636b8
+
4636b8
 #define GLUSTER_OPT_FILENAME        "filename"
4636b8
 #define GLUSTER_OPT_VOLUME          "volume"
4636b8
 #define GLUSTER_OPT_PATH            "path"
4636b8
diff --git a/configure b/configure
4636b8
index 285fd47de3..f78663367e 100755
4636b8
--- a/configure
4636b8
+++ b/configure
4636b8
@@ -429,6 +429,7 @@ glusterfs_xlator_opt="no"
4636b8
 glusterfs_discard="no"
4636b8
 glusterfs_fallocate="no"
4636b8
 glusterfs_zerofill="no"
4636b8
+glusterfs_ftruncate_has_stat="no"
4636b8
 gtk=""
4636b8
 gtkabi=""
4636b8
 gtk_gl="no"
4636b8
@@ -3871,6 +3872,19 @@ if test "$glusterfs" != "no" ; then
4636b8
       glusterfs_fallocate="yes"
4636b8
       glusterfs_zerofill="yes"
4636b8
     fi
4636b8
+    cat > $TMPC << EOF
4636b8
+#include <glusterfs/api/glfs.h>
4636b8
+
4636b8
+int
4636b8
+main(void)
4636b8
+{
4636b8
+	/* new glfs_ftruncate() passes two additional args */
4636b8
+	return glfs_ftruncate(NULL, 0, NULL, NULL);
4636b8
+}
4636b8
+EOF
4636b8
+    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
4636b8
+      glusterfs_ftruncate_has_stat="yes"
4636b8
+    fi
4636b8
   else
4636b8
     if test "$glusterfs" = "yes" ; then
4636b8
       feature_not_found "GlusterFS backend support" \
4636b8
@@ -6529,6 +6543,10 @@ if test "$glusterfs_zerofill" = "yes" ; then
4636b8
   echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4636b8
 fi
4636b8
 
4636b8
+if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
4636b8
+  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
4636b8
+fi
4636b8
+
4636b8
 if test "$libssh2" = "yes" ; then
4636b8
   echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4636b8
   echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4636b8
-- 
4636b8
2.18.2
4636b8