fs: port ->rename() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus
Conflicts: For consistency drop btrfs hunks because it isn't supported in
CentOS Stream and other backports also drop such hunks.
The cifs source has been moved in CentOS Stream so manually
apply rejected hunks to fs/smb/client/cifsfs.h and
fs/smb/client/inode.c.
Dropped hunks for ntfs3 because the source is not present in the
CentOS Stream source tree.
Upstream commit cc14d24026704 ("hpfs: Convert symlinks to
read_folio") is not present which causes fuzz 1 for hunk #1.
CentOS Stream commit 892da692fa
("shmem: support idmapped
mounts for tmpfs") is present, so a patch reorder was needed
with appropriate adjustments.
commit e18275ae55e07a2937e48134589c2f4c1d99a369
Author: Christian Brauner <brauner@kernel.org>
Date: Fri Jan 13 12:49:17 2023 +0100
fs: port ->rename() to pass mnt_idmap
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>
Signed-off-by: Ian Kent <ikent@redhat.com>
This commit is contained in:
parent
f400377b23
commit
19f3b4f1ba
|
@ -64,7 +64,7 @@ prototypes::
|
||||||
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
|
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
|
||||||
int (*rmdir) (struct inode *,struct dentry *);
|
int (*rmdir) (struct inode *,struct dentry *);
|
||||||
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
|
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
|
||||||
int (*rename) (struct inode *, struct dentry *,
|
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
struct inode *, struct dentry *, unsigned int);
|
struct inode *, struct dentry *, unsigned int);
|
||||||
int (*readlink) (struct dentry *, char __user *,int);
|
int (*readlink) (struct dentry *, char __user *,int);
|
||||||
const char *(*get_link) (struct dentry *, struct inode *, struct delayed_call *);
|
const char *(*get_link) (struct dentry *, struct inode *, struct delayed_call *);
|
||||||
|
|
|
@ -429,7 +429,7 @@ As of kernel 2.6.22, the following members are defined:
|
||||||
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
|
int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
|
||||||
int (*rmdir) (struct inode *,struct dentry *);
|
int (*rmdir) (struct inode *,struct dentry *);
|
||||||
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
|
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||||
int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
|
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
struct inode *, struct dentry *, unsigned int);
|
struct inode *, struct dentry *, unsigned int);
|
||||||
int (*readlink) (struct dentry *, char __user *,int);
|
int (*readlink) (struct dentry *, char __user *,int);
|
||||||
const char *(*get_link) (struct dentry *, struct inode *,
|
const char *(*get_link) (struct dentry *, struct inode *,
|
||||||
|
|
|
@ -355,7 +355,7 @@ static inline bool is_binderfs_control_device(const struct dentry *dentry)
|
||||||
return info->control_dentry == dentry;
|
return info->control_dentry == dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int binderfs_rename(struct user_namespace *mnt_userns,
|
static int binderfs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
@ -364,7 +364,7 @@ static int binderfs_rename(struct user_namespace *mnt_userns,
|
||||||
is_binderfs_control_device(new_dentry))
|
is_binderfs_control_device(new_dentry))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
return simple_rename(&init_user_ns, old_dir, old_dentry, new_dir,
|
return simple_rename(idmap, old_dir, old_dentry, new_dir,
|
||||||
new_dentry, flags);
|
new_dentry, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d);
|
extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d);
|
||||||
extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d);
|
extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d);
|
||||||
extern int v9fs_vfs_rename(struct user_namespace *mnt_userns,
|
extern int v9fs_vfs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
|
@ -921,7 +921,7 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* v9fs_vfs_rename - VFS hook to rename an inode
|
* v9fs_vfs_rename - VFS hook to rename an inode
|
||||||
* @mnt_userns: The user namespace of the mount
|
* @idmap: The idmap of the mount
|
||||||
* @old_dir: old dir inode
|
* @old_dir: old dir inode
|
||||||
* @old_dentry: old dentry
|
* @old_dentry: old dentry
|
||||||
* @new_dir: new dir inode
|
* @new_dir: new dir inode
|
||||||
|
@ -931,7 +931,7 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
v9fs_vfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
v9fs_vfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,7 +177,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
|
||||||
extern int affs_symlink(struct mnt_idmap *idmap,
|
extern int affs_symlink(struct mnt_idmap *idmap,
|
||||||
struct inode *dir, struct dentry *dentry,
|
struct inode *dir, struct dentry *dentry,
|
||||||
const char *symname);
|
const char *symname);
|
||||||
extern int affs_rename2(struct user_namespace *mnt_userns,
|
extern int affs_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
|
@ -503,7 +503,7 @@ done:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int affs_rename2(struct user_namespace *mnt_userns, struct inode *old_dir,
|
int affs_rename2(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
|
||||||
struct dentry *dentry);
|
struct dentry *dentry);
|
||||||
static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, const char *content);
|
struct dentry *dentry, const char *content);
|
||||||
static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags);
|
struct dentry *new_dentry, unsigned int flags);
|
||||||
static bool afs_dir_release_folio(struct folio *folio, gfp_t gfp_flags);
|
static bool afs_dir_release_folio(struct folio *folio, gfp_t gfp_flags);
|
||||||
|
@ -1921,7 +1921,7 @@ static const struct afs_operation_ops afs_rename_operation = {
|
||||||
/*
|
/*
|
||||||
* rename a file in an AFS filesystem and/or move it between directories
|
* rename a file in an AFS filesystem and/or move it between directories
|
||||||
*/
|
*/
|
||||||
static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ static int bad_inode_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bad_inode_rename2(struct user_namespace *mnt_userns,
|
static int bad_inode_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -199,7 +199,7 @@ out_brelse:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int bfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1380,7 +1380,7 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ceph_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int ceph_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,7 +295,7 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rename */
|
/* rename */
|
||||||
static int coda_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int coda_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -804,7 +804,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
|
||||||
|
|
||||||
take_dentry_name_snapshot(&old_name, old_dentry);
|
take_dentry_name_snapshot(&old_name, old_dentry);
|
||||||
|
|
||||||
error = simple_rename(&init_user_ns, d_inode(old_dir), old_dentry,
|
error = simple_rename(&nop_mnt_idmap, d_inode(old_dir), old_dentry,
|
||||||
d_inode(new_dir), dentry, 0);
|
d_inode(new_dir), dentry, 0);
|
||||||
if (error) {
|
if (error) {
|
||||||
release_dentry_name_snapshot(&old_name);
|
release_dentry_name_snapshot(&old_name);
|
||||||
|
|
|
@ -574,7 +574,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ecryptfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
ecryptfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1285,7 +1285,7 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exfat_rename(struct user_namespace *mnt_userns,
|
static int exfat_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -321,7 +321,7 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ext2_rename (struct user_namespace * mnt_userns,
|
static int ext2_rename (struct mnt_idmap * idmap,
|
||||||
struct inode * old_dir, struct dentry * old_dentry,
|
struct inode * old_dir, struct dentry * old_dentry,
|
||||||
struct inode * new_dir, struct dentry * new_dentry,
|
struct inode * new_dir, struct dentry * new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -4249,11 +4249,12 @@ end_rename:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ext4_rename2(struct user_namespace *mnt_userns,
|
static int ext4_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (unlikely(ext4_forced_shutdown(EXT4_SB(old_dir->i_sb))))
|
if (unlikely(ext4_forced_shutdown(EXT4_SB(old_dir->i_sb))))
|
||||||
|
|
|
@ -1284,11 +1284,12 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f2fs_rename2(struct user_namespace *mnt_userns,
|
static int f2fs_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
|
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
|
||||||
|
|
|
@ -594,7 +594,7 @@ error_inode:
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */
|
/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */
|
||||||
static int msdos_rename(struct user_namespace *mnt_userns,
|
static int msdos_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ error_exchange:
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vfat_rename2(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int vfat_rename2(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fuse_rename2(struct user_namespace *mnt_userns, struct inode *olddir,
|
static int fuse_rename2(struct mnt_idmap *idmap, struct inode *olddir,
|
||||||
struct dentry *oldent, struct inode *newdir,
|
struct dentry *oldent, struct inode *newdir,
|
||||||
struct dentry *newent, unsigned int flags)
|
struct dentry *newent, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1775,7 +1775,7 @@ out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gfs2_rename2(struct user_namespace *mnt_userns, struct inode *odir,
|
static int gfs2_rename2(struct mnt_idmap *idmap, struct inode *odir,
|
||||||
struct dentry *odentry, struct inode *ndir,
|
struct dentry *odentry, struct inode *ndir,
|
||||||
struct dentry *ndentry, unsigned int flags)
|
struct dentry *ndentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -280,7 +280,7 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
|
||||||
* new file/directory.
|
* new file/directory.
|
||||||
* XXX: how do you handle must_be dir?
|
* XXX: how do you handle must_be dir?
|
||||||
*/
|
*/
|
||||||
static int hfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -529,7 +529,7 @@ static int hfsplus_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
return hfsplus_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
|
return hfsplus_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hfsplus_rename(struct user_namespace *mnt_userns,
|
static int hfsplus_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -732,7 +732,7 @@ static int hostfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hostfs_rename2(struct user_namespace *mnt_userns,
|
static int hostfs_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -511,7 +511,7 @@ const struct address_space_operations hpfs_symlink_aops = {
|
||||||
.readpage = hpfs_symlink_readpage
|
.readpage = hpfs_symlink_readpage
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hpfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int hpfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ static int jffs2_mkdir (struct mnt_idmap *, struct inode *,struct dentry *,
|
||||||
static int jffs2_rmdir (struct inode *,struct dentry *);
|
static int jffs2_rmdir (struct inode *,struct dentry *);
|
||||||
static int jffs2_mknod (struct user_namespace *, struct inode *,struct dentry *,
|
static int jffs2_mknod (struct user_namespace *, struct inode *,struct dentry *,
|
||||||
umode_t,dev_t);
|
umode_t,dev_t);
|
||||||
static int jffs2_rename (struct user_namespace *, struct inode *,
|
static int jffs2_rename (struct mnt_idmap *, struct inode *,
|
||||||
struct dentry *, struct inode *, struct dentry *,
|
struct dentry *, struct inode *, struct dentry *,
|
||||||
unsigned int);
|
unsigned int);
|
||||||
|
|
||||||
|
@ -762,7 +762,7 @@ static int jffs2_mknod (struct user_namespace *mnt_userns, struct inode *dir_i,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jffs2_rename (struct user_namespace *mnt_userns,
|
static int jffs2_rename (struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir_i, struct dentry *old_dentry,
|
struct inode *old_dir_i, struct dentry *old_dentry,
|
||||||
struct inode *new_dir_i, struct dentry *new_dentry,
|
struct inode *new_dir_i, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ static int jfs_symlink(struct mnt_idmap *idmap, struct inode *dip,
|
||||||
*
|
*
|
||||||
* FUNCTION: rename a file or directory
|
* FUNCTION: rename a file or directory
|
||||||
*/
|
*/
|
||||||
static int jfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int jfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1236,7 +1236,7 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kernfs_iop_rename(struct user_namespace *mnt_userns,
|
static int kernfs_iop_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -470,7 +470,7 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(simple_rename_exchange);
|
EXPORT_SYMBOL_GPL(simple_rename_exchange);
|
||||||
|
|
||||||
int simple_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,7 +184,7 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int minix_rename(struct user_namespace *mnt_userns,
|
static int minix_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -4803,7 +4803,7 @@ int vfs_rename(struct renamedata *rd)
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
error = old_dir->i_op->rename(new_mnt_userns, old_dir, old_dentry,
|
error = old_dir->i_op->rename(rd->new_mnt_idmap, old_dir, old_dentry,
|
||||||
new_dir, new_dentry, flags);
|
new_dir, new_dentry, flags);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -2666,7 +2666,7 @@ nfs_unblock_rename(struct rpc_task *task, struct nfs_renamedata *data)
|
||||||
* If these conditions are met, we can drop the dentries before doing
|
* If these conditions are met, we can drop the dentries before doing
|
||||||
* the rename.
|
* the rename.
|
||||||
*/
|
*/
|
||||||
int nfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
int nfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -399,7 +399,7 @@ int nfs_symlink(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
int nfs_link(struct dentry *, struct inode *, struct dentry *);
|
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 user_namespace *, struct inode *, struct dentry *, umode_t,
|
||||||
dev_t);
|
dev_t);
|
||||||
int nfs_rename(struct user_namespace *, struct inode *, struct dentry *,
|
int nfs_rename(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
struct inode *, struct dentry *, unsigned int);
|
struct inode *, struct dentry *, unsigned int);
|
||||||
|
|
||||||
#ifdef CONFIG_NFS_V4_2
|
#ifdef CONFIG_NFS_V4_2
|
||||||
|
|
|
@ -340,7 +340,7 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nilfs_rename(struct user_namespace *mnt_userns,
|
static int nilfs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2)
|
||||||
ocfs2_inode_unlock(inode2, 1);
|
ocfs2_inode_unlock(inode2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ocfs2_rename(struct user_namespace *mnt_userns,
|
static int ocfs2_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir,
|
struct inode *old_dir,
|
||||||
struct dentry *old_dentry,
|
struct dentry *old_dentry,
|
||||||
struct inode *new_dir,
|
struct inode *new_dir,
|
||||||
|
|
|
@ -370,7 +370,7 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int omfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -375,7 +375,7 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int orangefs_rename(struct user_namespace *mnt_userns,
|
static int orangefs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir,
|
struct inode *old_dir,
|
||||||
struct dentry *old_dentry,
|
struct dentry *old_dentry,
|
||||||
struct inode *new_dir,
|
struct inode *new_dir,
|
||||||
|
|
|
@ -1061,7 +1061,7 @@ static int ovl_set_redirect(struct dentry *dentry, bool samedir)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ovl_rename(struct user_namespace *mnt_userns, struct inode *olddir,
|
static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
|
||||||
struct dentry *old, struct inode *newdir,
|
struct dentry *old, struct inode *newdir,
|
||||||
struct dentry *new, unsigned int flags)
|
struct dentry *new, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1307,7 +1307,7 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,
|
||||||
* one path. If it holds 2 or more, it can get into endless waiting in
|
* one path. If it holds 2 or more, it can get into endless waiting in
|
||||||
* get_empty_nodes or its clones
|
* get_empty_nodes or its clones
|
||||||
*/
|
*/
|
||||||
static int reiserfs_rename(struct user_namespace *mnt_userns,
|
static int reiserfs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern int cifs_mknod(struct user_namespace *, struct inode *, struct dentry *,
|
||||||
extern int cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
|
extern int cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
umode_t);
|
umode_t);
|
||||||
extern int cifs_rmdir(struct inode *, struct dentry *);
|
extern int cifs_rmdir(struct inode *, struct dentry *);
|
||||||
extern int cifs_rename2(struct user_namespace *, struct inode *,
|
extern int cifs_rename2(struct mnt_idmap *, struct inode *,
|
||||||
struct dentry *, struct inode *, struct dentry *,
|
struct dentry *, struct inode *, struct dentry *,
|
||||||
unsigned int);
|
unsigned int);
|
||||||
extern int cifs_revalidate_file_attr(struct file *filp);
|
extern int cifs_revalidate_file_attr(struct file *filp);
|
||||||
|
|
|
@ -2257,7 +2257,7 @@ do_rename_exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cifs_rename2(struct user_namespace *mnt_userns, struct inode *source_dir,
|
cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,
|
||||||
struct dentry *source_dentry, struct inode *target_dir,
|
struct dentry *source_dentry, struct inode *target_dir,
|
||||||
struct dentry *target_dentry, unsigned int flags)
|
struct dentry *target_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,7 +189,7 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry)
|
||||||
* Anybody can rename anything with this: the permission checks are left to the
|
* Anybody can rename anything with this: the permission checks are left to the
|
||||||
* higher-level routines.
|
* higher-level routines.
|
||||||
*/
|
*/
|
||||||
static int sysv_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int sysv_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ubifs_rename(struct user_namespace *mnt_userns,
|
static int ubifs_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
|
|
@ -1070,7 +1070,7 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
|
||||||
/* Anybody can rename anything with this: the permission checks are left to the
|
/* Anybody can rename anything with this: the permission checks are left to the
|
||||||
* higher-level routines.
|
* higher-level routines.
|
||||||
*/
|
*/
|
||||||
static int udf_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,7 +243,7 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ufs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
struct dentry *old_dentry, struct inode *new_dir,
|
struct dentry *old_dentry, struct inode *new_dir,
|
||||||
struct dentry *new_dentry, unsigned int flags)
|
struct dentry *new_dentry, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -387,7 +387,7 @@ static int vboxsf_dir_unlink(struct inode *parent, struct dentry *dentry)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vboxsf_dir_rename(struct user_namespace *mnt_userns,
|
static int vboxsf_dir_rename(struct mnt_idmap *idmap,
|
||||||
struct inode *old_parent,
|
struct inode *old_parent,
|
||||||
struct dentry *old_dentry,
|
struct dentry *old_dentry,
|
||||||
struct inode *new_parent,
|
struct inode *new_parent,
|
||||||
|
|
|
@ -445,13 +445,14 @@ xfs_vn_symlink(
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_vn_rename(
|
xfs_vn_rename(
|
||||||
struct user_namespace *mnt_userns,
|
struct mnt_idmap *idmap,
|
||||||
struct inode *odir,
|
struct inode *odir,
|
||||||
struct dentry *odentry,
|
struct dentry *odentry,
|
||||||
struct inode *ndir,
|
struct inode *ndir,
|
||||||
struct dentry *ndentry,
|
struct dentry *ndentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *new_inode = d_inode(ndentry);
|
struct inode *new_inode = d_inode(ndentry);
|
||||||
int omode = 0;
|
int omode = 0;
|
||||||
int error;
|
int error;
|
||||||
|
|
|
@ -2259,7 +2259,7 @@ struct inode_operations {
|
||||||
int (*rmdir) (struct inode *,struct dentry *);
|
int (*rmdir) (struct inode *,struct dentry *);
|
||||||
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,
|
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,
|
||||||
umode_t,dev_t);
|
umode_t,dev_t);
|
||||||
int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
|
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
struct inode *, struct dentry *, unsigned int);
|
struct inode *, struct dentry *, unsigned int);
|
||||||
int (*setattr) (struct mnt_idmap *, struct dentry *, struct iattr *);
|
int (*setattr) (struct mnt_idmap *, struct dentry *, struct iattr *);
|
||||||
int (*getattr) (struct mnt_idmap *, const struct path *,
|
int (*getattr) (struct mnt_idmap *, const struct path *,
|
||||||
|
@ -3496,7 +3496,7 @@ extern int simple_unlink(struct inode *, struct dentry *);
|
||||||
extern int simple_rmdir(struct inode *, struct dentry *);
|
extern int simple_rmdir(struct inode *, struct dentry *);
|
||||||
extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
|
extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry);
|
struct inode *new_dir, struct dentry *new_dentry);
|
||||||
extern int simple_rename(struct user_namespace *, struct inode *,
|
extern int simple_rename(struct mnt_idmap *, struct inode *,
|
||||||
struct dentry *, struct inode *, struct dentry *,
|
struct dentry *, struct inode *, struct dentry *,
|
||||||
unsigned int);
|
unsigned int);
|
||||||
extern void simple_recursive_removal(struct dentry *,
|
extern void simple_recursive_removal(struct dentry *,
|
||||||
|
|
|
@ -3334,9 +3334,10 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
return shmem_unlink(dir, dentry);
|
return shmem_unlink(dir, dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shmem_whiteout(struct user_namespace *mnt_userns,
|
static int shmem_whiteout(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry)
|
struct inode *old_dir, struct dentry *old_dentry)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct dentry *whiteout;
|
struct dentry *whiteout;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -3367,7 +3368,7 @@ static int shmem_whiteout(struct user_namespace *mnt_userns,
|
||||||
* it exists so that the VFS layer correctly free's it when it
|
* it exists so that the VFS layer correctly free's it when it
|
||||||
* gets overwritten.
|
* gets overwritten.
|
||||||
*/
|
*/
|
||||||
static int shmem_rename2(struct user_namespace *mnt_userns,
|
static int shmem_rename2(struct mnt_idmap *idmap,
|
||||||
struct inode *old_dir, struct dentry *old_dentry,
|
struct inode *old_dir, struct dentry *old_dentry,
|
||||||
struct inode *new_dir, struct dentry *new_dentry,
|
struct inode *new_dir, struct dentry *new_dentry,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
|
@ -3387,7 +3388,7 @@ static int shmem_rename2(struct user_namespace *mnt_userns,
|
||||||
if (flags & RENAME_WHITEOUT) {
|
if (flags & RENAME_WHITEOUT) {
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = shmem_whiteout(mnt_userns, old_dir, old_dentry);
|
error = shmem_whiteout(idmap, old_dir, old_dentry);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue