Update kernel drivers to compile with newer kernel

Kernel update to CentOS 7.5 versions are to be paired with updated
out-of-tree kernel modules, mostly for compilation purposes.

Depends-On:  https://review.openstack.org/580689

Change-Id: Ie947ad4b2b4bc88d06f454a36eef0a787d23f289
Signed-off-by: Jason McKenna <jason.mckenna@windriver.com>
Story: 2002761
Task: 22841
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
jmckenna 2018-07-06 08:38:34 -04:00 committed by Scott Little
parent 24d535bb57
commit 9ca7a8f2b7
3 changed files with 174 additions and 1 deletions

View File

@ -1,4 +1,4 @@
COPY_LIST="$FILES_BASE/* \
$DISTRO/patches/* \
$CGCS_BASE/downloads/drbd-8.4.7-1.tar.gz"
TIS_PATCH_VER=3
TIS_PATCH_VER=4

View File

@ -25,6 +25,7 @@ Source0: http://oss.linbit.com/drbd/drbd-%{tarball_version}.tar.gz
# WRS
Patch0001: 0001-remove_bind_before_connect_error.patch
Patch0002: compat-Statically-initialize-families.patch
%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//')
@ -85,6 +86,7 @@ echo "Done."
%prep
%setup -q -n drbd-%{tarball_version}
%patch0001 -p1
%patch0002 -p1
%build
rm -rf obj

View File

