mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-06 01:05:11 +00:00
128 lines
5.2 KiB
Diff
128 lines
5.2 KiB
Diff
![]() |
Add struct vfsmount parameters to vfs_rename()
|
||
|
|
||
|
Signed-off-by: Tony Jones <tonyj@suse.de>
|
||
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
||
|
|
||
|
Index: linux-2.6.19/fs/ecryptfs/inode.c
|
||
|
===================================================================
|
||
|
--- linux-2.6.19.orig/fs/ecryptfs/inode.c
|
||
|
+++ linux-2.6.19/fs/ecryptfs/inode.c
|
||
|
@@ -627,19 +627,24 @@ ecryptfs_rename(struct inode *old_dir, s
|
||
|
{
|
||
|
int rc;
|
||
|
struct dentry *lower_old_dentry;
|
||
|
+ struct vfsmount *lower_old_mnt;
|
||
|
struct dentry *lower_new_dentry;
|
||
|
+ struct vfsmount *lower_new_mnt;
|
||
|
struct dentry *lower_old_dir_dentry;
|
||
|
struct dentry *lower_new_dir_dentry;
|
||
|
|
||
|
lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
|
||
|
+ lower_old_mnt = ecryptfs_dentry_to_lower_mnt(old_dentry);
|
||
|
lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
|
||
|
+ lower_new_mnt = ecryptfs_dentry_to_lower_mnt(new_dentry);
|
||
|
dget(lower_old_dentry);
|
||
|
dget(lower_new_dentry);
|
||
|
lower_old_dir_dentry = dget_parent(lower_old_dentry);
|
||
|
lower_new_dir_dentry = dget_parent(lower_new_dentry);
|
||
|
lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
|
||
|
- rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry,
|
||
|
- lower_new_dir_dentry->d_inode, lower_new_dentry);
|
||
|
+ rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_mnt,
|
||
|
+ lower_old_dentry, lower_new_dir_dentry->d_inode,
|
||
|
+ lower_new_mnt, lower_new_dentry);
|
||
|
if (rc)
|
||
|
goto out_lock;
|
||
|
ecryptfs_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
|
||
|
Index: linux-2.6.19/fs/namei.c
|
||
|
===================================================================
|
||
|
--- linux-2.6.19.orig/fs/namei.c
|
||
|
+++ linux-2.6.19/fs/namei.c
|
||
|
@@ -2385,8 +2385,9 @@ asmlinkage long sys_link(const char __us
|
||
|
* ->i_mutex on parents, which works but leads to some truely excessive
|
||
|
* locking].
|
||
|
*/
|
||
|
-static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
|
||
|
- struct inode *new_dir, struct dentry *new_dentry)
|
||
|
+static int vfs_rename_dir(struct inode *old_dir, struct vfsmount *old_mnt,
|
||
|
+ struct dentry *old_dentry, struct inode *new_dir,
|
||
|
+ struct vfsmount *new_mnt, struct dentry *new_dentry)
|
||
|
{
|
||
|
int error = 0;
|
||
|
struct inode *target;
|
||
|
@@ -2428,8 +2429,9 @@ static int vfs_rename_dir(struct inode *
|
||
|
return error;
|
||
|
}
|
||
|
|
||
|
-static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
|
||
|
- struct inode *new_dir, struct dentry *new_dentry)
|
||
|
+static int vfs_rename_other(struct inode *old_dir, struct vfsmount *old_mnt,
|
||
|
+ struct dentry *old_dentry, struct inode *new_dir,
|
||
|
+ struct vfsmount *new_mnt, struct dentry *new_dentry)
|
||
|
{
|
||
|
struct inode *target;
|
||
|
int error;
|
||
|
@@ -2456,8 +2458,9 @@ static int vfs_rename_other(struct inode
|
||
|
return error;
|
||
|
}
|
||
|
|
||
|
-int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||
|
- struct inode *new_dir, struct dentry *new_dentry)
|
||
|
+int vfs_rename(struct inode *old_dir, struct vfsmount *old_mnt,
|
||
|
+ struct dentry *old_dentry, struct inode *new_dir,
|
||
|
+ struct vfsmount *new_mnt, struct dentry *new_dentry)
|
||
|
{
|
||
|
int error;
|
||
|
int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
|
||
|
@@ -2486,9 +2489,11 @@ int vfs_rename(struct inode *old_dir, st
|
||
|
old_name = fsnotify_oldname_init(old_dentry->d_name.name);
|
||
|
|
||
|
if (is_dir)
|
||
|
- error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
|
||
|
+ error = vfs_rename_dir(old_dir, old_mnt, old_dentry,
|
||
|
+ new_dir, new_mnt, new_dentry);
|
||
|
else
|
||
|
- error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
|
||
|
+ error = vfs_rename_other(old_dir, old_mnt, old_dentry,
|
||
|
+ new_dir, new_mnt, new_dentry);
|
||
|
if (!error) {
|
||
|
const char *new_name = old_dentry->d_name.name;
|
||
|
fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir,
|
||
|
@@ -2560,8 +2565,8 @@ static int do_rename(int olddfd, const c
|
||
|
if (new_dentry == trap)
|
||
|
goto exit5;
|
||
|
|
||
|
- error = vfs_rename(old_dir->d_inode, old_dentry,
|
||
|
- new_dir->d_inode, new_dentry);
|
||
|
+ error = vfs_rename(old_dir->d_inode, oldnd.mnt, old_dentry,
|
||
|
+ new_dir->d_inode, newnd.mnt, new_dentry);
|
||
|
exit5:
|
||
|
dput(new_dentry);
|
||
|
exit4:
|
||
|
Index: linux-2.6.19/fs/nfsd/vfs.c
|
||
|
===================================================================
|
||
|
--- linux-2.6.19.orig/fs/nfsd/vfs.c
|
||
|
+++ linux-2.6.19/fs/nfsd/vfs.c
|
||
|
@@ -1631,7 +1631,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
|
||
|
host_err = -EPERM;
|
||
|
} else
|
||
|
#endif
|
||
|
- host_err = vfs_rename(fdir, odentry, tdir, ndentry);
|
||
|
+ host_err = vfs_rename(fdir, NULL, odentry, tdir, NULL, ndentry);
|
||
|
if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
|
||
|
host_err = nfsd_sync_dir(tdentry);
|
||
|
if (!host_err)
|
||
|
Index: linux-2.6.19/include/linux/fs.h
|
||
|
===================================================================
|
||
|
--- linux-2.6.19.orig/include/linux/fs.h
|
||
|
+++ linux-2.6.19/include/linux/fs.h
|
||
|
@@ -1019,7 +1019,7 @@ extern int vfs_symlink(struct inode *, s
|
||
|
extern int vfs_link(struct vfsmount *, struct dentry *, struct inode *, struct vfsmount *, struct dentry *);
|
||
|
extern int vfs_rmdir(struct inode *, struct vfsmount *, struct dentry *);
|
||
|
extern int vfs_unlink(struct inode *, struct vfsmount *, struct dentry *);
|
||
|
-extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
|
||
|
+extern int vfs_rename(struct inode *, struct vfsmount *, struct dentry *, struct inode *, struct vfsmount *, struct dentry *);
|
||
|
|
||
|
/*
|
||
|
* VFS dentry helper functions.
|