]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.apparmor/vfs-rename.diff
Revert "Move xen patchset to new version's subdir."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.apparmor / vfs-rename.diff
CommitLineData
8f69975d
BS
1From: Tony Jones <tonyj@suse.de>
2Subject: Add struct vfsmount parameters to vfs_rename()
3
4The vfsmount will be passed down to the LSM hook so that LSMs can compute
5pathnames.
6
7Signed-off-by: Tony Jones <tonyj@suse.de>
8Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9Signed-off-by: John Johansen <jjohansen@suse.de>
10
11---
12 fs/ecryptfs/inode.c | 7 ++++++-
13 fs/namei.c | 19 ++++++++++++-------
14 fs/nfsd/vfs.c | 3 ++-
15 include/linux/fs.h | 2 +-
16 4 files changed, 21 insertions(+), 10 deletions(-)
17
18--- a/fs/ecryptfs/inode.c
19+++ b/fs/ecryptfs/inode.c
20@@ -590,19 +590,24 @@ ecryptfs_rename(struct inode *old_dir, s
21 {
22 int rc;
23 struct dentry *lower_old_dentry;
24+ struct vfsmount *lower_old_mnt;
25 struct dentry *lower_new_dentry;
26+ struct vfsmount *lower_new_mnt;
27 struct dentry *lower_old_dir_dentry;
28 struct dentry *lower_new_dir_dentry;
29
30 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
31+ lower_old_mnt = ecryptfs_dentry_to_lower_mnt(old_dentry);
32 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
33+ lower_new_mnt = ecryptfs_dentry_to_lower_mnt(new_dentry);
34 dget(lower_old_dentry);
35 dget(lower_new_dentry);
36 lower_old_dir_dentry = dget_parent(lower_old_dentry);
37 lower_new_dir_dentry = dget_parent(lower_new_dentry);
38 lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
39 rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry,
40- lower_new_dir_dentry->d_inode, lower_new_dentry);
41+ lower_old_mnt, lower_new_dir_dentry->d_inode,
42+ lower_new_dentry, lower_new_mnt);
43 if (rc)
44 goto out_lock;
45 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL);
46--- a/fs/namei.c
47+++ b/fs/namei.c
48@@ -2547,7 +2547,8 @@ SYSCALL_DEFINE2(link, const char __user
49 * locking].
50 */
51 static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
52- struct inode *new_dir, struct dentry *new_dentry)
53+ struct vfsmount *old_mnt, struct inode *new_dir,
54+ struct dentry *new_dentry, struct vfsmount *new_mnt)
55 {
56 int error = 0;
57 struct inode *target;
58@@ -2590,7 +2591,8 @@ static int vfs_rename_dir(struct inode *
59 }
60
61 static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
62- struct inode *new_dir, struct dentry *new_dentry)
63+ struct vfsmount *old_mnt, struct inode *new_dir,
64+ struct dentry *new_dentry, struct vfsmount *new_mnt)
65 {
66 struct inode *target;
67 int error;
68@@ -2618,7 +2620,8 @@ static int vfs_rename_other(struct inode
69 }
70
71 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
72- struct inode *new_dir, struct dentry *new_dentry)
73+ struct vfsmount *old_mnt, struct inode *new_dir,
74+ struct dentry *new_dentry, struct vfsmount *new_mnt)
75 {
76 int error;
77 int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
78@@ -2647,9 +2650,11 @@ int vfs_rename(struct inode *old_dir, st
79 old_name = fsnotify_oldname_init(old_dentry->d_name.name);
80
81 if (is_dir)
82- error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
83+ error = vfs_rename_dir(old_dir, old_dentry, old_mnt,
84+ new_dir, new_dentry, new_mnt);
85 else
86- error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
87+ error = vfs_rename_other(old_dir, old_dentry, old_mnt,
88+ new_dir, new_dentry, new_mnt);
89 if (!error) {
90 const char *new_name = old_dentry->d_name.name;
91 fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir,
92@@ -2726,8 +2731,8 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c
93 error = mnt_want_write(oldnd.path.mnt);
94 if (error)
95 goto exit5;
96- error = vfs_rename(old_dir->d_inode, old_dentry,
97- new_dir->d_inode, new_dentry);
98+ error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt,
99+ new_dir->d_inode, new_dentry, newnd.path.mnt);
100 mnt_drop_write(oldnd.path.mnt);
101 exit5:
102 dput(new_dentry);
103--- a/fs/nfsd/vfs.c
104+++ b/fs/nfsd/vfs.c
105@@ -1752,7 +1752,8 @@ nfsd_rename(struct svc_rqst *rqstp, stru
106 if (host_err)
107 goto out_dput_new;
108
109- host_err = vfs_rename(fdir, odentry, tdir, ndentry);
110+ host_err = vfs_rename(fdir, odentry, ffhp->fh_export->ex_path.mnt,
111+ tdir, ndentry, tfhp->fh_export->ex_path.mnt);
112 if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
113 host_err = nfsd_sync_dir(tdentry);
114 if (!host_err)
115--- a/include/linux/fs.h
116+++ b/include/linux/fs.h
117@@ -1184,7 +1184,7 @@ extern int vfs_symlink(struct inode *, s
118 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
119 extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
120 extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);
121-extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
122+extern int vfs_rename(struct inode *, struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
123
124 /*
125 * VFS dentry helper functions.