mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
fs: port ->mknod() to pass mnt_idmap
Convert to struct mnt_idmap.
Last cycle we merged the necessary infrastructure in
256c8aed2b
("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>
This commit is contained in:
parent
c54bd91e9e
commit
5ebb29bee8
@ -63,7 +63,7 @@ prototypes::
|
||||
int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
|
||||
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
|
||||
int (*rmdir) (struct inode *,struct dentry *);
|
||||
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*rename) (struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
|
@ -428,7 +428,7 @@ As of kernel 2.6.22, the following members are defined:
|
||||
int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
|
||||
int (*mkdir) (struct mnt_idmap *, 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);
|
||||
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
|
@ -1356,7 +1356,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
|
||||
/**
|
||||
* v9fs_vfs_mknod - create a special file
|
||||
* @mnt_userns: The user namespace of the mount
|
||||
* @idmap: idmap of the mount
|
||||
* @dir: inode destination for new link
|
||||
* @dentry: dentry for file
|
||||
* @mode: mode for creation
|
||||
@ -1365,7 +1365,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
*/
|
||||
|
||||
static int
|
||||
v9fs_vfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
v9fs_vfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "acl.h"
|
||||
|
||||
static int
|
||||
v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode, dev_t rdev);
|
||||
|
||||
/**
|
||||
@ -222,8 +222,7 @@ static int
|
||||
v9fs_vfs_create_dotl(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode, bool excl)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
return v9fs_vfs_mknod_dotl(mnt_userns, dir, dentry, omode, 0);
|
||||
return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -818,7 +817,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
|
||||
|
||||
/**
|
||||
* v9fs_vfs_mknod_dotl - create a special file
|
||||
* @mnt_userns: The user namespace of the mount
|
||||
* @idmap: The idmap of the mount
|
||||
* @dir: inode destination for new link
|
||||
* @dentry: dentry for file
|
||||
* @omode: mode for creation
|
||||
@ -826,7 +825,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
|
||||
*
|
||||
*/
|
||||
static int
|
||||
v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode, dev_t rdev)
|
||||
{
|
||||
int err;
|
||||
|
@ -69,7 +69,7 @@ static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int bad_inode_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
return -EIO;
|
||||
|
@ -6725,9 +6725,10 @@ out_inode:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int btrfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int btrfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
struct inode *inode;
|
||||
|
||||
inode = new_inode(dir->i_sb);
|
||||
|
@ -845,7 +845,7 @@ int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry)
|
||||
return PTR_ERR(result);
|
||||
}
|
||||
|
||||
static int ceph_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
|
||||
@ -908,8 +908,7 @@ out:
|
||||
static int ceph_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
return ceph_mknod(mnt_userns, dir, dentry, mode, 0);
|
||||
return ceph_mknod(idmap, dir, dentry, mode, 0);
|
||||
}
|
||||
|
||||
static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
@ -57,7 +57,7 @@ extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
|
||||
unsigned int);
|
||||
extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
|
||||
extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
|
||||
extern int cifs_mknod(struct user_namespace *, struct inode *, struct dentry *,
|
||||
extern int cifs_mknod(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||
umode_t, dev_t);
|
||||
extern int cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||
umode_t);
|
||||
|
@ -579,7 +579,7 @@ out_free_xid:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cifs_mknod(struct user_namespace *mnt_userns, struct inode *inode,
|
||||
int cifs_mknod(struct mnt_idmap *idmap, struct inode *inode,
|
||||
struct dentry *direntry, umode_t mode, dev_t device_number)
|
||||
{
|
||||
int rc = -EPERM;
|
||||
|
@ -548,7 +548,7 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
}
|
||||
|
||||
static int
|
||||
ecryptfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
ecryptfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
int rc;
|
||||
|
@ -133,7 +133,7 @@ static int ext2_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
return finish_open_simple(file, 0);
|
||||
}
|
||||
|
||||
static int ext2_mknod (struct user_namespace * mnt_userns, struct inode * dir,
|
||||
static int ext2_mknod (struct mnt_idmap * idmap, struct inode * dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode * inode;
|
||||
|
@ -2828,9 +2828,10 @@ retry:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ext4_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ext4_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
handle_t *handle;
|
||||
struct inode *inode;
|
||||
int err, credits, retries = 0;
|
||||
|
@ -797,9 +797,10 @@ static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
return -ENOTEMPTY;
|
||||
}
|
||||
|
||||
static int f2fs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int f2fs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
|
||||
struct inode *inode;
|
||||
int err = 0;
|
||||
|
@ -645,7 +645,7 @@ out_err:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int fuse_mknod(struct user_namespace *, struct inode *, struct dentry *,
|
||||
static int fuse_mknod(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||
umode_t, dev_t);
|
||||
static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
|
||||
struct file *file, unsigned flags,
|
||||
@ -686,7 +686,7 @@ out_dput:
|
||||
return err;
|
||||
|
||||
mknod:
|
||||
err = fuse_mknod(&init_user_ns, dir, entry, mode, 0);
|
||||
err = fuse_mknod(&nop_mnt_idmap, dir, entry, mode, 0);
|
||||
if (err)
|
||||
goto out_dput;
|
||||
no_open:
|
||||
@ -773,7 +773,7 @@ static int create_new_entry(struct fuse_mount *fm, struct fuse_args *args,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int fuse_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int fuse_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *entry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct fuse_mknod_in inarg;
|
||||
@ -799,7 +799,7 @@ static int fuse_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int fuse_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *entry, umode_t mode, bool excl)
|
||||
{
|
||||
return fuse_mknod(&init_user_ns, dir, entry, mode, 0);
|
||||
return fuse_mknod(&nop_mnt_idmap, dir, entry, mode, 0);
|
||||
}
|
||||
|
||||
static int fuse_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
|
@ -1246,7 +1246,7 @@ static int gfs2_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
||||
/**
|
||||
* gfs2_mknod - Make a special file
|
||||
* @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 in which the special file will reside
|
||||
* @dentry: The dentry of the special file
|
||||
* @mode: The mode of the special file
|
||||
@ -1254,7 +1254,7 @@ static int gfs2_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
*
|
||||
*/
|
||||
|
||||
static int gfs2_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int gfs2_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0);
|
||||
|
@ -476,7 +476,7 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
static int hfsplus_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int hfsplus_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
|
||||
@ -520,13 +520,13 @@ out:
|
||||
static int hfsplus_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
return hfsplus_mknod(&init_user_ns, dir, dentry, mode, 0);
|
||||
return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
|
||||
}
|
||||
|
||||
static int hfsplus_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
return hfsplus_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
|
||||
return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
|
||||
}
|
||||
|
||||
static int hfsplus_rename(struct user_namespace *mnt_userns,
|
||||
|
@ -696,7 +696,7 @@ static int hostfs_rmdir(struct inode *ino, struct dentry *dentry)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int hostfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int hostfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
@ -217,7 +217,7 @@ bail:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int hpfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
const unsigned char *name = dentry->d_name.name;
|
||||
|
@ -1019,7 +1019,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
|
||||
/*
|
||||
* File creation. Allocate an inode, and we're done..
|
||||
*/
|
||||
static int hugetlbfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
struct inode *inode;
|
||||
@ -1036,7 +1036,7 @@ static int hugetlbfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
int retval = hugetlbfs_mknod(&init_user_ns, dir, dentry,
|
||||
int retval = hugetlbfs_mknod(&nop_mnt_idmap, dir, dentry,
|
||||
mode | S_IFDIR, 0);
|
||||
if (!retval)
|
||||
inc_nlink(dir);
|
||||
@ -1047,7 +1047,7 @@ static int hugetlbfs_create(struct mnt_idmap *idmap,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode, bool excl)
|
||||
{
|
||||
return hugetlbfs_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
|
||||
return hugetlbfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0);
|
||||
}
|
||||
|
||||
static int hugetlbfs_tmpfile(struct user_namespace *mnt_userns,
|
||||
|
@ -35,7 +35,7 @@ static int jffs2_symlink (struct mnt_idmap *, struct inode *,
|
||||
static int jffs2_mkdir (struct mnt_idmap *, struct inode *,struct dentry *,
|
||||
umode_t);
|
||||
static int jffs2_rmdir (struct inode *,struct dentry *);
|
||||
static int jffs2_mknod (struct user_namespace *, struct inode *,struct dentry *,
|
||||
static int jffs2_mknod (struct mnt_idmap *, struct inode *,struct dentry *,
|
||||
umode_t,dev_t);
|
||||
static int jffs2_rename (struct user_namespace *, struct inode *,
|
||||
struct dentry *, struct inode *, struct dentry *,
|
||||
@ -614,7 +614,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int jffs2_mknod (struct user_namespace *mnt_userns, struct inode *dir_i,
|
||||
static int jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct jffs2_inode_info *f, *dir_f;
|
||||
|
@ -1345,7 +1345,7 @@ static int jfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
*
|
||||
* FUNCTION: Create a special file (device)
|
||||
*/
|
||||
static int jfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int jfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct jfs_inode_info *jfs_ip;
|
||||
|
@ -33,7 +33,7 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, un
|
||||
return d_splice_alias(inode, dentry);
|
||||
}
|
||||
|
||||
static int minix_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int minix_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
int error;
|
||||
@ -68,7 +68,7 @@ static int minix_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int minix_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
return minix_mknod(&init_user_ns, dir, dentry, mode, 0);
|
||||
return minix_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
|
||||
}
|
||||
|
||||
static int minix_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
@ -3919,7 +3919,7 @@ int vfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = dir->i_op->mknod(mnt_userns, dir, dentry, mode, dev);
|
||||
error = dir->i_op->mknod(idmap, dir, dentry, mode, dev);
|
||||
if (!error)
|
||||
fsnotify_create(dir, dentry);
|
||||
return error;
|
||||
|
@ -2325,7 +2325,7 @@ EXPORT_SYMBOL_GPL(nfs_create);
|
||||
* See comments for nfs_proc_create regarding failed operations.
|
||||
*/
|
||||
int
|
||||
nfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
nfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct iattr attr;
|
||||
|
@ -393,7 +393,7 @@ int nfs_unlink(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,
|
||||
int nfs_mknod(struct mnt_idmap *, struct inode *, struct dentry *, umode_t,
|
||||
dev_t);
|
||||
int nfs_rename(struct user_namespace *, struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
|
@ -100,7 +100,7 @@ static int nilfs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
}
|
||||
|
||||
static int
|
||||
nilfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
nilfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
@ -111,9 +111,10 @@ static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
*
|
||||
* inode_operations::mknod
|
||||
*/
|
||||
static int ntfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ntfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||
struct inode *inode;
|
||||
|
||||
inode = ntfs_create_inode(mnt_userns, dir, dentry, NULL, mode, rdev,
|
||||
|
@ -221,7 +221,7 @@ static void ocfs2_cleanup_add_entry_failure(struct ocfs2_super *osb,
|
||||
iput(inode);
|
||||
}
|
||||
|
||||
static int ocfs2_mknod(struct user_namespace *mnt_userns,
|
||||
static int ocfs2_mknod(struct mnt_idmap *idmap,
|
||||
struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
umode_t mode,
|
||||
@ -651,7 +651,7 @@ static int ocfs2_mkdir(struct mnt_idmap *idmap,
|
||||
|
||||
trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name,
|
||||
OCFS2_I(dir)->ip_blkno, mode);
|
||||
ret = ocfs2_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
|
||||
ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
|
||||
if (ret)
|
||||
mlog_errno(ret);
|
||||
|
||||
@ -668,7 +668,7 @@ static int ocfs2_create(struct mnt_idmap *idmap,
|
||||
|
||||
trace_ocfs2_create(dir, dentry, dentry->d_name.len, dentry->d_name.name,
|
||||
(unsigned long long)OCFS2_I(dir)->ip_blkno, mode);
|
||||
ret = ocfs2_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
|
||||
ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0);
|
||||
if (ret)
|
||||
mlog_errno(ret);
|
||||
|
||||
|
@ -667,7 +667,7 @@ static int ovl_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL);
|
||||
}
|
||||
|
||||
static int ovl_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ovl_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
/* Don't allow creation of "whiteout" on overlay */
|
||||
|
@ -95,7 +95,7 @@ struct inode *ramfs_get_inode(struct super_block *sb,
|
||||
*/
|
||||
/* SMP-safe */
|
||||
static int
|
||||
ramfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
ramfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
|
||||
@ -113,7 +113,7 @@ ramfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
int retval = ramfs_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
|
||||
int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
|
||||
if (!retval)
|
||||
inc_nlink(dir);
|
||||
return retval;
|
||||
@ -122,7 +122,7 @@ static int ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
static int ramfs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
return ramfs_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
|
||||
return ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0);
|
||||
}
|
||||
|
||||
static int ramfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
@ -700,7 +700,7 @@ out_failed:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int reiserfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int reiserfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
int retval;
|
||||
|
@ -41,7 +41,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, un
|
||||
return d_splice_alias(inode, dentry);
|
||||
}
|
||||
|
||||
static int sysv_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int sysv_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode * inode;
|
||||
@ -64,7 +64,7 @@ static int sysv_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int sysv_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
return sysv_mknod(&init_user_ns, dir, dentry, mode, 0);
|
||||
return sysv_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
|
||||
}
|
||||
|
||||
static int sysv_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
|
@ -1052,7 +1052,7 @@ out_budg:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ubifs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ubifs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
@ -645,7 +645,7 @@ static int udf_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
return finish_open_simple(file, 0);
|
||||
}
|
||||
|
||||
static int udf_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int udf_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
@ -86,7 +86,7 @@ static int ufs_create (struct mnt_idmap * idmap,
|
||||
return ufs_add_nondir(dentry, inode);
|
||||
}
|
||||
|
||||
static int ufs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
static int ufs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
@ -255,13 +255,14 @@ xfs_generic_create(
|
||||
|
||||
STATIC int
|
||||
xfs_vn_mknod(
|
||||
struct user_namespace *mnt_userns,
|
||||
struct mnt_idmap *idmap,
|
||||
struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
umode_t mode,
|
||||
dev_t rdev)
|
||||
{
|
||||
return xfs_generic_create(mnt_userns, dir, dentry, mode, rdev, NULL);
|
||||
return xfs_generic_create(mnt_idmap_owner(idmap), dir, dentry, mode,
|
||||
rdev, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
|
@ -2148,7 +2148,7 @@ struct inode_operations {
|
||||
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,
|
||||
umode_t);
|
||||
int (*rmdir) (struct inode *,struct dentry *);
|
||||
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,
|
||||
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,
|
||||
umode_t,dev_t);
|
||||
int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
|
@ -2915,7 +2915,7 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||
* File creation. Allocate an inode, and we're done..
|
||||
*/
|
||||
static int
|
||||
shmem_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
shmem_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t dev)
|
||||
{
|
||||
struct inode *inode;
|
||||
@ -2975,7 +2975,7 @@ static int shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((error = shmem_mknod(&init_user_ns, dir, dentry,
|
||||
if ((error = shmem_mknod(&nop_mnt_idmap, dir, dentry,
|
||||
mode | S_IFDIR, 0)))
|
||||
return error;
|
||||
inc_nlink(dir);
|
||||
@ -2985,7 +2985,7 @@ static int shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
static int shmem_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
return shmem_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
|
||||
return shmem_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3055,7 +3055,7 @@ static int shmem_whiteout(struct user_namespace *mnt_userns,
|
||||
if (!whiteout)
|
||||
return -ENOMEM;
|
||||
|
||||
error = shmem_mknod(&init_user_ns, old_dir, whiteout,
|
||||
error = shmem_mknod(&nop_mnt_idmap, old_dir, whiteout,
|
||||
S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV);
|
||||
dput(whiteout);
|
||||
if (error)
|
||||
|
Loading…
Reference in New Issue
Block a user