Fix -Wuse-after-free warning in dbuf_destroy()
[zfs.git] / config / kernel-vfs-set_page_dirty.m4
blob90cb28f3682cca590e7beda2c717b95982348e12
1 dnl #
2 dnl # Linux 5.14 adds a change to require set_page_dirty to be manually
3 dnl # wired up in struct address_space_operations. Determine if this needs
4 dnl # to be done. This patch set also introduced __set_page_dirty_nobuffers
5 dnl # declaration in linux/pagemap.h, so these tests look for the presence
6 dnl # of that function to tell the compiler to assign set_page_dirty in
7 dnl # module/os/linux/zfs/zpl_file.c
8 dnl #
9 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS], [
10         ZFS_LINUX_TEST_SRC([vfs_has_set_page_dirty_nobuffers], [
11                 #include <linux/pagemap.h>
12                 #include <linux/fs.h>
14                 static const struct address_space_operations
15                     aops __attribute__ ((unused)) = {
16                         .set_page_dirty = __set_page_dirty_nobuffers,
17                 };
18         ],[])
21 AC_DEFUN([ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS], [
22         dnl #
23         dnl # Linux 5.14 change requires set_page_dirty() to be assigned
24         dnl # in address_space_operations()
25         dnl #
26         AC_MSG_CHECKING([whether __set_page_dirty_nobuffers exists])
27         ZFS_LINUX_TEST_RESULT([vfs_has_set_page_dirty_nobuffers], [
28                 AC_MSG_RESULT([yes])
29                 AC_DEFINE(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS, 1,
30                         [__set_page_dirty_nobuffers exists])
31         ],[
32                 AC_MSG_RESULT([no])
33         ])