diff --git a/config/kernel-mm-page-flags.m4 b/config/kernel-mm-page-flags.m4 new file mode 100644 index 000000000..b12771183 --- /dev/null +++ b/config/kernel-mm-page-flags.m4 @@ -0,0 +1,24 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR], [ + ZFS_LINUX_TEST_SRC([mm_page_flag_error], [ + #include + + static enum pageflags + test_flag __attribute__((unused)) = PG_error; + ]) +]) +AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR], [ + AC_MSG_CHECKING([whether PG_error flag is available]) + ZFS_LINUX_TEST_RESULT([mm_page_flag_error], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MM_PAGE_FLAG_ERROR, 1, [PG_error flag is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS], [ + ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR +]) +AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAGS], [ + ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index bfd8404cd..556df5808 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -125,6 +125,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_PROC_HANDLER_CTL_TABLE_CONST ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ ZFS_AC_KERNEL_SRC_SYNC_BDEV + ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING ZFS_AC_KERNEL_SRC_FILE @@ -236,6 +237,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_PROC_HANDLER_CTL_TABLE_CONST ZFS_AC_KERNEL_COPY_SPLICE_READ ZFS_AC_KERNEL_SYNC_BDEV + ZFS_AC_KERNEL_MM_PAGE_FLAGS ZFS_AC_KERNEL_MM_PAGE_SIZE ZFS_AC_KERNEL_MM_PAGE_MAPPING ZFS_AC_KERNEL_1ARG_ASSIGN_STR diff --git a/include/os/linux/kernel/linux/mm_compat.h b/include/os/linux/kernel/linux/mm_compat.h index 817f6df42..4cdc0e099 100644 --- a/include/os/linux/kernel/linux/mm_compat.h +++ b/include/os/linux/kernel/linux/mm_compat.h @@ -40,4 +40,18 @@ #define page_mapping(p) folio_mapping(page_folio(p)) #endif +/* + * 6.12 removed PG_error, SetPageError and ClearPageError, with no direct + * replacement, because page writeback errors are recorded elsewhere. Since we + * only use the page cache to assist with mmap(), never directly backing it + * with IO, it shouldn't be possible for this condition to occur on our pages + * anyway, even if this is the right way to report it. So it should be safe + * to remove, but for avoidance of doubt, we make it a no-op on 6.12 and leave + * it for everything else. + */ +#ifndef HAVE_MM_PAGE_FLAG_ERROR +#define SetPageError(p) do {} while (0) +#define ClearPageError(p) do {} while (0) +#endif + #endif /* _ZFS_MM_COMPAT_H */ diff --git a/module/os/linux/zfs/zfs_znode_os.c b/module/os/linux/zfs/zfs_znode_os.c index cea15ad4b..bc1e17f08 100644 --- a/module/os/linux/zfs/zfs_znode_os.c +++ b/module/os/linux/zfs/zfs_znode_os.c @@ -58,6 +58,7 @@ #include #include #include +#include #include "zfs_prop.h" #include "zfs_comutil.h"