From 5b81b1e707ce0ace30e555ac31132a0cbff1e5b7 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Tue, 11 Jul 2023 19:42:27 +0700 Subject: [PATCH] LU-16667 build: struct mnt_idmap, linux/filelock.h Linux commit v6.2-rc3-9-g5970e15dbcfe filelock: move file locking definitions to separate header file Add configure test for linux/filelock.h and include it where needed. linux kernel v6.2-rc1-4-gb74d24f7a74f fs: port ->getattr() to pass mnt_idmap linux kernel v6.2-rc1-3-gc1632a0f1120 fs: port ->setattr() to pass mnt_idmap Add a configure test for mnt_idmap and fallback to using user_namespace for older kernels. Lustre-change: https://review.whamcloud.com/50420 Lustre-commit: 3011aa564a8c682aafbc6071b9866e266d8a6232 Test-Parameters: trivial HPE-bug-id: LUS-11557 Signed-off-by: Shaun Tancheff Change-Id: Ib8cbb3157fb11b4f1fc55f1626c2998cb202bd8c Reviewed-by: Andreas Dilger Reviewed-by: Alex Deiter Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51756 Tested-by: jenkins Tested-by: Maloo --- libcfs/libcfs/crypto/policy.c | 2 +- lustre/autoconf/lustre-core.m4 | 61 +++++++++++++++++++++++++++++++++++++++-- lustre/include/lustre_compat.h | 23 ++++++++++------ lustre/ldlm/ldlm_flock.c | 3 ++ lustre/llite/file.c | 20 ++++++++------ lustre/llite/llite_internal.h | 12 ++++---- lustre/llite/llite_lib.c | 7 ++--- lustre/llite/namei.c | 17 ++++++------ lustre/llite/pcc.c | 12 ++++---- lustre/llite/symlink.c | 4 +-- lustre/llite/xattr.c | 8 +++--- lustre/osd-ldiskfs/osd_compat.c | 4 +-- lustre/osd-ldiskfs/osd_oi.c | 2 +- 13 files changed, 119 insertions(+), 56 deletions(-) diff --git a/libcfs/libcfs/crypto/policy.c b/libcfs/libcfs/crypto/policy.c index 3b99074..c2ce619 100644 --- a/libcfs/libcfs/crypto/policy.c +++ b/libcfs/libcfs/crypto/policy.c @@ -353,7 +353,7 @@ int llcrypt_ioctl_set_policy(struct file *filp, const void __user *arg) } } - if (!inode_owner_or_capable(&init_user_ns, inode)) + if (!inode_owner_or_capable(&nop_mnt_idmap, inode)) return -EACCES; ret = mnt_want_write_file(filp); diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0be055b..6a65225 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3487,11 +3487,10 @@ AC_DEFUN([LC_SRC_HAVE_ACL_WITH_DENTRY], [ LB2_LINUX_TEST_SRC([acl_with_dentry], [ #include ],[ - struct user_namespace *ns = NULL; struct dentry *dentry = NULL; - ((struct inode_operations *)1)->get_acl(ns, dentry, 0); - (void)ns; (void)dentry; + ((struct inode_operations *)1)->get_acl(NULL, dentry, 0); + (void)dentry; ],[-Werror]) ]) AC_DEFUN([LC_HAVE_ACL_WITH_DENTRY], [ @@ -3526,6 +3525,58 @@ AC_DEFUN([LC_HAVE_U64_CAPABILITY], [ ]) # LC_HAVE_U64_CAPABILITY # +# LC_HAVE_MNT_IDMAP_ARG +# +# linux kernel v6.2-rc1-4-gb74d24f7a74f +# fs: port ->getattr() to pass mnt_idmap +# linux kernel v6.2-rc1-3-gc1632a0f1120 +# fs: port ->setattr() to pass mnt_idmap +# +AC_DEFUN([LC_SRC_HAVE_MNT_IDMAP_ARG], [ + LB2_LINUX_TEST_SRC([inode_ops_getattr_has_mnt_idmap_argument], [ + #include + #include + ],[ + ((struct inode_operations *)1)->getattr((struct mnt_idmap *)NULL, + NULL, NULL, 0, 0); + ],[-Werror]) +]) +AC_DEFUN([LC_HAVE_MNT_IDMAP_ARG], [ + AC_MSG_CHECKING([if 'inode_operations' members have mnt_idmap argument]) + LB2_LINUX_TEST_RESULT([inode_ops_getattr_has_mnt_idmap_argument], [ + AC_DEFINE(HAVE_MNT_IDMAP_ARG, 1, + ['inode_operations' members have mnt_idmap argument]) + AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1, + [use mnt_idmap in place of user_namespace argument]) + AC_DEFINE(HAVE_DQUOT_TRANSFER_WITH_USER_NS, 1, + [use mnt_idmap with dquot_transfer]) + ]) +]) # LC_HAVE_MNT_IDMAP_ARG + +# +# LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK +# +# Linux commit v6.2-rc3-9-g5970e15dbcfe +# filelock: move file locking definitions to separate header file +# +AC_DEFUN([LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK], [ + LB2_LINUX_TEST_SRC([locks_lock_file_wait_in_filelock], [ + #include + ],[ + locks_lock_file_wait(NULL, NULL); + ]) +]) +AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK], [ + AC_MSG_CHECKING([if 'locks_lock_file_wait' exists in filelock.h]) + LB2_LINUX_TEST_RESULT([locks_lock_file_wait_in_filelock], [ + AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1, + [kernel has locks_lock_file_wait in filelock.h]) + AC_DEFINE(HAVE_LINUX_FILELOCK_HEADER, 1, + [linux/filelock.h is present]) + ]) +]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -3747,6 +3798,8 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ # 6.3 LC_SRC_HAVE_U64_CAPABILITY + LC_SRC_HAVE_MNT_IDMAP_ARG + LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK # kernel patch to extend integrity interface LC_SRC_BIO_INTEGRITY_PREP_FN @@ -3995,6 +4048,8 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ # 6.3 LC_HAVE_U64_CAPABILITY + LC_HAVE_MNT_IDMAP_ARG + LC_HAVE_LOCKS_LOCK_FILE_WAIT_IN_FILELOCK # kernel patch to extend integrity interface LC_BIO_INTEGRITY_PREP_FN diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 2185dfa..867930b 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -117,6 +117,11 @@ static inline int d_in_lookup(struct dentry *dentry) #define vfs_unlink(ns, dir, de) vfs_unlink(dir, de) #endif +#ifndef HAVE_MNT_IDMAP_ARG +#define mnt_idmap user_namespace +#define nop_mnt_idmap init_user_ns +#endif + static inline int ll_vfs_getattr(struct path *path, struct kstat *st, u32 request_mask, unsigned int flags) { @@ -222,7 +227,9 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) #ifdef HAVE_IOP_SET_ACL #ifdef CONFIG_LUSTRE_FS_POSIX_ACL -#if !defined(HAVE_USER_NAMESPACE_ARG) && !defined(HAVE_POSIX_ACL_UPDATE_MODE) +#if !defined(HAVE_USER_NAMESPACE_ARG) \ + && !defined(HAVE_POSIX_ACL_UPDATE_MODE) \ + && !defined(HAVE_MNT_IDMAP_ARG) static inline int posix_acl_update_mode(struct inode *inode, umode_t *mode_p, struct posix_acl **acl) { @@ -477,8 +484,8 @@ static inline int ll_vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { -#ifdef HAVE_USER_NAMESPACE_ARG - return vfs_getxattr(&init_user_ns, dentry, name, value, size); +#if defined(HAVE_MNT_IDMAP_ARG) || defined(HAVE_USER_NAMESPACE_ARG) + return vfs_getxattr(&nop_mnt_idmap, dentry, name, value, size); #elif defined(HAVE_VFS_SETXATTR) return __vfs_getxattr(dentry, inode, name, value, size); #else @@ -493,8 +500,8 @@ static inline int ll_vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { -#ifdef HAVE_USER_NAMESPACE_ARG - return vfs_setxattr(&init_user_ns, dentry, name, +#if defined(HAVE_MNT_IDMAP_ARG) || defined(HAVE_USER_NAMESPACE_ARG) + return vfs_setxattr(&nop_mnt_idmap, dentry, name, VFS_SETXATTR_VALUE(value), size, flags); #elif defined(HAVE_VFS_SETXATTR) return __vfs_setxattr(dentry, inode, name, value, size, flags); @@ -509,8 +516,8 @@ static inline int ll_vfs_setxattr(struct dentry *dentry, struct inode *inode, static inline int ll_vfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name) { -#ifdef HAVE_USER_NAMESPACE_ARG - return vfs_removexattr(&init_user_ns, dentry, name); +#if defined(HAVE_MNT_IDMAP_ARG) || defined(HAVE_USER_NAMESPACE_ARG) + return vfs_removexattr(&nop_mnt_idmap, dentry, name); #elif defined(HAVE_VFS_SETXATTR) return __vfs_removexattr(dentry, name); #else @@ -592,7 +599,7 @@ static inline void ll_security_release_secctx(char *secdata, u32 seclen, #define force_uaccess_end(fs_save) set_fs(fs_save) #endif -#ifndef HAVE_USER_NAMESPACE_ARG +#if !defined(HAVE_USER_NAMESPACE_ARG) && !defined(HAVE_MNT_IDMAP_ARG) #define posix_acl_update_mode(ns, inode, mode, acl) \ posix_acl_update_mode(inode, mode, acl) #define notify_change(ns, de, attr, inode) notify_change(de, attr, inode) diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index fe77edb..2617e65 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -53,6 +53,9 @@ #define DEBUG_SUBSYSTEM S_LDLM #include +#ifdef HAVE_LINUX_FILELOCK_HEADER +#include +#endif #include #include #include diff --git a/lustre/llite/file.c b/lustre/llite/file.c index bdcc6a0..022845f 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -45,6 +45,9 @@ #include #include #include +#ifdef HAVE_LINUX_FILELOCK_HEADER +#include +#endif #include #include @@ -1312,8 +1315,8 @@ static int ll_check_swap_layouts_validity(struct inode *inode1, if (!S_ISREG(inode1->i_mode) || !S_ISREG(inode2->i_mode)) return -EINVAL; - if (inode_permission(&init_user_ns, inode1, MAY_WRITE) || - inode_permission(&init_user_ns, inode2, MAY_WRITE)) + if (inode_permission(&nop_mnt_idmap, inode1, MAY_WRITE) || + inode_permission(&nop_mnt_idmap, inode2, MAY_WRITE)) return -EPERM; if (inode1->i_sb != inode2->i_sb) @@ -5690,7 +5693,7 @@ fill_attr: } #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_INODEOPS_ENHANCED_GETATTR) -int ll_getattr(struct user_namespace *mnt_userns, const struct path *path, +int ll_getattr(struct mnt_idmap *map, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags) { return ll_getattr_dentry(path->dentry, stat, request_mask, flags); @@ -5857,7 +5860,7 @@ out: struct posix_acl *ll_get_acl( #ifdef HAVE_ACL_WITH_DENTRY - struct user_namespace *ns, struct dentry *dentry, int type) + struct mnt_idmap *map, struct dentry *dentry, int type) #elif defined HAVE_GET_ACL_RCU_ARG struct inode *inode, int type, bool rcu) #else @@ -5886,7 +5889,7 @@ struct posix_acl *ll_get_acl( #ifdef HAVE_IOP_SET_ACL #ifdef CONFIG_LUSTRE_FS_POSIX_ACL -int ll_set_acl(struct user_namespace *mnt_userns, +int ll_set_acl(struct mnt_idmap *map, #ifdef HAVE_ACL_WITH_DENTRY struct dentry *dentry, #else @@ -5906,7 +5909,7 @@ int ll_set_acl(struct user_namespace *mnt_userns, case ACL_TYPE_ACCESS: name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) - rc = posix_acl_update_mode(mnt_userns, inode, + rc = posix_acl_update_mode(map, inode, &inode->i_mode, &acl); break; @@ -5951,8 +5954,7 @@ out: #endif /* CONFIG_LUSTRE_FS_POSIX_ACL */ #endif /* HAVE_IOP_SET_ACL */ -int ll_inode_permission(struct user_namespace *mnt_userns, struct inode *inode, - int mask) +int ll_inode_permission(struct mnt_idmap *idmap, struct inode *inode, int mask) { int rc = 0; struct ll_sb_info *sbi; @@ -6007,7 +6009,7 @@ int ll_inode_permission(struct user_namespace *mnt_userns, struct inode *inode, old_cred = override_creds(cred); } - rc = generic_permission(mnt_userns, inode, mask); + rc = generic_permission(idmap, inode, mask); /* restore current process's credentials and FS capability */ if (squash_id) { revert_creds(old_cred); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 6849434..526e2c4 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1255,7 +1255,7 @@ extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct ll_file_data *file, loff_t pos, size_t count, int rw); #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_INODEOPS_ENHANCED_GETATTR) -int ll_getattr(struct user_namespace *mnt_userns, const struct path *path, +int ll_getattr(struct mnt_idmap *, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags); #else int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat); @@ -1264,7 +1264,7 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask, unsigned int flags); struct posix_acl *ll_get_acl( #ifdef HAVE_ACL_WITH_DENTRY - struct user_namespace *, struct dentry *, int type); + struct mnt_idmap *, struct dentry *, int type); #elif defined HAVE_GET_ACL_RCU_ARG struct inode *inode, int type, bool rcu); #else @@ -1273,7 +1273,7 @@ struct posix_acl *ll_get_acl( #ifdef HAVE_IOP_SET_ACL #ifdef CONFIG_LUSTRE_FS_POSIX_ACL -int ll_set_acl(struct user_namespace *mnt_userns, +int ll_set_acl(struct mnt_idmap *mnt_userns, #ifdef HAVE_ACL_WITH_DENTRY struct dentry *dentry, #else @@ -1306,8 +1306,7 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum, const char *name, __u32 flags); int ll_get_fid_by_name(struct inode *parent, const char *name, int namelen, struct lu_fid *fid, struct inode **inode); -int ll_inode_permission(struct user_namespace *mnt_userns, struct inode *inode, - int mask); +int ll_inode_permission(struct mnt_idmap *, struct inode *inode, int mask); int ll_ioctl_check_project(struct inode *inode, __u32 xflags, __u32 projid); int ll_ioctl_fsgetxattr(struct inode *inode, unsigned int cmd, unsigned long arg); @@ -1368,8 +1367,7 @@ int volatile_ref_file(const char *volatile_name, int volatile_len, struct file **ref_file); int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, enum op_xvalid xvalid, bool hsm_import); -int ll_setattr(struct user_namespace *mnt_userns, struct dentry *de, - struct iattr *attr); +int ll_setattr(struct mnt_idmap *, struct dentry *de, struct iattr *attr); int ll_statfs(struct dentry *de, struct kstatfs *sfs); int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs, u32 flags); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 82d2c45..bb32bfa 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1832,7 +1832,7 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data) !S_ISDIR(inode->i_mode)) { ia_valid = op_data->op_attr.ia_valid; op_data->op_attr.ia_valid &= ~TIMES_SET_FLAGS; - rc = simple_setattr(&init_user_ns, dentry, + rc = simple_setattr(&nop_mnt_idmap, dentry, &op_data->op_attr); op_data->op_attr.ia_valid = ia_valid; } @@ -1855,7 +1855,7 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data) op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE); if (S_ISREG(inode->i_mode)) inode_lock(inode); - rc = simple_setattr(&init_user_ns, dentry, &op_data->op_attr); + rc = simple_setattr(&nop_mnt_idmap, dentry, &op_data->op_attr); if (S_ISREG(inode->i_mode)) inode_unlock(inode); op_data->op_attr.ia_valid = ia_valid; @@ -2334,8 +2334,7 @@ out: RETURN(rc); } -int ll_setattr(struct user_namespace *mnt_userns, struct dentry *de, - struct iattr *attr) +int ll_setattr(struct mnt_idmap *map, struct dentry *de, struct iattr *attr) { int mode = de->d_inode->i_mode; enum op_xvalid xvalid = 0; diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 4299c53..f5aa31f 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1218,7 +1218,7 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, * to proceed with lookup. LU-4185 */ if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN) && - (inode_permission(&init_user_ns, + (inode_permission(&nop_mnt_idmap, parent, MAY_WRITE | MAY_EXEC) == 0)) return NULL; @@ -1873,7 +1873,7 @@ err_exit: RETURN(err); } -static int ll_mknod(struct user_namespace *mnt_userns, struct inode *dir, +static int ll_mknod(struct mnt_idmap *map, struct inode *dir, struct dentry *dchild, umode_t mode, dev_t rdev) { ktime_t kstart = ktime_get(); @@ -1915,9 +1915,8 @@ static int ll_mknod(struct user_namespace *mnt_userns, struct inode *dir, /* * Plain create. Intent create is handled in atomic_open. */ -static int ll_create_nd(struct user_namespace *mnt_userns, - struct inode *dir, struct dentry *dentry, - umode_t mode, bool want_excl) +static int ll_create_nd(struct mnt_idmap *map, struct inode *dir, + struct dentry *dentry, umode_t mode, bool want_excl) { ktime_t kstart = ktime_get(); int rc; @@ -1930,7 +1929,7 @@ static int ll_create_nd(struct user_namespace *mnt_userns, /* Using mknod(2) to create a regular file is designed to not recognize * volatile file name, so we use ll_mknod() here. */ - rc = ll_mknod(mnt_userns, dir, dentry, mode, 0); + rc = ll_mknod(map, dir, dentry, mode, 0); CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, unhashed %d\n", dentry, d_unhashed(dentry)); @@ -1942,7 +1941,7 @@ static int ll_create_nd(struct user_namespace *mnt_userns, return rc; } -static int ll_symlink(struct user_namespace *mnt_userns, struct inode *dir, +static int ll_symlink(struct mnt_idmap *map, struct inode *dir, struct dentry *dchild, const char *oldpath) { ktime_t kstart = ktime_get(); @@ -2012,7 +2011,7 @@ out: RETURN(err); } -static int ll_mkdir(struct user_namespace *mnt_userns, struct inode *dir, +static int ll_mkdir(struct mnt_idmap *map, struct inode *dir, struct dentry *dchild, umode_t mode) { ktime_t kstart = ktime_get(); @@ -2179,7 +2178,7 @@ out: RETURN(rc); } -static int ll_rename(struct user_namespace *mnt_userns, +static int ll_rename(struct mnt_idmap *map, struct inode *src, struct dentry *src_dchild, struct inode *tgt, struct dentry *tgt_dchild #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_IOPS_RENAME_WITH_FLAGS) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 01fbbcf..0758c55 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2779,7 +2779,7 @@ int pcc_inode_setattr(struct inode *inode, struct iattr *attr, inode_lock(pcc_dentry->d_inode); old_cred = override_creds(pcc_super_cred(inode->i_sb)); #ifdef HAVE_USER_NAMESPACE_ARG - rc = pcc_dentry->d_inode->i_op->setattr(&init_user_ns, pcc_dentry, + rc = pcc_dentry->d_inode->i_op->setattr(&nop_mnt_idmap, pcc_dentry, &attr2); #else rc = pcc_dentry->d_inode->i_op->setattr(pcc_dentry, &attr2); @@ -3428,7 +3428,7 @@ static int pcc_inode_remove(struct inode *inode, struct dentry *pcc_dentry) { int rc; - rc = vfs_unlink(&init_user_ns, + rc = vfs_unlink(&nop_mnt_idmap, pcc_dentry->d_parent->d_inode, pcc_dentry); if (rc && rc != -ENOENT) CWARN("%s: failed to unlink PCC file %pd: rc = %d\n", @@ -3453,7 +3453,7 @@ pcc_mkdir(struct dentry *base, const char *name, umode_t mode) if (d_is_positive(dentry)) goto out; - rc = vfs_mkdir(&init_user_ns, dir, dentry, mode); + rc = vfs_mkdir(&nop_mnt_idmap, dir, dentry, mode); if (rc) { dput(dentry); dentry = ERR_PTR(rc); @@ -3509,7 +3509,7 @@ pcc_create(struct dentry *base, const char *name, umode_t mode) if (d_is_positive(dentry)) goto out; - rc = vfs_create(&init_user_ns, dir, dentry, mode, false); + rc = vfs_create(&nop_mnt_idmap, dir, dentry, mode, false); if (rc) { dput(dentry); dentry = ERR_PTR(rc); @@ -3576,7 +3576,7 @@ int pcc_inode_reset_iattr(struct inode *lustre_inode, struct dentry *dentry, attr.ia_mtime = lustre_inode->i_mtime; inode_lock(inode); - rc = notify_change(&init_user_ns, dentry, &attr, NULL); + rc = notify_change(&nop_mnt_idmap, dentry, &attr, NULL); inode_unlock(inode); RETURN(rc); @@ -3754,7 +3754,7 @@ void pcc_create_attach_cleanup(struct super_block *sb, int rc; old_cred = override_creds(pcc_super_cred(sb)); - rc = vfs_unlink(&init_user_ns, + rc = vfs_unlink(&nop_mnt_idmap, pca->pca_dentry->d_parent->d_inode, pca->pca_dentry); if (rc) diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index b2458c7..5f2d14a 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -282,7 +282,7 @@ static const char *ll_follow_link(struct dentry *dentry, void **cookie) #if defined(HAVE_USER_NAMESPACE_ARG) || defined(HAVE_INODEOPS_ENHANCED_GETATTR) static int ll_getattr_link( #if defined(HAVE_USER_NAMESPACE_ARG) - struct user_namespace *mnt_userns, + struct mnt_idmap *map, #endif const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags) @@ -293,7 +293,7 @@ static int ll_getattr_link( const char *link; int rc; - rc = ll_getattr(mnt_userns, path, stat, request_mask, flags); + rc = ll_getattr(map, path, stat, request_mask, flags); if (rc || !IS_ENCRYPTED(inode)) return rc; diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index 5b6ded8..58af7f5 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -98,7 +98,7 @@ static int xattr_type_filter(struct ll_sb_info *sbi, #endif static int ll_xattr_set_common(const struct xattr_handler *handler, - struct user_namespace *mnt_userns, + struct mnt_idmap *map, struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) @@ -131,7 +131,7 @@ static int ll_xattr_set_common(const struct xattr_handler *handler, if ((handler->flags == XATTR_ACL_ACCESS_T || handler->flags == XATTR_ACL_DEFAULT_T) && - !inode_owner_or_capable(mnt_userns, inode)) + !inode_owner_or_capable(map, inode)) RETURN(-EPERM); /* b10667: ignore lustre special xattr for now */ @@ -343,7 +343,7 @@ static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump, #endif static int ll_xattr_set(const struct xattr_handler *handler, - struct user_namespace *mnt_userns, + struct mnt_idmap *map, struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) @@ -382,7 +382,7 @@ static int ll_xattr_set(const struct xattr_handler *handler, return rc; } - return ll_xattr_set_common(handler, mnt_userns, dentry, inode, name, + return ll_xattr_set_common(handler, map, dentry, inode, name, value, size, flags); } diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 084ae82..de2426f 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -201,7 +201,7 @@ simple_mkdir(const struct lu_env *env, struct osd_device *osd, RETURN(dchild); } - err = vfs_mkdir(&init_user_ns, dir->d_inode, dchild, mode); + err = vfs_mkdir(&nop_mnt_idmap, dir->d_inode, dchild, mode); if (err) GOTO(out_err, err); @@ -1316,7 +1316,7 @@ int osd_obj_map_recover(struct osd_thread_info *info, /* If the src object has never been modified, then remove it. */ if (inode->i_size == 0 && inode->i_mode & S_ISUID && inode->i_mode & S_ISGID) { - rc = vfs_unlink(&init_user_ns, src_parent, src_child); + rc = vfs_unlink(&nop_mnt_idmap, src_parent, src_child); if (unlikely(rc == -ENOENT)) rc = 0; } diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index 394027e..2210981 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -350,7 +350,7 @@ static int osd_remove_oi_one(struct osd_device *osd, struct dentry *parent, if (IS_ERR(child)) { rc = PTR_ERR(child); } else { - rc = vfs_unlink(&init_user_ns, parent->d_inode, child); + rc = vfs_unlink(&nop_mnt_idmap, parent->d_inode, child); dput(child); } -- 1.8.3.1