~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/vfs-rename.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Add struct vfsmount parameters to vfs_rename()
2
 
 
3
 
Signed-off-by: Tony Jones <tonyj@suse.de>
4
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
5
 
 
6
 
Index: b/fs/ecryptfs/inode.c
7
 
===================================================================
8
 
--- a/fs/ecryptfs/inode.c
9
 
+++ b/fs/ecryptfs/inode.c
10
 
@@ -601,19 +601,24 @@ ecryptfs_rename(struct inode *old_dir, s
11
 
 {
12
 
        int rc;
13
 
        struct dentry *lower_old_dentry;
14
 
+       struct vfsmount *lower_old_mnt;
15
 
        struct dentry *lower_new_dentry;
16
 
+       struct vfsmount *lower_new_mnt;
17
 
        struct dentry *lower_old_dir_dentry;
18
 
        struct dentry *lower_new_dir_dentry;
19
 
 
20
 
        lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
21
 
+       lower_old_mnt = ecryptfs_dentry_to_lower_mnt(old_dentry);
22
 
        lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
23
 
+       lower_new_mnt = ecryptfs_dentry_to_lower_mnt(new_dentry);
24
 
        dget(lower_old_dentry);
25
 
        dget(lower_new_dentry);
26
 
        lower_old_dir_dentry = dget_parent(lower_old_dentry);
27
 
        lower_new_dir_dentry = dget_parent(lower_new_dentry);
28
 
        lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
29
 
        rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry,
30
 
-                       lower_new_dir_dentry->d_inode, lower_new_dentry);
31
 
+                       lower_old_mnt, lower_new_dir_dentry->d_inode,
32
 
+                       lower_new_dentry, lower_new_mnt);
33
 
        if (rc)
34
 
                goto out_lock;
35
 
        fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL);
36
 
Index: b/fs/namei.c
37
 
===================================================================
38
 
--- a/fs/namei.c
39
 
+++ b/fs/namei.c
40
 
@@ -2382,7 +2382,8 @@ asmlinkage long sys_link(const char __us
41
 
  *        locking].
42
 
  */
43
 
 static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
44
 
-                         struct inode *new_dir, struct dentry *new_dentry)
45
 
+                         struct vfsmount *old_mnt, struct inode *new_dir,
46
 
+                         struct dentry *new_dentry, struct vfsmount *new_mnt)
47
 
 {
48
 
        int error = 0;
49
 
        struct inode *target;
50
 
@@ -2425,7 +2426,8 @@ static int vfs_rename_dir(struct inode *
51
 
 }
52
 
 
53
 
 static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
54
 
-                           struct inode *new_dir, struct dentry *new_dentry)
55
 
+                           struct vfsmount *old_mnt, struct inode *new_dir,
56
 
+                           struct dentry *new_dentry, struct vfsmount *new_mnt)
57
 
 {
58
 
        struct inode *target;
59
 
        int error;
60
 
@@ -2453,7 +2455,8 @@ static int vfs_rename_other(struct inode
61
 
 }
62
 
 
63
 
 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
64
 
-              struct inode *new_dir, struct dentry *new_dentry)
65
 
+               struct vfsmount *old_mnt, struct inode *new_dir,
66
 
+               struct dentry *new_dentry, struct vfsmount *new_mnt)
67
 
 {
68
 
        int error;
69
 
        int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
70
 
@@ -2482,9 +2485,11 @@ int vfs_rename(struct inode *old_dir, st
71
 
        old_name = fsnotify_oldname_init(old_dentry->d_name.name);
72
 
 
73
 
        if (is_dir)
74
 
-               error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
75
 
+               error = vfs_rename_dir(old_dir, old_dentry, old_mnt,
76
 
+                                      new_dir, new_dentry, new_mnt);
77
 
        else
78
 
-               error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
79
 
+               error = vfs_rename_other(old_dir, old_dentry, old_mnt,
80
 
+                                        new_dir, new_dentry, new_mnt);
81
 
        if (!error) {
82
 
                const char *new_name = old_dentry->d_name.name;
83
 
                fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir,
84
 
@@ -2556,8 +2561,8 @@ static int do_rename(int olddfd, const c
85
 
        if (new_dentry == trap)
86
 
                goto exit5;
87
 
 
88
 
-       error = vfs_rename(old_dir->d_inode, old_dentry,
89
 
-                                  new_dir->d_inode, new_dentry);
90
 
+       error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.mnt,
91
 
+                          new_dir->d_inode, new_dentry, newnd.mnt);
92
 
 exit5:
93
 
        dput(new_dentry);
94
 
 exit4:
95
 
Index: b/fs/nfsd/vfs.c
96
 
===================================================================
97
 
--- a/fs/nfsd/vfs.c
98
 
+++ b/fs/nfsd/vfs.c
99
 
@@ -1625,7 +1625,8 @@ nfsd_rename(struct svc_rqst *rqstp, stru
100
 
                        host_err = -EPERM;
101
 
        } else
102
 
 #endif
103
 
-       host_err = vfs_rename(fdir, odentry, tdir, ndentry);
104
 
+       host_err = vfs_rename(fdir, odentry, ffhp->fh_export->ex_mnt,
105
 
+                             tdir, ndentry, tfhp->fh_export->ex_mnt);
106
 
        if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
107
 
                host_err = nfsd_sync_dir(tdentry);
108
 
                if (!host_err)
109
 
Index: b/include/linux/fs.h
110
 
===================================================================
111
 
--- a/include/linux/fs.h
112
 
+++ b/include/linux/fs.h
113
 
@@ -986,7 +986,7 @@ extern int vfs_symlink(struct inode *, s
114
 
 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
115
 
 extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
116
 
 extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);
117
 
-extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
118
 
+extern int vfs_rename(struct inode *, struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
119
 
 
120
 
 /*
121
 
  * VFS dentry helper functions.