fs: port ->symlink() to pass mnt_idmap
authorChristian Brauner <brauner@kernel.org>
Fri, 13 Jan 2023 11:49:14 +0000 (12:49 +0100)
committerChristian Brauner (Microsoft) <brauner@kernel.org>
Thu, 19 Jan 2023 08:24:25 +0000 (09:24 +0100)
Convert to struct mnt_idmap.

Last cycle we merged the necessary infrastructure in
256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
This is just the conversion to struct mnt_idmap.

Currently we still pass around the plain namespace that was attached to a
mount. This is in general pretty convenient but it makes it easy to
conflate namespaces that are relevant on the filesystem with namespaces
that are relevent on the mount level. Especially for non-vfs developers
without detailed knowledge in this area this can be a potential source for
bugs.

Once the conversion to struct mnt_idmap is done all helpers down to the
really low-level helpers will take a struct mnt_idmap argument instead of
two namespace arguments. This way it becomes impossible to conflate the two
eliminating the possibility of any bugs. All of the vfs and all filesystems
only operate on struct mnt_idmap.

Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
48 files changed:
Documentation/filesystems/locking.rst
Documentation/filesystems/vfs.rst
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/affs/affs.h
fs/affs/namei.c
fs/afs/dir.c
fs/autofs/root.c
fs/bad_inode.c
fs/btrfs/inode.c
fs/ceph/dir.c
fs/cifs/cifsfs.h
fs/cifs/link.c
fs/coda/dir.c
fs/configfs/configfs_internal.h
fs/configfs/symlink.c
fs/ecryptfs/inode.c
fs/ext2/namei.c
fs/ext4/namei.c
fs/f2fs/namei.c
fs/fuse/dir.c
fs/gfs2/inode.c
fs/hfsplus/dir.c
fs/hostfs/hostfs_kern.c
fs/hpfs/namei.c
fs/hugetlbfs/inode.c
fs/jffs2/dir.c
fs/jfs/namei.c
fs/minix/namei.c
fs/namei.c
fs/nfs/dir.c
fs/nfs/internal.h
fs/nilfs2/namei.c
fs/ntfs3/namei.c
fs/ocfs2/namei.c
fs/orangefs/namei.c
fs/overlayfs/dir.c
fs/ramfs/inode.c
fs/reiserfs/namei.c
fs/sysv/namei.c
fs/ubifs/dir.c
fs/udf/namei.c
fs/ufs/namei.c
fs/vboxsf/dir.c
fs/xfs/xfs_iops.c
include/linux/fs.h
kernel/bpf/inode.c
mm/shmem.c

index 77830854ec677d1c4127ee65d32c97d9884ca810..2e656b651574ce247e160262b031e199d0074466 100644 (file)
@@ -60,7 +60,7 @@ prototypes::
        struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
        int (*link) (struct dentry *,struct inode *,struct dentry *);
        int (*unlink) (struct inode *,struct dentry *);