@ -0,0 +1,171 @@
From 7510d78909774e33b64ada4055bea65881350763 Mon Sep 17 00:00:00 2001
Message-Id: <7510d78909774e33b64ada4055bea65881350763.1528136610.git.Jim.Somerville@windriver.com>
From: Nick Wang <nwang@suse.com>
Date: Mon, 13 Mar 2017 15:23:29 +0800
Subject: [PATCH 1/1] compat: Statically initialize families
In a07ea4d9, genetlink no longer use static family id.
GENL_ID_GENERATE is removed.
In 489111e5, statically initialize the families and remove
the inline functions.
Thanks to Nick Wang <nwang@suse.com> for preparing a first draft.
Unfortunately this version actually broke netlink on v4.10. Probably
only compile-tested, but never "drbdadm up" tested.
Signed-off-by: Nick Wang <nwang@suse.com>
[add missing pieces introduced in 489111e5]
Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
[Simplified :-) and backported to drbd 8.4]
Signed-off-by: Lars Ellenberg <lars@linbit.com>
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
---
.../tests/have_genl_family_in_genlmsg_multicast.c | 9 ++++++
drbd/compat/tests/have_genl_id_generate.c | 6 ++++
.../tests/have_genl_register_family_with_ops.c | 9 ++++++
.../tests/have_genl_register_family_with_ops3.c | 9 ++++++
...gic_func-genl_register_family_with_ops_groups.h | 4 +++
drbd/linux/genl_magic_func.h | 34 +++++++++++++++-------
6 files changed, 61 insertions(+), 10 deletions(-)
create mode 100644 drbd/compat/tests/have_genl_family_in_genlmsg_multicast.c
create mode 100644 drbd/compat/tests/have_genl_id_generate.c
create mode 100644 drbd/compat/tests/have_genl_register_family_with_ops.c
create mode 100644 drbd/compat/tests/have_genl_register_family_with_ops3.c
diff --git a/drbd/compat/tests/have_genl_family_in_genlmsg_multicast.c b/drbd/compat/tests/have_genl_family_in_genlmsg_multicast.c
new file mode 100644
index 0000000..6d44faa
--- /dev/null
+++ b/drbd/compat/tests/have_genl_family_in_genlmsg_multicast.c
@@ -0,0 +1,9 @@
+#include <net/genetlink.h>
+
+void test(void)
+{
+ struct genl_family family = { };
+ struct sk_buff *skb = NULL;
+
+ genlmsg_multicast(&family, skb, 0, 0, GFP_KERNEL);
+}
diff --git a/drbd/compat/tests/have_genl_id_generate.c b/drbd/compat/tests/have_genl_id_generate.c
new file mode 100644
index 0000000..4ef0e8e
--- /dev/null
+++ b/drbd/compat/tests/have_genl_id_generate.c
@@ -0,0 +1,6 @@
+#include <linux/genetlink.h>
+
+void test(void)
+{
+ int i = GENL_ID_GENERATE;
+}
diff --git a/drbd/compat/tests/have_genl_register_family_with_ops.c b/drbd/compat/tests/have_genl_register_family_with_ops.c
new file mode 100644
index 0000000..27123db
--- /dev/null
+++ b/drbd/compat/tests/have_genl_register_family_with_ops.c
@@ -0,0 +1,9 @@
+#include <net/genetlink.h>
+
+void test(void)
+{
+ struct genl_family family = { };
+ struct genl_ops ops[23];
+
+ genl_register_family_with_ops(&family, ops);
+}
diff --git a/drbd/compat/tests/have_genl_register_family_with_ops3.c b/drbd/compat/tests/have_genl_register_family_with_ops3.c
new file mode 100644
index 0000000..11b6d73
--- /dev/null
+++ b/drbd/compat/tests/have_genl_register_family_with_ops3.c
@@ -0,0 +1,9 @@
+#include <net/genetlink.h>
+
+void test(void)
+{
+ struct genl_family family = { };
+ struct genl_ops ops[23];
+
+ genl_register_family_with_ops(&family, ops, 23);
+}
diff --git a/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h b/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
index 27d8f73..403e8e2 100644
--- a/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
+++ b/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
@@ -29,9 +29,13 @@ static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \
int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
{
+#if defined(COMPAT_HAVE_GENL_REGISTER_FAMILY_WITH_OPS) || defined(COMPAT_HAVE_GENL_REGISTER_FAMILY_WITH_OPS3)
return genl_register_family_with_ops_groups(&ZZZ_genl_family, \
ZZZ_genl_ops, \
ZZZ_genl_mcgrps);
+#else
+ return genl_register_family(&ZZZ_genl_family);
+#endif
}
void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void)
diff --git a/drbd/linux/genl_magic_func.h b/drbd/linux/genl_magic_func.h
index 29f44a8..504719a 100644
--- a/drbd/linux/genl_magic_func.h
+++ b/drbd/linux/genl_magic_func.h
@@ -261,15 +261,7 @@ static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
* {{{2
*/
#define ZZZ_genl_family CONCAT_(GENL_MAGIC_FAMILY, _genl_family)
-static struct genl_family ZZZ_genl_family __read_mostly = {
- .id = GENL_ID_GENERATE,
- .name = __stringify(GENL_MAGIC_FAMILY),
- .version = GENL_MAGIC_VERSION,
-#ifdef GENL_MAGIC_FAMILY_HDRSZ
- .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
-#endif
- .maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1,
-};
+static struct genl_family ZZZ_genl_family;
/*
* Magic: define multicast groups
@@ -282,13 +274,35 @@ static struct genl_family ZZZ_genl_family __read_mostly = {
* genetlink: pass family to functions using groups
* genetlink: only pass array to genl_register_family_with_ops()
* which are commits c53ed742..2a94fe48
+ *
+ * v4.10, 489111e5 genetlink: statically initialize families
+ * and previous commit drop GENL_ID_GENERATE and register helper functions.
*/
-#ifdef genl_register_family_with_ops_groups
+#if defined(genl_register_family_with_ops_groups) || !defined(GENL_ID_GENERATE)
#include <linux/genl_magic_func-genl_register_family_with_ops_groups.h>
#else
#include <linux/genl_magic_func-genl_register_mc_group.h>
#endif
+static struct genl_family ZZZ_genl_family __read_mostly = {
+ /* .id = GENL_ID_GENERATE, which exists no longer, and was 0 anyways */
+ .name = __stringify(GENL_MAGIC_FAMILY),
+ .version = GENL_MAGIC_VERSION,
+#ifdef GENL_MAGIC_FAMILY_HDRSZ
+ .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
+#endif
+ .maxattr = ARRAY_SIZE(CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy))-1,
+
+#ifndef GENL_ID_GENERATE
+ .ops = ZZZ_genl_ops,
+ .n_ops = ARRAY_SIZE(ZZZ_genl_ops),
+ .mcgrps = ZZZ_genl_mcgrps,
+ .n_mcgrps = ARRAY_SIZE(ZZZ_genl_mcgrps),
+ .module = THIS_MODULE,
+#endif
+};
+
+
/*
* Magic: provide conversion functions {{{1
* populate skb from struct.
--
1.8.3.1