]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.apparmor/vfs-rmdir.diff
Revert "Disable build of xen kernel."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.apparmor / vfs-rmdir.diff
1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add a struct vfsmount parameter to vfs_rmdir()
3
4 The vfsmount will be passed down to the LSM hook so that LSMs can compute
5 pathnames.
6
7 Signed-off-by: Tony Jones <tonyj@suse.de>
8 Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9 Signed-off-by: John Johansen <jjohansen@suse.de>
10
11 ---
12 fs/ecryptfs/inode.c | 4 +++-
13 fs/namei.c | 4 ++--
14 fs/nfsd/nfs4recover.c | 2 +-
15 fs/nfsd/vfs.c | 8 +++++---
16 include/linux/fs.h | 2 +-
17 5 files changed, 12 insertions(+), 8 deletions(-)
18
19 --- a/fs/ecryptfs/inode.c
20 +++ b/fs/ecryptfs/inode.c
21 @@ -534,14 +534,16 @@ out:
22 static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
23 {
24 struct dentry *lower_dentry;
25 + struct vfsmount *lower_mnt;
26 struct dentry *lower_dir_dentry;
27 int rc;
28
29 lower_dentry = ecryptfs_dentry_to_lower(dentry);
30 + lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
31 dget(dentry);
32 lower_dir_dentry = lock_parent(lower_dentry);
33 dget(lower_dentry);
34 - rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
35 + rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry, lower_mnt);
36 dput(lower_dentry);
37 if (!rc)
38 d_delete(lower_dentry);
39 --- a/fs/namei.c
40 +++ b/fs/namei.c
41 @@ -2167,7 +2167,7 @@ void dentry_unhash(struct dentry *dentry
42 spin_unlock(&dcache_lock);
43 }
44
45 -int vfs_rmdir(struct inode *dir, struct dentry *dentry)
46 +int vfs_rmdir(struct inode *dir, struct dentry *dentry,struct vfsmount *mnt)
47 {
48 int error = may_delete(dir, dentry, 1);
49
50 @@ -2230,7 +2230,7 @@ static long do_rmdir(int dfd, const char
51 error = mnt_want_write(nd.path.mnt);
52 if (error)
53 goto exit3;
54 - error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
55 + error = vfs_rmdir(nd.path.dentry->d_inode, dentry, nd.path.mnt);
56 mnt_drop_write(nd.path.mnt);
57 exit3:
58 dput(dentry);
59 --- a/fs/nfsd/nfs4recover.c
60 +++ b/fs/nfsd/nfs4recover.c
61 @@ -279,7 +279,7 @@ nfsd4_clear_clid_dir(struct dentry *dir,
62 * a kernel from the future.... */
63 nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
64 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
65 - status = vfs_rmdir(dir->d_inode, dentry);
66 + status = vfs_rmdir(dir->d_inode, dentry, rec_dir.path.mnt);
67 mutex_unlock(&dir->d_inode->i_mutex);
68 return status;
69 }
70 --- a/fs/nfsd/vfs.c
71 +++ b/fs/nfsd/vfs.c
72 @@ -1790,6 +1790,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
73 char *fname, int flen)
74 {
75 struct dentry *dentry, *rdentry;
76 + struct svc_export *exp;
77 struct inode *dirp;
78 __be32 err;
79 int host_err;
80 @@ -1804,6 +1805,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
81 fh_lock_nested(fhp, I_MUTEX_PARENT);
82 dentry = fhp->fh_dentry;
83 dirp = dentry->d_inode;
84 + exp = fhp->fh_export;
85
86 rdentry = lookup_one_len(fname, dentry, flen);
87 host_err = PTR_ERR(rdentry);
88 @@ -1825,21 +1827,21 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
89
90 if (type != S_IFDIR) { /* It's UNLINK */
91 #ifdef MSNFS
92 - if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
93 + if ((exp->ex_flags & NFSEXP_MSNFS) &&
94 (atomic_read(&rdentry->d_count) > 1)) {
95 host_err = -EPERM;
96 } else
97 #endif
98 host_err = vfs_unlink(dirp, rdentry);
99 } else { /* It's RMDIR */
100 - host_err = vfs_rmdir(dirp, rdentry);
101 + host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt);
102 }
103
104 dput(rdentry);
105
106 if (host_err)
107 goto out_drop;
108 - if (EX_ISSYNC(fhp->fh_export))
109 + if (EX_ISSYNC(exp))
110 host_err = nfsd_sync_dir(dentry);
111
112 out_drop:
113 --- a/include/linux/fs.h
114 +++ b/include/linux/fs.h
115 @@ -1182,7 +1182,7 @@ extern int vfs_mkdir(struct inode *, str
116 extern int vfs_mknod(struct inode *, struct dentry *, struct vfsmount *, int, dev_t);
117 extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *);
118 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
119 -extern int vfs_rmdir(struct inode *, struct dentry *);
120 +extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
121 extern int vfs_unlink(struct inode *, struct dentry *);
122 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
123