Skip to content

Commit b67b5af

Browse files
committed
Linux 6.12: PG_error flag was removed
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/ Signed-off-by: Rob Norris <[email protected]>
1 parent a2db824 commit b67b5af

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

config/kernel-mm-page-flags.m4

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR], [
2+
ZFS_LINUX_TEST_SRC([mm_page_flag_error], [
3+
#include <linux/page-flags.h>
4+
5+
static enum pageflags
6+
test_flag __attribute__((unused)) = PG_error;
7+
])
8+
])
9+
AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR], [
10+
AC_MSG_CHECKING([whether PG_error flag is available])
11+
ZFS_LINUX_TEST_RESULT([mm_page_flag_error], [
12+
AC_MSG_RESULT(yes)
13+
AC_DEFINE(HAVE_MM_PAGE_FLAG_ERROR, 1, [PG_error flag is available])
14+
],[
15+
AC_MSG_RESULT(no)
16+
])
17+
])
18+
19+
AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS], [
20+
ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR
21+
])
22+
AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAGS], [
23+
ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR
24+
])

config/kernel.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
125125
ZFS_AC_KERNEL_SRC_PROC_HANDLER_CTL_TABLE_CONST
126126
ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ
127127
ZFS_AC_KERNEL_SRC_SYNC_BDEV
128+
ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS
128129
ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE
129130
ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING
130131
ZFS_AC_KERNEL_SRC_FILE
@@ -236,6 +237,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
236237
ZFS_AC_KERNEL_PROC_HANDLER_CTL_TABLE_CONST
237238
ZFS_AC_KERNEL_COPY_SPLICE_READ
238239
ZFS_AC_KERNEL_SYNC_BDEV
240+
ZFS_AC_KERNEL_MM_PAGE_FLAGS
239241
ZFS_AC_KERNEL_MM_PAGE_SIZE
240242
ZFS_AC_KERNEL_MM_PAGE_MAPPING
241243
ZFS_AC_KERNEL_1ARG_ASSIGN_STR

include/os/linux/kernel/linux/mm_compat.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,18 @@
4040
#define page_mapping(p) folio_mapping(page_folio(p))
4141
#endif
4242

43+
/*
44+
* 6.12 removed PG_error, SetPageError and ClearPageError, with no direct
45+
* replacement, because page writeback errors are recorded elsewhere. Since we
46+
* only use the page cache to assist with mmap(), never directly backing it
47+
* with IO, it shouldn't be possible for this condition to occur on our pages
48+
* anyway, even if this is the right way to report it. So it should be safe
49+
* to remove, but for avoidance of doubt, we make it a no-op on 6.12 and leave
50+
* it for everything else.
51+
*/
52+
#ifndef HAVE_MM_PAGE_FLAG_ERROR
53+
#define SetPageError(p) do {} while (0)
54+
#define ClearPageError(p) do {} while (0)
55+
#endif
56+
4357
#endif /* _ZFS_MM_COMPAT_H */

module/os/linux/zfs/zfs_znode_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <sys/sa.h>
5959
#include <sys/zfs_sa.h>
6060
#include <sys/zfs_stat.h>
61+
#include <linux/mm_compat.h>
6162

6263
#include "zfs_prop.h"
6364
#include "zfs_comutil.h"

0 commit comments

Comments
 (0)