Fix -Wuse-after-free warning in dbuf_destroy()
[zfs.git] / config / kernel-is_owner_or_cap.m4
bloba90cf3da641d88e46000a3f463000546c6d36f80
1 dnl #
2 dnl # 2.6.39 API change,
3 dnl # The is_owner_or_cap() macro was renamed to inode_owner_or_capable(),
4 dnl # This is used for permission checks in the xattr and file attribute call
5 dnl # paths.
6 dnl #
7 dnl # 5.12 API change,
8 dnl # inode_owner_or_capable() now takes struct user_namespace *
9 dnl # to support idmapped mounts
10 dnl #
11 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
12         ZFS_LINUX_TEST_SRC([inode_owner_or_capable], [
13                 #include <linux/fs.h>
14         ],[
15                 struct inode *ip = NULL;
16                 (void) inode_owner_or_capable(ip);
17         ])
19         ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [
20                 #include <linux/fs.h>
21         ],[
22                 struct inode *ip = NULL;
23                 (void) inode_owner_or_capable(&init_user_ns, ip);
24         ])
27 AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
28         AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
29         ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [
30                 AC_MSG_RESULT(yes)
31                 AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
32                     [inode_owner_or_capable() exists])
33         ], [
34                 AC_MSG_RESULT(no)
36                 AC_MSG_CHECKING(
37                     [whether inode_owner_or_capable() takes user_ns])
38                 ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [
39                         AC_MSG_RESULT(yes)
40                         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1,
41                             [inode_owner_or_capable() takes user_ns])
42                 ],[
43                         ZFS_LINUX_TEST_ERROR([capability])
44                 ])
45         ])