diff options
author | Brian Behlendorf <[email protected]> | 2020-02-28 08:58:39 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-28 08:58:39 -0800 |
commit | bd0d24e09b089af589ebaecd9e85d9fd4ac31deb (patch) | |
tree | 929a38a76c16333e79d637954e72ee3486264b89 /config/kernel-bio.m4 | |
parent | 2ce90dca91a991592da48c52332326ae4bb25b69 (diff) |
Linux 5.5 compat: blkg_tryget()
Commit https://github.com/torvalds/linux/commit/9e8d42a0f accidentally
converted the static inline function blkg_tryget() to GPL-only for
kernels built with CONFIG_PREEMPT_RCU=y and CONFIG_BLK_CGROUP=y.
Resolve the build issue by providing our own equivalent functionality
when needed which uses rcu_read_lock_sched() internally as before.
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #9745
Closes #10072
Diffstat (limited to 'config/kernel-bio.m4')
-rw-r--r-- | config/kernel-bio.m4 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 index 75a4a6de4..afa1f1cab 100644 --- a/config/kernel-bio.m4 +++ b/config/kernel-bio.m4 @@ -331,6 +331,44 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST], [ ]) ]) +dnl # +dnl # Linux 5.5 API, +dnl # +dnl # The Linux 5.5 kernel updated percpu_ref_tryget() which is inlined by +dnl # blkg_tryget() to use rcu_read_lock() instead of rcu_read_lock_sched(). +dnl # As a side effect the function was converted to GPL-only. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [ + ZFS_LINUX_TEST_SRC([blkg_tryget], [ + #include <linux/blk-cgroup.h> + #include <linux/bio.h> + #include <linux/fs.h> + ],[ + struct blkcg_gq blkg __attribute__ ((unused)); + bool rc __attribute__ ((unused)); + rc = blkg_tryget(&blkg); + ], [], [$ZFS_META_LICENSE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [ + AC_MSG_CHECKING([whether blkg_tryget() is available]) + ZFS_LINUX_TEST_RESULT([blkg_tryget], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLKG_TRYGET, 1, [blkg_tryget() is available]) + + AC_MSG_CHECKING([whether blkg_tryget() is GPL-only]) + ZFS_LINUX_TEST_RESULT([blkg_tryget_license], [ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLKG_TRYGET_GPL_ONLY, 1, + [blkg_tryget() GPL-only]) + ]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_REQ ZFS_AC_KERNEL_SRC_BIO_OPS @@ -340,6 +378,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_BIO_BVEC_ITER ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST + ZFS_AC_KERNEL_SRC_BLKG_TRYGET ]) AC_DEFUN([ZFS_AC_KERNEL_BIO], [ @@ -360,4 +399,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [ ZFS_AC_KERNEL_BIO_BVEC_ITER ZFS_AC_KERNEL_BIO_SUBMIT_BIO ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST + ZFS_AC_KERNEL_BLKG_TRYGET ]) |