]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 6.12: PG_error flag was removed
authorRob Norris <robn@despairlabs.com>
Tue, 24 Sep 2024 07:17:00 +0000 (17:17 +1000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 1 Oct 2024 20:54:05 +0000 (13:54 -0700)
torvalds/linux@09022bc196d2 removes the flag, and the corresponding
SetPageError() and ClearPageError() macros, with no replacement offered.

Going back through the upstream history, use of this flag has been
gradually removed over the last year as part of the long tail of
converting everything to folios. Interesting tidbit comments from
torvalds/linux@29e9412b250e and torvalds/linux@420e05d0de18 suggest that
this flag has not been used meaningfully since page writeback failures
started being recorded in errseq_t instead (the whole "fsyncgate" thing,
~2017, around torvalds/linux@8ed1e46aaf1b).

Given that, it's possible that since perhaps Linux 4.13 we haven't been
getting anything by setting the flag. I don't know if that's true and/or
if there's something we should be doing instead, but my gut feel is that
its probably fine we only use the page cache as a proxy to allow mmap()
to work, rather than backing IO with it.

As such, I'm expecting that removing this will do no harm, but I'm
leaving it in for older kernels to maintain status quo, and if there is
an overall better way, that is left for a future change.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16582

config/kernel-mm-page-flags.m4 [new file with mode: 0644]
config/kernel.m4
include/os/linux/kernel/linux/mm_compat.h
module/os/linux/zfs/zfs_znode_os.c

diff --git a/config/kernel-mm-page-flags.m4 b/config/kernel-mm-page-flags.m4
new file mode 100644 (file)
index 0000000..b127711
--- /dev/null
@@ -0,0 +1,24 @@
+AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR], [
+       ZFS_LINUX_TEST_SRC([mm_page_flag_error], [
+               #include <linux/page-flags.h>
+
+               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
+])
index bfd8404cdbe29f19778f5f7837a12f7909b9b06d..556df58082f9c20dd402bd69c121997b935d49c9 100644 (file)
@@ -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
index 817f6df422de82c619a3f1d31c95148e4564b129..4cdc0e0999948f2c1a6e2507cb873e18003d70a9 100644 (file)
 #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 */
index cea15ad4bc968c24122d3b413f1c6bb16485b988..bc1e17f086d90a6c1ac42a4a464559fddcbb8f1a 100644 (file)
@@ -58,6 +58,7 @@
 #include <sys/sa.h>
 #include <sys/zfs_sa.h>
 #include <sys/zfs_stat.h>
+#include <linux/mm_compat.h>
 
 #include "zfs_prop.h"
 #include "zfs_comutil.h"