Subject: [Saphira] Linux 7.3: iops->create() without flag arg (2.4.4 port) Saphira-Port-By: Muse Spark 1.3 Contributor for AKADATA LIMITED (Andrew Smalley, Director) Note: The API moved; the data must not. Re-derived hunk by hunk for 2.4.4 and proven by boot, not by inspection. Ports robn/zfs@d01c2c7fdef8 onto OpenZFS 2.4.4: the new autoconf test is appended to the existing kernel-inode-create.m4 (2.4.4 already ships one for the 6.3 idmap change), registered in kernel.m4 like upstream, the decision checks no-flag FIRST so the old chain never errors on 7.3, and zpl_create gains the 3-arg branch in 2.4.4 spelling (param keeps the user_ns name so the body is untouched) plus the shadow-guard extension upstream master does not need (its refactor removed the fallback). --- a/config/kernel-inode-create.m4 +++ b/config/kernel-inode-create.m4 @@ -54,6 +54,13 @@ ]) AC_DEFUN([ZFS_AC_KERNEL_CREATE], [ + AC_MSG_CHECKING([whether iops->create() takes a flag arg]) + ZFS_LINUX_TEST_RESULT([iops_create_no_flag], [ + AC_MSG_RESULT(no) + AC_DEFINE(HAVE_IOPS_CREATE_NO_FLAG_ARG, 1, + [iops->create() does not take a flag arg]) + ],[ + AC_MSG_RESULT(yes) AC_MSG_CHECKING([whether iops->create() takes struct mnt_idmap*]) ZFS_LINUX_TEST_RESULT([create_mnt_idmap], [ AC_MSG_RESULT(yes) @@ -78,4 +85,31 @@ ]) ]) ]) + ]) ]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_IOPS_CREATE_NO_FLAG], [ + ZFS_LINUX_TEST_SRC([iops_create_no_flag], [ + #include + + static int test_iops_create(struct mnt_idmap *idmap, + struct inode *inode, struct dentry *dentry, + umode_t mode) { return 0; } + + static const struct inode_operations test_iops + __attribute__ ((unused)) = { + .create = test_iops_create + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_IOPS_CREATE_NO_FLAG], [ + AC_MSG_CHECKING([whether iops->create() takes a flag arg]) + ZFS_LINUX_TEST_RESULT([iops_create_no_flag], [ + AC_MSG_RESULT(no) + AC_DEFINE(HAVE_IOPS_CREATE_NO_FLAG_ARG, 1, + [iops->create() does not take a flag arg]) + ],[ + AC_MSG_RESULT(yes) + ]) +]) --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -63,6 +63,7 @@ ZFS_AC_KERNEL_SRC_INODE_STATE_READ_ONCE ZFS_AC_KERNEL_SRC_SHOW_OPTIONS ZFS_AC_KERNEL_SRC_SHRINKER + ZFS_AC_KERNEL_SRC_IOPS_CREATE_NO_FLAG ZFS_AC_KERNEL_SRC_MKDIR ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS ZFS_AC_KERNEL_SRC_IDMAP @@ -188,6 +189,7 @@ ZFS_AC_KERNEL_INODE_STATE_READ_ONCE ZFS_AC_KERNEL_SHOW_OPTIONS ZFS_AC_KERNEL_SHRINKER + ZFS_AC_KERNEL_IOPS_CREATE_NO_FLAG ZFS_AC_KERNEL_MKDIR ZFS_AC_KERNEL_LOOKUP_FLAGS ZFS_AC_KERNEL_IDMAP --- a/module/os/linux/zfs/zpl_inode.c +++ b/module/os/linux/zfs/zpl_inode.c @@ -165,7 +165,10 @@ } static int -#ifdef HAVE_IOPS_CREATE_USERNS +#ifdef HAVE_IOPS_CREATE_NO_FLAG_ARG +zpl_create(struct mnt_idmap *user_ns, struct inode *dir, + struct dentry *dentry, umode_t mode) +#elif defined(HAVE_IOPS_CREATE_USERNS) zpl_create(struct user_namespace *user_ns, struct inode *dir, struct dentry *dentry, umode_t mode, bool flag) #elif defined(HAVE_IOPS_CREATE_IDMAP) @@ -180,7 +183,7 @@ vattr_t *vap; int error; fstrans_cookie_t cookie; -#if !(defined(HAVE_IOPS_CREATE_USERNS) || defined(HAVE_IOPS_CREATE_IDMAP)) +#if !(defined(HAVE_IOPS_CREATE_USERNS) || defined(HAVE_IOPS_CREATE_IDMAP) || defined(HAVE_IOPS_CREATE_NO_FLAG_ARG)) zidmap_t *user_ns = kcred->user_ns; #endif