diff --git a/compat_have_mempool_init.patch b/compat_have_mempool_init.patch deleted file mode 100644 index 3c310a2..0000000 --- a/compat_have_mempool_init.patch +++ /dev/null @@ -1,83 +0,0 @@ -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/compat_no_bioset_initialized.patch b/compat_no_bioset_initialized.patch new file mode 100644 index 0000000..6e97ac3 --- /dev/null +++ b/compat_no_bioset_initialized.patch @@ -0,0 +1,45 @@ +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-12-10 15:36:51.485109170 +0800 ++++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/drbd_wrappers.h 2018-12-10 16:13:27.248289076 +0800 +@@ -1397,14 +1397,23 @@ + *pool = mempool_create_slab_pool(min_nr, mem_cache); + return *pool == NULL ? -ENOMEM : 0; + } ++#ifndef COMPAT_HAVE_BIOSET_INITIALIZED + static inline bool + bioset_initialized(struct bio_set **bs) + { + return *bs != NULL; + } ++#endif + #else + #define DRBD_MEMPOOL_T mempool_t + #define DRBD_BIO_SET bio_set ++#ifndef COMPAT_HAVE_BIOSET_INITIALIZED ++static inline bool ++bioset_initialized(struct bio_set *bs) ++{ ++ return bs->bio_slab != NULL; ++} ++#endif + #endif + + #endif +diff -Naur drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c +--- drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c 1970-01-01 08:00:00.000000000 +0800 ++++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c 2018-12-10 16:18:02.952053971 +0800 +@@ -0,0 +1,14 @@ ++#include ++/* ++With linux v4.18 biosets get embedded ++commit 917a38c71af82185c39e31589587591fa764fb85 ++Author: Kent Overstreet ++Date: Tue May 8 21:33:51 2018 -0400 ++*/ ++ ++static inline bool foo(void) ++{ ++ struct bio_set bio_set; ++ ++ return bioset_initialized(&bio_set); ++} diff --git a/drbd.changes b/drbd.changes index 5633e8c..bb9e981 100644 --- a/drbd.changes +++ b/drbd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Dec 10 08:06:53 UTC 2018 - nwang@suse.com + +- bsc#1118841, kernel compatible issue. + Have bioset_init but no bioset_initialized +- Add patch compat_no_bioset_initialized.patch + Remove patch compat_have_mempool_init.patch + ------------------------------------------------------------------- Wed Nov 21 07:47:51 UTC 2018 - nwang@suse.com diff --git a/drbd.spec b/drbd.spec index 3a9cc9b..c7bb33c 100644 --- a/drbd.spec +++ b/drbd.spec @@ -36,7 +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 +Patch2: compat_no_bioset_initialized.patch BuildRequires: kernel-source BuildRequires: kernel-syms BuildRequires: libelf-devel