forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux 6.3 compat: idmapped mount API changes
Linux kernel 6.3 changed a bunch of APIs to use the dedicated idmap type for mounts (struct mnt_idmap), we need to detect these changes and make zfs work with the new APIs. NOTE: This backport only includes the configure checks to detect the 6.3 idmap API changes. It does not include support for idmap. When provided the idmap variable is ignored in most case in the same way the user_ns argument was ignored. This change is solely to provide compatibility with the new interfaces. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Youzhong Yang <yyang@mathworks.com> Closes openzfs#14682
- Loading branch information
1 parent
80c4e2c
commit 584e4e2
Showing
27 changed files
with
703 additions
and
160 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [ | ||
dnl # | ||
dnl # Linux 6.3 API | ||
dnl # The first arg of setattr I/O operations handler type | ||
dnl # is changed to struct mnt_idmap* | ||
dnl # | ||
ZFS_LINUX_TEST_SRC([inode_operations_setattr_mnt_idmap], [ | ||
#include <linux/fs.h> | ||
int test_setattr( | ||
struct mnt_idmap *idmap, | ||
struct dentry *de, struct iattr *ia) | ||
{ return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.setattr = test_setattr, | ||
}; | ||
],[]) | ||
dnl # | ||
dnl # Linux 5.12 API | ||
dnl # The setattr I/O operations handler type was extended to require | ||
dnl # a struct user_namespace* as its first arg, to support idmapped | ||
dnl # mounts. | ||
dnl # | ||
ZFS_LINUX_TEST_SRC([inode_operations_setattr_userns], [ | ||
#include <linux/fs.h> | ||
int test_setattr( | ||
struct user_namespace *userns, | ||
struct dentry *de, struct iattr *ia) | ||
{ return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.setattr = test_setattr, | ||
}; | ||
],[]) | ||
ZFS_LINUX_TEST_SRC([inode_operations_setattr], [ | ||
#include <linux/fs.h> | ||
int test_setattr( | ||
struct dentry *de, struct iattr *ia) | ||
{ return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.setattr = test_setattr, | ||
}; | ||
],[]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_INODE_SETATTR], [ | ||
dnl # | ||
dnl # Kernel 6.3 test | ||
dnl # | ||
AC_MSG_CHECKING([whether iops->setattr() takes mnt_idmap]) | ||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr_mnt_idmap], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_IDMAP_IOPS_SETATTR, 1, | ||
[iops->setattr() takes struct mnt_idmap*]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
dnl # | ||
dnl # Kernel 5.12 test | ||
dnl # | ||
AC_MSG_CHECKING([whether iops->setattr() takes user_namespace]) | ||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr_userns], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_USERNS_IOPS_SETATTR, 1, | ||
[iops->setattr() takes struct user_namespace*]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
AC_MSG_CHECKING([whether iops->setattr() exists]) | ||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_IOPS_SETATTR, 1, | ||
[iops->setattr() 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
Oops, something went wrong.