-
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.
In Linux 5.12, the filesystem API was modified to support ipmapped mounts by adding a "struct user_namespace *" parameter to a number functions and VFS handlers. This change adds the needed autoconf macros to detect the new interfaces and updates the code appropriately. This change does not add support for idmapped mounts, instead it preserves the existing behavior by passing the initial user namespace where needed. A subsequent commit will be required to add support for idmapped mounted. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Coleman Kane <ckane@colemankane.org> Closes #11712
- Loading branch information
Showing
22 changed files
with
557 additions
and
123 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,28 @@ | ||
dnl # | ||
dnl # 5.12 API | ||
dnl # | ||
dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace* | ||
dnl # as the first arg, to support idmapped mounts. | ||
dnl # | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [ | ||
ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [ | ||
#include <linux/fs.h> | ||
],[ | ||
struct user_namespace *userns = NULL; | ||
struct inode *in = NULL; | ||
struct kstat *k = NULL; | ||
generic_fillattr(userns, in, k); | ||
]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [ | ||
AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*]) | ||
ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [ | ||
AC_MSG_RESULT([yes]) | ||
AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1, | ||
[generic_fillattr requires struct user_namespace*]) | ||
],[ | ||
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
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 was deleted.
Oops, something went wrong.
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,65 @@ | ||
dnl # | ||
dnl # Supported mkdir() interfaces checked newest to oldest. | ||
dnl # | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [ | ||
dnl # | ||
dnl # 5.12 API change | ||
dnl # The struct user_namespace arg was added as the first argument to | ||
dnl # mkdir() | ||
dnl # | ||
ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [ | ||
#include <linux/fs.h> | ||
int mkdir(struct user_namespace *userns, | ||
struct inode *inode, struct dentry *dentry, | ||
umode_t umode) { return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.mkdir = mkdir, | ||
}; | ||
],[]) | ||
dnl # | ||
dnl # 3.3 API change | ||
dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a | ||
dnl # umode_t type rather than an int. The expectation is that any backport | ||
dnl # would also change all three prototypes. However, if it turns out that | ||
dnl # some distribution doesn't backport the whole thing this could be | ||
dnl # broken apart into three separate checks. | ||
dnl # | ||
ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ | ||
#include <linux/fs.h> | ||
int mkdir(struct inode *inode, struct dentry *dentry, | ||
umode_t umode) { return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.mkdir = mkdir, | ||
}; | ||
],[]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [ | ||
dnl # | ||
dnl # 5.12 API change | ||
dnl # The struct user_namespace arg was added as the first argument to | ||
dnl # mkdir() of the iops structure. | ||
dnl # | ||
AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*]) | ||
ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1, | ||
[iops->mkdir() takes struct user_namespace*]) | ||
],[ | ||
AC_MSG_CHECKING([whether iops->mkdir() takes umode_t]) | ||
ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, | ||
[iops->mkdir() takes umode_t]) | ||
],[ | ||
ZFS_LINUX_TEST_ERROR([mkdir()]) | ||
]) | ||
]) | ||
]) |
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,30 @@ | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [ | ||
dnl # | ||
dnl # 5.12 API change that added the struct user_namespace* arg | ||
dnl # to the front of this function type's arg list. | ||
dnl # | ||
ZFS_LINUX_TEST_SRC([mknod_userns], [ | ||
#include <linux/fs.h> | ||
#include <linux/sched.h> | ||
int tmp_mknod(struct user_namespace *userns, | ||
struct inode *inode ,struct dentry *dentry, | ||
umode_t u, dev_t d) { return 0; } | ||
static const struct inode_operations | ||
iops __attribute__ ((unused)) = { | ||
.mknod = tmp_mknod, | ||
}; | ||
],[]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [ | ||
AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*]) | ||
ZFS_LINUX_TEST_RESULT([mknod_userns], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1, | ||
[iops->mknod() takes struct user_namespace*]) | ||
],[ | ||
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.