rhbz1374089

This commit is contained in:
Frank Ch. Eigler 2016-09-07 19:43:47 -04:00
parent 1328f0dcf7
commit eed857910b
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,68 @@
commit 8f888904d8de9a798e4664caa373ea552366b304
Author: David Smith <dsmith@redhat.com>
Date: Mon May 23 13:56:29 2016 -0500
Fix PR20132 by updating the runtime to handle a 'struct inode' change.
* runtime/transport/transport.c (_stp_lock_inode): Use the new inode
lock/unlock routines.
(_stp_unlock_inode): Ditto.
* buildrun.cxx (compile_pass): Add autoconf-inode-rwsem test.
* runtime/linux/autoconf-inode-rwsem.c: New 'autoconf' test.
diff --git a/buildrun.cxx b/buildrun.cxx
index 8cf4b36b186e..27e2be6a2dc3 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -321,6 +321,7 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-generated-compile.c", "STAPCONF_GENERATED_COMPILE", NULL);
output_autoconf(s, o, "autoconf-hrtimer-getset-expires.c", "STAPCONF_HRTIMER_GETSET_EXPIRES", NULL);
output_autoconf(s, o, "autoconf-inode-private.c", "STAPCONF_INODE_PRIVATE", NULL);
+ output_autoconf(s, o, "autoconf-inode-rwsem.c", "STAPCONF_INODE_RWSEM", NULL);
output_autoconf(s, o, "autoconf-constant-tsc.c", "STAPCONF_CONSTANT_TSC", NULL);
output_autoconf(s, o, "autoconf-ktime-get-real.c", "STAPCONF_KTIME_GET_REAL", NULL);
output_autoconf(s, o, "autoconf-x86-uniregs.c", "STAPCONF_X86_UNIREGS", NULL);
diff --git a/runtime/linux/autoconf-inode-rwsem.c b/runtime/linux/autoconf-inode-rwsem.c
new file mode 100644
index 000000000000..8ca4a4accbd9
--- /dev/null
+++ b/runtime/linux/autoconf-inode-rwsem.c
@@ -0,0 +1,5 @@
+#include <linux/fs.h>
+
+// check for 4.6 inode patch which changed i_mutex to i_rwsem
+
+struct inode i __attribute__ ((unused)) = {.i_rwsem=__RWSEM_INITIALIZER(i.i_rwsem)};
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index bbc61d25881d..d19eb1ee3831 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -490,20 +490,28 @@ static int _stp_transport_init(void)
static inline void _stp_lock_inode(struct inode *inode)
{
+#ifdef STAPCONF_INODE_RWSEM
+ inode_lock(inode);
+#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
mutex_lock(&inode->i_mutex);
#else
down(&inode->i_sem);
#endif
+#endif
}
static inline void _stp_unlock_inode(struct inode *inode)
{
+#ifdef STAPCONF_INODE_RWSEM
+ inode_unlock(inode);
+#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
mutex_unlock(&inode->i_mutex);
#else
up(&inode->i_sem);
#endif
+#endif
}
static struct dentry *_stp_lockfile = NULL;

View File

@ -60,7 +60,7 @@
Name: systemtap
Version: 3.0
Release: 3%{?dist}
Release: 4%{?dist}
# for version, see also configure.ac
@ -160,6 +160,7 @@ BuildRequires: ncurses-devel
Patch10: pr19874.patch
Patch11: systemtap-3.0-kernel-4.6.patch
Patch12: systemtap-3.0-kernel-4.7.patch
# Install requirements
Requires: systemtap-client = %{version}-%{release}
@ -413,6 +414,7 @@ cd ..
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
@ -1057,6 +1059,9 @@ done
# http://sourceware.org/systemtap/wiki/SystemTapReleases
%changelog
* Wed Sep 07 2016 Frank Ch. Eigler <fche@redhat.com> - 3.0-4
- fix kernel-4.7 conflicts (PR20132)
* Thu Jul 21 2016 Josh Stone <jistone@redhat.com> - 3.0-3
- fix kernel-4.6 conflicts (PR19940, PR19940, PR20158, PR20161)