From 5c71beace2e9ccde9ba6d9ae3899ffa85a39d804629c65e6a0d399813d60c6ff Mon Sep 17 00:00:00 2001 From: nick wang Date: Wed, 21 Nov 2018 08:55:22 +0000 Subject: [PATCH] Accepting request 650582 from home:wanghaisu:branches:network:ha-clustering:Factory fix kernel compatible of sle15sp1, bsc#1116820. OBS-URL: https://build.opensuse.org/request/show/650582 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=78 --- compat_have_mempool_init.patch | 83 ++++++++++++++++++++++++++++++++++ drbd.changes | 6 +++ drbd.spec | 4 ++ 3 files changed, 93 insertions(+) create mode 100644 compat_have_mempool_init.patch diff --git a/compat_have_mempool_init.patch b/compat_have_mempool_init.patch new file mode 100644 index 0000000..3c310a2 --- /dev/null +++ b/compat_have_mempool_init.patch @@ -0,0 +1,83 @@ +diff -Naur drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/drbd_wrappers.h drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/drbd_wrappers.h +--- drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/drbd_wrappers.h 2018-11-21 16:42:49.173926025 +0800 ++++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/drbd_wrappers.h 2018-11-21 16:44:33.373769980 +0800 +@@ -1348,8 +1348,11 @@ + #endif + + #ifndef COMPAT_HAVE_BIOSET_INIT ++ ++#ifndef COMPAT_HAVE_MEMPOOL_INIT + #define mempool_free(V, P) mempool_free(V, *P) + #define mempool_alloc(P, F) mempool_alloc(*P, F) ++#endif + + #ifndef COMPAT_HAVE_BIO_CLONE_FAST + # define bio_clone_fast(bio, gfp, bio_set) bio_clone(bio, gfp) +@@ -1358,7 +1361,13 @@ + #endif + + #define bio_alloc_bioset(GFP, n, P) bio_alloc_bioset(GFP, n, *P) ++ ++#ifndef COMPAT_HAVE_MEMPOOL_INIT + #define DRBD_MEMPOOL_T mempool_t * ++#else ++#define DRBD_MEMPOOL_T mempool_t ++#endif ++ + #define DRBD_BIO_SET bio_set * + static inline void bioset_exit(struct bio_set **bs) + { +@@ -1367,6 +1376,8 @@ + *bs = NULL; + } + } ++ ++#ifndef COMPAT_HAVE_MEMPOOL_INIT + static inline void mempool_exit(mempool_t **p) + { + if (*p) { +@@ -1374,6 +1385,8 @@ + *p = NULL; + } + } ++#endif ++ + #if defined(COMPAT_HAVE_BIOSET_NEED_BVECS) + #define bioset_init(BS, S, FP, F) __bioset_init(BS, S, FP, F) + #else +@@ -1385,6 +1398,8 @@ + *bs = bioset_create(size, front_pad, flags); + return *bs == NULL ? -ENOMEM : 0; + } ++ ++#ifndef COMPAT_HAVE_MEMPOOL_INIT + static inline int + mempool_init_page_pool(mempool_t **pool, int min_nr, int order) + { +@@ -1397,6 +1412,8 @@ + *pool = mempool_create_slab_pool(min_nr, mem_cache); + return *pool == NULL ? -ENOMEM : 0; + } ++#endif ++ + static inline bool + bioset_initialized(struct bio_set **bs) + { +diff -Naur drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_mempool_init.c drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_mempool_init.c +--- drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_mempool_init.c 1970-01-01 08:00:00.000000000 +0800 ++++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_mempool_init.c 2018-11-21 16:43:42.429846044 +0800 +@@ -0,0 +1,14 @@ ++#include ++/* ++With linux v4.18 mempool_init get embedded ++commit c1a67fefd0546a5552289c65fe31b1d60e64b643 ++Author: Kent Overstreet ++Date: Mon May 4 16:52:20 2015 -0700 ++*/ ++ ++static int foo(void) ++{ ++ struct mempool_s mempool_t; ++ ++ return mempool_init_page_pool(&mempool_t, 0, 0); ++} diff --git a/drbd.changes b/drbd.changes index 0acf831..5633e8c 100644 --- a/drbd.changes +++ b/drbd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 21 07:47:51 UTC 2018 - nwang@suse.com + +- bsc#1116820, kernel compatible issue of sle15sp1 +- Add patch compat_have_mempool_init.patch + ------------------------------------------------------------------- Fri Oct 26 03:01:05 UTC 2018 - nwang@suse.com diff --git a/drbd.spec b/drbd.spec index fe34eb1..3a9cc9b 100644 --- a/drbd.spec +++ b/drbd.spec @@ -36,6 +36,7 @@ Source1: preamble Source2: Module.supported Source3: drbd_git_revision Patch1: fix-resync-finished-with-syncs-have-bits-set.patch +Patch2: compat_have_mempool_init.patch BuildRequires: kernel-source BuildRequires: kernel-syms BuildRequires: libelf-devel @@ -69,6 +70,7 @@ installed kernel. %prep %setup -q -n drbd-%{version} %patch1 -p1 +%patch2 -p1 mkdir source cp -a drbd/. source/. || : @@ -89,6 +91,8 @@ for flavor in %{flavors_to_build}; do cp %{_sourcedir}/Module.supported $flavor export DRBDSRC="$PWD/obj/$flavor" make -C %{kernel_source $flavor} modules M=$PWD/$flavor + #Check the compat result + cat $PWD/$flavor/compat.h done %install