1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add a struct vfsmount parameter to vfs_rmdir()
4 The vfsmount will be passed down to the LSM hook so that LSMs can compute
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>
12 fs/ecryptfs/inode.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(-)
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)
24 struct dentry *lower_dentry;
25 + struct vfsmount *lower_mnt;
26 struct dentry *lower_dir_dentry;
29 lower_dentry = ecryptfs_dentry_to_lower(dentry);
30 + lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
32 lower_dir_dentry = lock_parent(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);
38 d_delete(lower_dentry);
41 @@ -2167,7 +2167,7 @@ void dentry_unhash(struct dentry *dentry
42 spin_unlock(&dcache_lock);
45 -int vfs_rmdir(struct inode *dir, struct dentry *dentry)
46 +int vfs_rmdir(struct inode *dir, struct dentry *dentry,struct vfsmount *mnt)
48 int error = may_delete(dir, dentry, 1);
50 @@ -2230,7 +2230,7 @@ static long do_rmdir(int dfd, const char
51 error = mnt_want_write(nd.path.mnt);
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);
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);
72 @@ -1790,6 +1790,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
73 char *fname, int flen)
75 struct dentry *dentry, *rdentry;
76 + struct svc_export *exp;
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;
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
90 if (type != S_IFDIR) { /* It's UNLINK */
92 - if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
93 + if ((exp->ex_flags & NFSEXP_MSNFS) &&
94 (atomic_read(&rdentry->d_count) > 1)) {
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);
108 - if (EX_ISSYNC(fhp->fh_export))
109 + if (EX_ISSYNC(exp))
110 host_err = nfsd_sync_dir(dentry);
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 *);