-       int (*symlink) (struct inode *,struct dentry *,const char *);
+       int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
        int (*mkdir) (struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
index 6cf8d7d239b0b131983fe511934aae9598beecff..5a1195cf34ba1c85abece3064e0484454de5bf9e 100644 (file)
@@ -425,7 +425,7 @@ As of kernel 2.6.22, the following members are defined:
                struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
                int (*link) (struct dentry *,struct inode *,struct dentry *);
                int (*unlink) (struct inode *,struct dentry *);
-               int (*symlink) (struct user_namespace *, struct inode *,struct dentry *,const char *);
+               int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
                int (*mkdir) (struct user_namespace *, struct inode *,struct dentry *,umode_t);
                int (*rmdir) (struct inode *,struct dentry *);
                int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
index 693afb66c0c16def8272837d69541e836214af2b..401c0b63d5bbdfb10ca1dc4d6597f0cf54144fdb 100644 (file)
@@ -1300,7 +1300,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 
 /**
  * v9fs_vfs_symlink - helper function to create symlinks
- * @mnt_userns: The user namespace of the mount
+ * @idmap: idmap of the mount
  * @dir: directory inode containing symlink
  * @dentry: dentry for symlink
  * @symname: symlink data
@@ -1310,7 +1310,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
  */
 
 static int
-v9fs_vfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+v9fs_vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                 struct dentry *dentry, const char *symname)
 {
        p9_debug(P9_DEBUG_VFS, " %lu,%pd,%s\n",
index 6f651d5757a5364b37c558585ddc58be9868876a..d3245221ddd4a83b963e367c31d55d13ec34e615 100644 (file)
@@ -688,7 +688,7 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
 }
 
 static int
-v9fs_vfs_symlink_dotl(struct user_namespace *mnt_userns, struct inode *dir,
+v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir,
                      struct dentry *dentry, const char *symname)
 {
        int err;
index 31a56a461c9f13ef967701e3ac3f719187c99ffa..f9f986a2c5098806ac79b6d43f865d49b47f9523 100644 (file)
@@ -174,7 +174,7 @@ extern int  affs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
 extern int     affs_rmdir(struct inode *dir, struct dentry *dentry);
 extern int     affs_link(struct dentry *olddentry, struct inode *dir,
                          struct dentry *dentry);
-extern int     affs_symlink(struct user_namespace *mnt_userns,
+extern int     affs_symlink(struct mnt_idmap *idmap,
                        struct inode *dir, struct dentry *dentry,
                        const char *symname);
 extern int     affs_rename2(struct user_namespace *mnt_userns,
index 661852c95c5a267ed794801fe8ce6c36f64b7bf8..1d7f7232964d573e44eb5dd0ca621979e0b17b79 100644 (file)
@@ -313,7 +313,7 @@ affs_rmdir(struct inode *dir, struct dentry *dentry)
 }
 
 int
-affs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+affs_symlink(struct mnt_idmap *idmap, struct inode *dir,
             struct dentry *dentry, const char *symname)
 {
        struct super_block      *sb = dir->i_sb;
index a70495fd08866d73e4624fee37b9bd0751598e7f..a936aa8191b27e5a7d23054d574ebd064ef9b389 100644 (file)
@@ -36,7 +36,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry);
 static int afs_unlink(struct inode *dir, struct dentry *dentry);
 static int afs_link(struct dentry *from, struct inode *dir,
                    struct dentry *dentry);
-static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                       struct dentry *dentry, const char *content);
 static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
                      struct dentry *old_dentry, struct inode *new_dir,
@@ -1760,7 +1760,7 @@ static const struct afs_operation_ops afs_symlink_operation = {
 /*
  * create a symlink in an AFS filesystem
  */
-static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                       struct dentry *dentry, const char *content)
 {
        struct afs_operation *op;
index ca03c1cae2be174cc314d6135621c6d741383285..bf0029cef304de1487688e185e5762a2cc10fc7f 100644 (file)
@@ -11,7 +11,7 @@
 #include "autofs_i.h"
 
 static int autofs_dir_permission(struct user_namespace *, struct inode *, int);
-static int autofs_dir_symlink(struct user_namespace *, struct inode *,
+static int autofs_dir_symlink(struct mnt_idmap *, struct inode *,
                              struct dentry *, const char *);
 static int autofs_dir_unlink(struct inode *, struct dentry *);
 static int autofs_dir_rmdir(struct inode *, struct dentry *);
@@ -563,7 +563,7 @@ static int autofs_dir_permission(struct user_namespace *mnt_userns,
        return generic_permission(mnt_userns, inode, mask);
 }
 
-static int autofs_dir_symlink(struct user_namespace *mnt_userns,
+static int autofs_dir_symlink(struct mnt_idmap *idmap,
                              struct inode *dir, struct dentry *dentry,
                              const char *symname)
 {
index 8712fc1b3ff1019846c4d92d3ba1df0877300b1a..2d3ca4b5628f77fdde63483f3cc42b7cd6c484af 100644 (file)
@@ -51,7 +51,7 @@ static int bad_inode_unlink(struct inode *dir, struct dentry *dentry)
        return -EIO;
 }
 
-static int bad_inode_symlink(struct user_namespace *mnt_userns,
+static int bad_inode_symlink(struct mnt_idmap *idmap,
                             struct inode *dir, struct dentry *dentry,
                             const char *symname)
 {
index 3621e9a131d10108d8e501a4cde7c5d89b588274..f4879dd92035f7b53cd4f245bc0c8ac2ff17395d 100644 (file)
@@ -9758,9 +9758,10 @@ out:
        return ret;
 }
 
-static int btrfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
+       struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
        struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
        struct btrfs_trans_handle *trans;
        struct btrfs_root *root = BTRFS_I(dir)->root;
index cf4f70e558de17867895cac88b5f9deff215813a..114375efa2f78602aae892a4eb83f31694bfcc3e 100644 (file)
@@ -912,7 +912,7 @@ static int ceph_create(struct mnt_idmap *idmap, struct inode *dir,
        return ceph_mknod(mnt_userns, dir, dentry, mode, 0);
 }
 
-static int ceph_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *dest)
 {
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
index 0d4b3bfa1c3a62e29820587dcb79c07109cbe24d..52256b751c7524ce09d940eaecd3c772482a0e32 100644 (file)
@@ -124,7 +124,7 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
 /* Functions related to symlinks */
 extern const char *cifs_get_link(struct dentry *, struct inode *,
                        struct delayed_call *);
-extern int cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
+extern int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
                        struct dentry *direntry, const char *symname);
 
 #ifdef CONFIG_CIFS_XATTR
index bd374feeccaa19f021fdd03a4adf8d8e31f7d9fe..0ff9eab697a286c57bae57085fae07ca04aeafb9 100644 (file)
@@ -568,7 +568,7 @@ cifs_hl_exit:
 }
 
 int
-cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
+cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
             struct dentry *direntry, const char *symname)
 {
        int rc = -EOPNOTSUPP;
index 480bca167928f2fabb0d19d48938e38e98c987fb..b8e82bc0071f627c7f0d43f34964799567deebaa 100644 (file)
@@ -228,7 +228,7 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
 }
 
 
-static int coda_symlink(struct user_namespace *mnt_userns,
+static int coda_symlink(struct mnt_idmap *idmap,
                        struct inode *dir_inode, struct dentry *de,
                        const char *symname)
 {
index a94493ed3146f06cdd7ad1db8584bafabe5e950d..e710a1782382a204e7b5a46ffe448783eb61ecff 100644 (file)
@@ -91,7 +91,7 @@ extern const struct inode_operations configfs_root_inode_operations;
 extern const struct inode_operations configfs_symlink_inode_operations;
 extern const struct dentry_operations configfs_dentry_ops;
 
-extern int configfs_symlink(struct user_namespace *mnt_userns,
+extern int configfs_symlink(struct mnt_idmap *idmap,
                            struct inode *dir, struct dentry *dentry,
                            const char *symname);
 extern int configfs_unlink(struct inode *dir, struct dentry *dentry);
index 0623c3edcfb9dce41fcfc28e5ff733ec09b5404a..91db306dfeec8e8c0aa8dde96d9d7944099e4489 100644 (file)
@@ -137,7 +137,7 @@ static int get_target(const char *symname, struct path *path,
 }
 
 
-int configfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+int configfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                     struct dentry *dentry, const char *symname)
 {
        int ret;
index afc49ab46c5fb0097f690499294ac57ace1f61e3..692320ee079d60903d82a8a30e95479db520dd14 100644 (file)
@@ -456,7 +456,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
        return ecryptfs_do_unlink(dir, dentry, d_inode(dentry));
 }
 
-static int ecryptfs_symlink(struct user_namespace *mnt_userns,
+static int ecryptfs_symlink(struct mnt_idmap *idmap,
                            struct inode *dir, struct dentry *dentry,
                            const char *symname)
 {
index 1d4d807e09345cd6ea695d62ac9176bdaf3fc7a5..72d9a311100165cc103de6cc6b92ae82a166da1e 100644 (file)
@@ -154,7 +154,7 @@ static int ext2_mknod (struct user_namespace * mnt_userns, struct inode * dir,
        return err;
 }
 
-static int ext2_symlink (struct user_namespace * mnt_userns, struct inode * dir,
+static int ext2_symlink (struct mnt_idmap * idmap, struct inode * dir,
        struct dentry * dentry, const char * symname)
 {
        struct super_block * sb = dir->i_sb;
index 0bb43e4a28d57561f22ac2a5161dced40ae02bd3..11d9c1d1fc567f63d9735ee5814d1fde29dbccbc 100644 (file)
@@ -3340,9 +3340,10 @@ out:
        return err;
 }
 
-static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symname)
 {
+       struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
        handle_t *handle;
        struct inode *inode;
        int err, len = strlen(symname);
index aacf4e2764d2c40423255b1fbec80ee2224aaae9..5ef5ed50ce8023868845a2d7692eff027bbcbc24 100644 (file)
@@ -660,9 +660,10 @@ static const char *f2fs_get_link(struct dentry *dentry,
        return link;
 }
 
-static int f2fs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int f2fs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symname)
 {
+       struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
        struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
        struct inode *inode;
        size_t len = strlen(symname);
index b748246862290527d9e7ab1467f7f22663ed405d..179d8a33e13e4972502fe3192104d7b5b12cd9d9 100644 (file)
@@ -841,7 +841,7 @@ static int fuse_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
        return create_new_entry(fm, &args, dir, entry, S_IFDIR);
 }
 
-static int fuse_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *entry, const char *link)
 {
        struct fuse_mount *fm = get_fuse_mount(dir);
index f58b13a2d8958f1512862d3d91984292baee7c70..830049759b07814df94709629d22b7f772b4d760 100644 (file)
@@ -1207,7 +1207,7 @@ out_inodes:
 
 /**
  * gfs2_symlink - Create a symlink
- * @mnt_userns: User namespace of the mount the inode was found from
+ * @idmap: idmap of the mount the inode was found from
  * @dir: The directory to create the symlink in
  * @dentry: The dentry to put the symlink in
  * @symname: The thing which the link points to
@@ -1215,7 +1215,7 @@ out_inodes:
  * Returns: errno
  */
 
-static int gfs2_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int gfs2_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symname)
 {
        unsigned int size;
index 2ce051fb2d14cd1bf22f4ef2064ddb9ad67a9418..36927ca6b1f583841a16b1b3e4374d565156bc68 100644 (file)
@@ -434,7 +434,7 @@ out:
        return res;
 }
 
-static int hfsplus_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int hfsplus_symlink(struct mnt_idmap *idmap, struct inode *dir,
                           struct dentry *dentry, const char *symname)
 {
        struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
index d6174206a12320e544e93b8f488268ec9308fbe4..e78f53e60dcd375a4d1f6484aee6622ac59940d4 100644 (file)
@@ -658,7 +658,7 @@ static int hostfs_unlink(struct inode *ino, struct dentry *dentry)
        return err;
 }
 
-static int hostfs_symlink(struct user_namespace *mnt_userns, struct inode *ino,
+static int hostfs_symlink(struct mnt_idmap *idmap, struct inode *ino,
                          struct dentry *dentry, const char *to)
 {
        char *file;
index f6cbd4a4b94dc216c1f08846c44883942492b8ed..c5f0aec11457c71ab1f38050381ea03417d9e729 100644 (file)
@@ -292,7 +292,7 @@ bail:
        return err;
 }
 
-static int hpfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symlink)
 {
        const unsigned char *name = dentry->d_name.name;
index 7ffcf4b18685b2dee838990b950ed1b5f96918d0..170c99cb3095d2e562b38e167c5795c617b1da59 100644 (file)
@@ -1064,7 +1064,7 @@ static int hugetlbfs_tmpfile(struct user_namespace *mnt_userns,
        return finish_open_simple(file, 0);
 }
 
-static int hugetlbfs_symlink(struct user_namespace *mnt_userns,
+static int hugetlbfs_symlink(struct mnt_idmap *idmap,
                             struct inode *dir, struct dentry *dentry,
                             const char *symname)
 {
index 7494563f04fa72f6e812fafe1d45e6d45147938b..51433fef9d2b49380527d0cac1f0198298a8d000 100644 (file)
@@ -30,7 +30,7 @@ static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
                                    unsigned int);
 static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
 static int jffs2_unlink (struct inode *,struct dentry *);
-static int jffs2_symlink (struct user_namespace *, struct inode *,
+static int jffs2_symlink (struct mnt_idmap *, struct inode *,
                          struct dentry *, const char *);
 static int jffs2_mkdir (struct user_namespace *, struct inode *,struct dentry *,
                        umode_t);
@@ -279,7 +279,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
 
 /***********************************************************************/
 
-static int jffs2_symlink (struct user_namespace *mnt_userns, struct inode *dir_i,
+static int jffs2_symlink (struct mnt_idmap *idmap, struct inode *dir_i,
                          struct dentry *dentry, const char *target)
 {
        struct jffs2_inode_info *f, *dir_f;
index 9d06479e549e018120500886bde7dcf9a147a059..e7d65581db75888ec25287462c87f0f23f128728 100644 (file)
@@ -869,7 +869,7 @@ static int jfs_link(struct dentry *old_dentry,
  * an intermediate result whose length exceeds PATH_MAX [XPG4.2]
 */
 
-static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,
+static int jfs_symlink(struct mnt_idmap *idmap, struct inode *dip,
                       struct dentry *dentry, const char *name)
 {
        int rc;
index b8621cf9c933038af061b7c0cda41539c91f2831..0a07410a1a27855a12b64b940544f672ac768c2c 100644 (file)
@@ -71,7 +71,7 @@ static int minix_create(struct mnt_idmap *idmap, struct inode *dir,
        return minix_mknod(&init_user_ns, dir, dentry, mode, 0);
 }
 
-static int minix_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int minix_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
        int err = -ENAMETOOLONG;
index f356719c24136a13e6c3b68c822ff7e1e8085ef1..24ad4a8963df1c07741dd1b7c03815093eee94ee 100644 (file)
@@ -4394,8 +4394,9 @@ int vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                struct dentry *dentry, const char *oldname)
 {
        struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
-       int error = may_create(mnt_userns, dir, dentry);
+       int error;
 
+       error = may_create(mnt_userns, dir, dentry);
        if (error)
                return error;
 
@@ -4406,7 +4407,7 @@ int vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
        if (error)
                return error;
 
-       error = dir->i_op->symlink(mnt_userns, dir, dentry, oldname);
+       error = dir->i_op->symlink(idmap, dir, dentry, oldname);
        if (!error)
                fsnotify_create(dir, dentry);
        return error;
index a54337c181fee282729d725e0fcd41ba7f993d4f..5ae3ed47c3884f55ffa8c0a54abd20ec7ffbf706 100644 (file)
@@ -2524,7 +2524,7 @@ EXPORT_SYMBOL_GPL(nfs_unlink);
  * now have a new file handle and can instantiate an in-core NFS inode
  * and move the raw page into its mapping.
  */
-int nfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+int nfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                struct dentry *dentry, const char *symname)
 {
        struct page *page;
index 988a1553286f33a5483d44191ae596b9aac82893..33ec2c2a52de9dda65d3cd2d6292ed5a5649cbe7 100644 (file)
@@ -390,7 +390,7 @@ int nfs_mkdir(struct user_namespace *, struct inode *, struct dentry *,
              umode_t);
 int nfs_rmdir(struct inode *, struct dentry *);
 int nfs_unlink(struct inode *, struct dentry *);
-int nfs_symlink(struct user_namespace *, struct inode *, struct dentry *,
+int nfs_symlink(struct mnt_idmap *, struct inode *, struct dentry *,
                const char *);
 int nfs_link(struct dentry *, struct inode *, struct dentry *);
 int nfs_mknod(struct user_namespace *, struct inode *, struct dentry *, umode_t,
index 4be5d9d340032ab97366ba41a1136e70a9eae269..d6cd71bb91e00392a1b25082d459e86f78c6e5b2 100644 (file)
@@ -125,7 +125,7 @@ nilfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
        return err;
 }
 
-static int nilfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int nilfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
        struct nilfs_transaction_info ti;
index 8e46372a7ab71a2fd9fe28cd8db755de8f0513ac..be6a00a070043c557f42f4cfd3b406ad5c934cf8 100644 (file)
@@ -184,9 +184,10 @@ static int ntfs_unlink(struct inode *dir, struct dentry *dentry)
 /*
  * ntfs_symlink - inode_operations::symlink
  */
-static int ntfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ntfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symname)
 {
+       struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
        u32 size = strlen(symname);
        struct inode *inode;
 
index c931ddb41e94ac7322b1d0a7304708075693d6a8..dedb37a88345b32a324f972e9a193abea45f1305 100644 (file)
@@ -1784,7 +1784,7 @@ bail:
        return status;
 }
 
-static int ocfs2_symlink(struct user_namespace *mnt_userns,
+static int ocfs2_symlink(struct mnt_idmap *idmap,
                         struct inode *dir,
                         struct dentry *dentry,
                         const char *symname)
index a47e73f564e4ce904a884a1e6c5c24dc46f58259..59866be483299520579178d00ce917081fea4e07 100644 (file)
@@ -216,7 +216,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
        return ret;
 }
 
-static int orangefs_symlink(struct user_namespace *mnt_userns,
+static int orangefs_symlink(struct mnt_idmap *idmap,
                         struct inode *dir,
                         struct dentry *dentry,
                         const char *symname)
index fc372658672219c0f0237f9e7840b196c68590cd..272906ec95122bfb5a85c8910286ee54afdac554 100644 (file)
@@ -677,7 +677,7 @@ static int ovl_mknod(struct user_namespace *mnt_userns, struct inode *dir,
        return ovl_create_object(dentry, mode, rdev, NULL);
 }
 
-static int ovl_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ovl_symlink(struct mnt_idmap *idmap, struct inode *dir,
                       struct dentry *dentry, const char *link)
 {
        return ovl_create_object(dentry, S_IFLNK, 0, link);
index 77fd43f847abdcc3c5b1ff573a5a9442e230780e..f97b8856cebf9eb5f554da18ae95458571e7c5e5 100644 (file)
@@ -125,7 +125,7 @@ static int ramfs_create(struct mnt_idmap *idmap, struct inode *dir,
        return ramfs_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
 }
 
-static int ramfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ramfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
        struct inode *inode;
index c1b91a9656403812a2caa76df2ee03c47640f125..062e05f1b96136a4e6c06408e5187be12ad7095d 100644 (file)
@@ -1099,7 +1099,7 @@ out_unlink:
        return retval;
 }
 
-static int reiserfs_symlink(struct user_namespace *mnt_userns,
+static int reiserfs_symlink(struct mnt_idmap *idmap,
                            struct inode *parent_dir, struct dentry *dentry,
                            const char *symname)
 {
index f862fb8584c0117046cb75b3d59a3412bbc51fcf..c277c0a8f6b24710456fea8b8ac24d5cb63e4a94 100644 (file)
@@ -67,7 +67,7 @@ static int sysv_create(struct mnt_idmap *idmap, struct inode *dir,
        return sysv_mknod(&init_user_ns, dir, dentry, mode, 0);
 }
 
-static int sysv_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int sysv_symlink(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, const char *symname)
 {
        int err = -ENAMETOOLONG;
index 43a1d9c0e9e03b124d65b48200fd71eb0a803de7..325c5693fb5f4542d155841fea1aced3b5eb4003 100644 (file)
@@ -1141,7 +1141,7 @@ out_budg:
        return err;
 }
 
-static int ubifs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int ubifs_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
        struct inode *inode;
index 91921a3838fa51a449e6021b5ac58474c059e35a..f2c3ee7ebe1b393ec1a416dc408e899add7d9328 100644 (file)
@@ -881,7 +881,7 @@ out:
        return retval;
 }
 
-static int udf_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int udf_symlink(struct mnt_idmap *idmap, struct inode *dir,
                       struct dentry *dentry, const char *symname)
 {
        struct inode *inode = udf_new_inode(dir, S_IFLNK | 0777);
index 6904ce95a143374ceb2cae506dd36e6644504d0c..cb3d9bee6626ae5185ed640558b1b45c79d92605 100644 (file)
@@ -106,7 +106,7 @@ static int ufs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
        return err;
 }
 
-static int ufs_symlink (struct user_namespace * mnt_userns, struct inode * dir,
+static int ufs_symlink (struct mnt_idmap * idmap, struct inode * dir,
        struct dentry * dentry, const char * symname)
 {
        struct super_block * sb = dir->i_sb;
index 0a9e76c87066e3585785d1c7975dd309816d6ff7..95d54cb5221d3987366f8c6c8e815743a64aae19 100644 (file)
@@ -430,7 +430,7 @@ err_put_old_path:
        return err;
 }
 
-static int vboxsf_dir_symlink(struct user_namespace *mnt_userns,
+static int vboxsf_dir_symlink(struct mnt_idmap *idmap,
                              struct inode *parent, struct dentry *dentry,
                              const char *symname)
 {
index 969074864328c3f76264cbde3ca03562f4b03b1a..4f9fcd0cf8ba3329da5ea44215dbd41c52b0a27e 100644 (file)
@@ -401,11 +401,12 @@ xfs_vn_unlink(
 
 STATIC int
 xfs_vn_symlink(
-       struct user_namespace   *mnt_userns,
+       struct mnt_idmap        *idmap,
        struct inode            *dir,
        struct dentry           *dentry,
        const char              *symname)
 {
+       struct user_namespace   *mnt_userns = mnt_idmap_owner(idmap);
        struct inode    *inode;
        struct xfs_inode *cip = NULL;
        struct xfs_name name;
index fddfacf2583ad4f4607b794ff5cd6998c8c7940c..4bde68e15d5c7b170b853950dcce91ae76b69b80 100644 (file)
@@ -2143,7 +2143,7 @@ struct inode_operations {
                       umode_t, bool);
        int (*link) (struct dentry *,struct inode *,struct dentry *);
        int (*unlink) (struct inode *,struct dentry *);
-       int (*symlink) (struct user_namespace *, struct inode *,struct dentry *,
+       int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,
                        const char *);
        int (*mkdir) (struct user_namespace *, struct inode *,struct dentry *,
                      umode_t);
index 4f841e16779e7791f7655a73cf3fcb33a9baa23d..32c8f695e0b5581af41e336698aba3b511fc2a19 100644 (file)
@@ -382,7 +382,7 @@ bpf_lookup(struct inode *dir, struct dentry *dentry, unsigned flags)
        return simple_lookup(dir, dentry, flags);
 }
 
-static int bpf_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int bpf_symlink(struct mnt_idmap *idmap, struct inode *dir,
                       struct dentry *dentry, const char *target)
 {
        char *link = kstrdup(target, GFP_USER | __GFP_NOWARN);
index 8c2969494bc598e56024492bac17a19861ec2886..38b973f116d806dccf183a4a97b742b2e9f7cbeb 100644 (file)
@@ -3124,7 +3124,7 @@ static int shmem_rename2(struct user_namespace *mnt_userns,
        return 0;
 }
 
-static int shmem_symlink(struct user_namespace *mnt_userns, struct inode *dir,
+static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
                         struct dentry *dentry, const char *symname)
 {
        int error;