-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux 5.14 compat: explicity assign set_page_dirty
Kernel 5.14 introduced a change where set_page_dirty of struct address_space_operations is no longer implicitly set to __set_page_dirty_buffers(), which ended up resulting in a NULL pointer deref in the kernel when it is attempted to be called. This change sets .set_page_dirty in the structure to __set_page_dirty_nobuffers(), which was introduced with the related patch set. The breaking change was introduce in commit 0af573780b0b13fceb7fabd49dc1b073cee9a507 to torvalds/linux.git. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Coleman Kane <[email protected]> Closes #12427
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
dnl # | ||
dnl # Linux 5.14 adds a change to require set_page_dirty to be manually | ||
dnl # wired up in struct address_space_operations. Determine if this needs | ||
dnl # to be done. This patch set also introduced __set_page_dirty_nobuffers | ||
dnl # declaration in linux/pagemap.h, so these tests look for the presence | ||
dnl # of that function to tell the compiler to assign set_page_dirty in | ||
dnl # module/os/linux/zfs/zpl_file.c | ||
dnl # | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS], [ | ||
ZFS_LINUX_TEST_SRC([vfs_has_set_page_dirty_nobuffers], [ | ||
#include <linux/pagemap.h> | ||
#include <linux/fs.h> | ||
static const struct address_space_operations | ||
aops __attribute__ ((unused)) = { | ||
.set_page_dirty = __set_page_dirty_nobuffers, | ||
}; | ||
],[]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS], [ | ||
dnl # | ||
dnl # Linux 5.14 change requires set_page_dirty() to be assigned | ||
dnl # in address_space_operations() | ||
dnl # | ||
AC_MSG_CHECKING([__set_page_dirty_nobuffers exists]) | ||
ZFS_LINUX_TEST_RESULT([vfs_has_set_page_dirty_nobuffers], [ | ||
AC_MSG_RESULT([yes]) | ||
AC_DEFINE(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS, 1, | ||
[__set_page_dirty_nobuffers exists]) | ||
],[ | ||
AC_MSG_RESULT([no]) | ||
]) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters