Commit 095a23c2 authored by Colin Ian King's avatar Colin Ian King Committed by Mo Zhou

Add Linux 4.20 and 5.0 compat fixes. (0.7.12-1ubuntu{3,4,5})

 + 3204-Add-4.20-timespec-compat-fix.patch
 + 3300-Add-check-for-totalram-pages.patch
 + 3301-Add-check-for-ktime_get_coarse_real_ts64.patch
 + 3302-linux-5-0-disable-vector-instructions-on-5-0-kernels.patch
 + 3303-linux-5-0-convert-ms-macros-to-sb.patch
 + 3304-linux-5-0-fix-bio-set-dev.patch

Gbp-Dch: Full
parent 95c6b1b6
Pipeline #34623 failed with stages
in 23 minutes and 19 seconds
Add 4.20 timespec compat fix
This adds a compat fix for zpios-ctl.h to cater for the new 64 bit
times.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Index: zfs-linux-0.7.12/include/zpios-ctl.h
===================================================================
--- zfs-linux-0.7.12.orig/include/zpios-ctl.h
+++ zfs-linux-0.7.12/include/zpios-ctl.h
@@ -181,9 +181,13 @@ zpios_timespec_t
zpios_timespec_now(void)
{
zpios_timespec_t zts_now;
- struct timespec ts_now;
+ inode_timespec_t ts_now;
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
+ ts_now = current_kernel_time64();
+#else
ts_now = current_kernel_time();
+#endif
zts_now.ts_sec = ts_now.tv_sec;
zts_now.ts_nsec = ts_now.tv_nsec;
check if totamram-pages is a function
Linux 5.0 totalram_pages is now a function, so check for this
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Index: zfs-linux-0.7.12/config/kernel-totalram-pages.m4
===================================================================
--- /dev/null
+++ zfs-linux-0.7.12/config/kernel-totalram-pages.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 5.0 API change
+dnl # check if totalram_pages is a function
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNCTION], [
+ AC_MSG_CHECKING([whether totalram_pages is a function])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+ unsigned long t;
+
+ t = totalram_pages();
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TOTALRAM_PAGES_FUNCTION, 1,
+ [totalram_pages is a function])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: zfs-linux-0.7.12/module/zfs/arc.c
===================================================================
--- zfs-linux-0.7.12.orig/module/zfs/arc.c
+++ zfs-linux-0.7.12/module/zfs/arc.c
@@ -4004,9 +4004,17 @@ arc_all_memory(void)
{
#ifdef _KERNEL
#ifdef CONFIG_HIGHMEM
+#ifdef HAVE_TOTALRAM_PAGES_FUNCTION
+ return (ptob(totalram_pages() - totalhigh_pages));
+#else
return (ptob(totalram_pages - totalhigh_pages));
+#endif /* HAVE_TOTALRAM_PAGES_FUNCTION */
+#else
+#ifdef HAVE_TOTALRAM_PAGES_FUNCTION
+ return (ptob(totalram_pages()));
#else
return (ptob(totalram_pages));
+#endif /* HAVE_TOTALRAM_PAGES_FUNCTION */
#endif /* CONFIG_HIGHMEM */
#else
return (ptob(physmem) / 2);
check if ktime_get_coarse_real_ts64 is supported
Linux 5.0 now uses ktime_get_coarse_real_ts64 check and use this
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Index: zfs-linux-0.7.12/config/kernel-ktime.m4
===================================================================
--- /dev/null
+++ zfs-linux-0.7.12/config/kernel-ktime.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 5.0 API change
+dnl # current_kernel_time64 to ktime_get_coarse_real_ts64 timespec64
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64], [
+ AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64 exists])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ ],[
+ struct timespec64 ts;
+
+ ktime_get_coarse_real_ts64(&ts);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64, 1,
+ [ktime_get_coarse_real_ts64 is provided])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
Index: zfs-linux-0.7.12/include/zpios-ctl.h
===================================================================
--- zfs-linux-0.7.12.orig/include/zpios-ctl.h
+++ zfs-linux-0.7.12/include/zpios-ctl.h
@@ -184,7 +184,11 @@ zpios_timespec_now(void)
inode_timespec_t ts_now;
#if defined(HAVE_INODE_TIMESPEC64_TIMES)
+#if defined(HAVE_KTIME_GET_COARSE_REAL_TS64)
+ ktime_get_coarse_real_ts64(&ts_now);
+#else
ts_now = current_kernel_time64();
+#endif
#else
ts_now = current_kernel_time();
#endif
Linux 5.0: Disable vector instructions on 5.0+ kernels
The 5.0 kernel no longer exports the functions we need to do vector
(SSE/SSE2/SSE3/AVX...) instructions. Disable vector-based checksum
algorithms when building against those kernels.
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Fixes: zfsonlinux#8259
(cherry picked from https://github.com/tonyhutter/zfs/commit/c781effa7810c7267dac1aff9ffe58b3bc10bd25)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Index: zfs-linux-0.7.12/config/kernel-fpu.m4
===================================================================
--- zfs-linux-0.7.12.orig/config/kernel-fpu.m4
+++ zfs-linux-0.7.12/config/kernel-fpu.m4
@@ -1,18 +1,44 @@
dnl #
+dnl # Handle differences in kernel FPU code.
+dnl #
dnl # 4.2 API change
dnl # asm/i387.h is replaced by asm/fpu/api.h
dnl #
+dnl # Kernel
+dnl # 5.0: All kernel fpu functions are GPL only, so we can't use them.
+dnl # (nothing defined)
+dnl #
+dnl # 4.2: Use __kernel_fpu_{begin,end}()
+dnl # HAVE_UNDERSCORE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
+dnl #
+dnl # Pre-4.2: Use kernel_fpu_{begin,end}()
+dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
+dnl #
AC_DEFUN([ZFS_AC_KERNEL_FPU], [
- AC_MSG_CHECKING([whether asm/fpu/api.h exists])
+ AC_MSG_CHECKING([which kernel_fpu function to use])
ZFS_LINUX_TRY_COMPILE([
#include <linux/kernel.h>
#include <asm/fpu/api.h>
],[
__kernel_fpu_begin();
+ __kernel_fpu_end();
],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FPU_API_H, 1, [kernel has <asm/fpu/api.h> interface])
+ AC_MSG_RESULT(__kernel_fpu_*)
+ AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1, [kernel has __kernel_fpu_* functions])
+ AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, [kernel exports FPU functions])
],[
- AC_MSG_RESULT(no)
+ ZFS_LINUX_TRY_COMPILE([
+ #include <asm/i387.h>
+ #include <asm/xcr.h>
+ ],[
+ kernel_fpu_begin();
+ kernel_fpu_end();
+ ],[
+ AC_MSG_RESULT(kernel_fpu_*)
+ AC_DEFINE(HAVE_KERNEL_FPU, 1, [kernel has kernel_fpu_* functions])
+ AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, [kernel exports FPU functions])
+ ],[
+ AC_MSG_RESULT(not exported)
+ ])
])
])
Index: zfs-linux-0.7.12/include/linux/simd_x86.h
===================================================================
--- zfs-linux-0.7.12.orig/include/linux/simd_x86.h
+++ zfs-linux-0.7.12/include/linux/simd_x86.h
@@ -81,7 +81,7 @@
#endif
#if defined(_KERNEL)
-#if defined(HAVE_FPU_API_H)
+#if defined(HAVE_UNDERSCORE_KERNEL_FPU)
#include <asm/fpu/api.h>
#include <asm/fpu/internal.h>
#define kfpu_begin() \
@@ -94,12 +94,18 @@
__kernel_fpu_end(); \
preempt_enable(); \
}
-#else
+#elif defined(HAVE_KERNEL_FPU)
#include <asm/i387.h>
#include <asm/xcr.h>
#define kfpu_begin() kernel_fpu_begin()
#define kfpu_end() kernel_fpu_end()
-#endif /* defined(HAVE_FPU_API_H) */
+#else
+/* Kernel doesn't export any kernel_fpu_* functions */
+#include <asm/fpu/internal.h> /* For kernel xgetbv() */
+#define kfpu_begin() panic("This code should never run")
+#define kfpu_end() panic("This code should never run")
+#endif /* defined(HAVE_KERNEL_FPU) */
+
#else
/*
* fpu dummy methods for userspace
@@ -278,11 +284,14 @@ __simd_state_enabled(const uint64_t stat
boolean_t has_osxsave;
uint64_t xcr0;
-#if defined(_KERNEL) && defined(X86_FEATURE_OSXSAVE)
+
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_OSXSAVE) && defined(KERNEL_EXPORTS_X86_FPU)
has_osxsave = !!boot_cpu_has(X86_FEATURE_OSXSAVE);
-#elif defined(_KERNEL) && !defined(X86_FEATURE_OSXSAVE)
- has_osxsave = B_FALSE;
#else
+ has_osxsave = B_FALSE;
+#endif
+#elif !defined(_KERNEL)
has_osxsave = __cpuid_has_osxsave();
#endif
@@ -307,8 +316,12 @@ static inline boolean_t
zfs_sse_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_XMM));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_sse());
#endif
}
@@ -320,8 +333,12 @@ static inline boolean_t
zfs_sse2_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_XMM2));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_sse2());
#endif
}
@@ -333,8 +350,12 @@ static inline boolean_t
zfs_sse3_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_XMM3));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_sse3());
#endif
}
@@ -346,8 +367,12 @@ static inline boolean_t
zfs_ssse3_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_SSSE3));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_ssse3());
#endif
}
@@ -359,8 +384,12 @@ static inline boolean_t
zfs_sse4_1_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_XMM4_1));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_sse4_1());
#endif
}
@@ -372,8 +401,12 @@ static inline boolean_t
zfs_sse4_2_available(void)
{
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_XMM4_2));
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_sse4_2());
#endif
}
@@ -386,11 +419,14 @@ zfs_avx_available(void)
{
boolean_t has_avx;
#if defined(_KERNEL)
+#if defined(KERNEL_EXPORTS_X86_FPU)
has_avx = !!boot_cpu_has(X86_FEATURE_AVX);
#else
+ has_avx = B_FALSE;
+#endif
+#elif !defined(_KERNEL)
has_avx = __cpuid_has_avx();
#endif
-
return (has_avx && __ymm_enabled());
}
@@ -401,14 +437,15 @@ static inline boolean_t
zfs_avx2_available(void)
{
boolean_t has_avx2;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX2)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX2) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx2 = !!boot_cpu_has(X86_FEATURE_AVX2);
-#elif defined(_KERNEL) && !defined(X86_FEATURE_AVX2)
- has_avx2 = B_FALSE;
#else
+ has_avx2 = B_FALSE;
+#endif
+#elif !defined(_KERNEL)
has_avx2 = __cpuid_has_avx2();
#endif
-
return (has_avx2 && __ymm_enabled());
}
@@ -418,11 +455,13 @@ zfs_avx2_available(void)
static inline boolean_t
zfs_bmi1_available(void)
{
-#if defined(_KERNEL) && defined(X86_FEATURE_BMI1)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_BMI1) && defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_BMI1));
-#elif defined(_KERNEL) && !defined(X86_FEATURE_BMI1)
- return (B_FALSE);
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_bmi1());
#endif
}
@@ -433,11 +472,13 @@ zfs_bmi1_available(void)
static inline boolean_t
zfs_bmi2_available(void)
{
-#if defined(_KERNEL) && defined(X86_FEATURE_BMI2)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_BMI2) && defined(KERNEL_EXPORTS_X86_FPU)
return (!!boot_cpu_has(X86_FEATURE_BMI2));
-#elif defined(_KERNEL) && !defined(X86_FEATURE_BMI2)
- return (B_FALSE);
#else
+ return (B_FALSE);
+#endif
+#elif !defined(_KERNEL)
return (__cpuid_has_bmi2());
#endif
}
@@ -466,8 +507,12 @@ zfs_avx512f_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512F)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512F) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = !!boot_cpu_has(X86_FEATURE_AVX512F);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512f();
#endif
@@ -481,9 +526,13 @@ zfs_avx512cd_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512CD)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512CD) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512CD);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512cd();
#endif
@@ -497,9 +546,13 @@ zfs_avx512er_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512ER)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512ER) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512ER);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512er();
#endif
@@ -513,9 +566,13 @@ zfs_avx512pf_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512PF)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512PF) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512PF);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512pf();
#endif
@@ -529,9 +586,13 @@ zfs_avx512bw_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512BW)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512BW) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512BW);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512bw();
#endif
@@ -545,9 +606,13 @@ zfs_avx512dq_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512DQ)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512DQ) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512DQ);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512dq();
#endif
@@ -561,9 +626,13 @@ zfs_avx512vl_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512VL)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512VL) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512VL);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512vl();
#endif
@@ -577,9 +646,13 @@ zfs_avx512ifma_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512IFMA)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512IFMA) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512IFMA);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512ifma();
#endif
@@ -593,9 +666,13 @@ zfs_avx512vbmi_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL) && defined(X86_FEATURE_AVX512VBMI)
+#if defined(_KERNEL)
+#if defined(X86_FEATURE_AVX512VBMI) && defined(KERNEL_EXPORTS_X86_FPU)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512VBMI);
+#else
+ has_avx512 = B_FALSE;
+#endif
#elif !defined(_KERNEL)
has_avx512 = __cpuid_has_avx512f() &&
__cpuid_has_avx512vbmi();
Linux 5.0: Convert MS_* macros to SB_*
In the 5.0 kernel, only the mount namespace code should use the MS_*
macos. Filesystems should use the SB_* ones.
https://patchwork.kernel.org/patch/10552493/
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes zfsonlinux#8264
(cherry picked from commit https://github.com/tonyhutter/zfs/commit/bdb806d742d90805bf23f19b9092d03e74ec6cc7)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Index: zfs-linux-0.7.12/module/zfs/vdev_disk.c
===================================================================
--- zfs-linux-0.7.12.orig/module/zfs/vdev_disk.c
+++ zfs-linux-0.7.12/module/zfs/vdev_disk.c
@@ -35,6 +35,7 @@
#include <sys/zio.h>
#include <sys/sunldi.h>
#include <linux/mod_compat.h>
+#include <linux/vfs_compat.h>
char *zfs_vdev_scheduler = VDEV_SCHEDULER;
static void *zfs_vdev_holder = VDEV_HOLDER;
@@ -76,7 +77,7 @@ vdev_bdev_mode(int smode)
ASSERT3S(smode & (FREAD | FWRITE), !=, 0);
if ((smode & FREAD) && !(smode & FWRITE))
- mode = MS_RDONLY;
+ mode = SB_RDONLY;
return (mode);
}
Index: zfs-linux-0.7.12/module/zfs/zfs_vfsops.c
===================================================================
--- zfs-linux-0.7.12.orig/module/zfs/zfs_vfsops.c
+++ zfs-linux-0.7.12/module/zfs/zfs_vfsops.c
@@ -66,6 +66,7 @@
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include <sys/zpl.h>
+#include <linux/vfs_compat.h>
#include "zfs_comutil.h"
enum {
@@ -259,7 +260,7 @@ zfsvfs_parse_options(char *mntopts, vfs_
boolean_t
zfs_is_readonly(zfsvfs_t *zfsvfs)
{
- return (!!(zfsvfs->z_sb->s_flags & MS_RDONLY));
+ return (!!(zfsvfs->z_sb->s_flags & SB_RDONLY));
}
/*ARGSUSED*/
@@ -353,15 +354,15 @@ acltype_changed_cb(void *arg, uint64_t n
switch (newval) {
case ZFS_ACLTYPE_OFF:
zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF;
- zfsvfs->z_sb->s_flags &= ~MS_POSIXACL;
+ zfsvfs->z_sb->s_flags &= ~SB_POSIXACL;
break;
case ZFS_ACLTYPE_POSIXACL:
#ifdef CONFIG_FS_POSIX_ACL
zfsvfs->z_acl_type = ZFS_ACLTYPE_POSIXACL;
- zfsvfs->z_sb->s_flags |= MS_POSIXACL;
+ zfsvfs->z_sb->s_flags |= SB_POSIXACL;
#else
zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF;
- zfsvfs->z_sb->s_flags &= ~MS_POSIXACL;
+ zfsvfs->z_sb->s_flags &= ~SB_POSIXACL;
#endif /* CONFIG_FS_POSIX_ACL */
break;
default:
@@ -390,9 +391,9 @@ readonly_changed_cb(void *arg, uint64_t
return;
if (newval)
- sb->s_flags |= MS_RDONLY;
+ sb->s_flags |= SB_RDONLY;
else
- sb->s_flags &= ~MS_RDONLY;
+ sb->s_flags &= ~SB_RDONLY;
}
static void
@@ -420,9 +421,9 @@ nbmand_changed_cb(void *arg, uint64_t ne
return;
if (newval == TRUE)
- sb->s_flags |= MS_MANDLOCK;
+ sb->s_flags |= SB_MANDLOCK;
else
- sb->s_flags &= ~MS_MANDLOCK;
+ sb->s_flags &= ~SB_MANDLOCK;
}
static void
@@ -1763,8 +1764,8 @@ zfs_remount(struct super_block *sb, int
int error;
if ((issnap || !spa_writeable(dmu_objset_spa(zfsvfs->z_os))) &&
- !(*flags & MS_RDONLY)) {
- *flags |= MS_RDONLY;
+ !(*flags & SB_RDONLY)) {
+ *flags |= SB_RDONLY;
return (EROFS);
}
Linux 5.0: Fix bio_set_dev()
The Linux 5.0 kernel updated the bio_set_dev() macro so it calls the
GPL-only bio_associate_blkg() symbol thus inadvertently converting
the entire macro. Provide a minimal version which always assigns the
request queue's root_blkg to the bio.
[Colin Ian King]
Fix check, include linux/module.h and set MODULE_LICENSE macro
correctly.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes: zfsonlinux#8287
(based on commit https://github.com/tonyhutter/zfs/commit/b94a2e437c24c26d4725fa7159fd0525ff0889e1)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Index: zfs-linux-0.7.12/config/kernel-bio_set_dev.m4
===================================================================
--- zfs-linux-0.7.12.orig/config/kernel-bio_set_dev.m4
+++ zfs-linux-0.7.12/config/kernel-bio_set_dev.m4
@@ -1,10 +1,10 @@
dnl #
dnl # Linux 4.14 API,
dnl #
-dnl # The bio_set_dev() helper was introduced as part of the transition
+dnl # The bio_set_dev() helper macro was introduced as part of the transition
dnl # to have struct gendisk in struct bio.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
+AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_MACRO], [
AC_MSG_CHECKING([whether bio_set_dev() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/bio.h>
@@ -20,3 +20,35 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
AC_MSG_RESULT(no)
])
])
+
+dnl #
+dnl # Linux 5.0 API,
+dnl #
+dnl # The bio_set_dev() helper macro was updated to internally depend on
+dnl # bio_associate_blkg() symbol which is exported GPL-only.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY], [
+ AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/module.h>
+ #include <linux/bio.h>
+ #include <linux/fs.h>
+
+ MODULE_LICENSE("$ZFS_META_LICENSE");
+ ],[
+ struct block_device *bdev = NULL;
+ struct bio *bio = NULL;
+ bio_set_dev(bio, bdev);
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
+ [bio_set_dev() GPL-only])
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
+ ZFS_AC_KERNEL_BIO_SET_DEV_MACRO
+ ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
+])
Index: zfs-linux-0.7.12/module/zfs/vdev_disk.c
===================================================================
--- zfs-linux-0.7.12.orig/module/zfs/vdev_disk.c
+++ zfs-linux-0.7.12/module/zfs/vdev_disk.c
@@ -502,13 +502,38 @@ vdev_submit_bio_impl(struct bio *bio)
#endif
}
-#ifndef HAVE_BIO_SET_DEV
+#ifdef HAVE_BIO_SET_DEV
+#if defined(CONFIG_BLK_CGROUP) && defined(HAVE_BIO_SET_DEV_GPL_ONLY)
+/*
+ * The Linux 5.0 kernel updated the bio_set_dev() macro so it calls the
+ * GPL-only bio_associate_blkg() symbol thus inadvertently converting