1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add a struct vfsmount parameter to vfs_unlink()
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 | 3 ++-
14 fs/nfsd/nfs4recover.c | 2 +-
16 include/linux/fs.h | 2 +-
18 6 files changed, 8 insertions(+), 7 deletions(-)
20 --- a/fs/ecryptfs/inode.c
21 +++ b/fs/ecryptfs/inode.c
22 @@ -445,11 +445,12 @@ static int ecryptfs_unlink(struct inode
25 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
26 + struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
27 struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
28 struct dentry *lower_dir_dentry;
30 lower_dir_dentry = lock_parent(lower_dentry);
31 - rc = vfs_unlink(lower_dir_inode, lower_dentry);
32 + rc = vfs_unlink(lower_dir_inode, lower_dentry, lower_mnt);
34 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
38 @@ -2248,7 +2248,7 @@ SYSCALL_DEFINE1(rmdir, const char __user
39 return do_rmdir(AT_FDCWD, pathname);
42 -int vfs_unlink(struct inode *dir, struct dentry *dentry)
43 +int vfs_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt)
45 int error = may_delete(dir, dentry, 0);
47 @@ -2313,7 +2313,7 @@ static long do_unlinkat(int dfd, const c
48 error = mnt_want_write(nd.path.mnt);
51 - error = vfs_unlink(nd.path.dentry->d_inode, dentry);
52 + error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt);
53 mnt_drop_write(nd.path.mnt);
56 --- a/fs/nfsd/nfs4recover.c
57 +++ b/fs/nfsd/nfs4recover.c
58 @@ -264,7 +264,7 @@ nfsd4_remove_clid_file(struct dentry *di
61 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
62 - status = vfs_unlink(dir->d_inode, dentry);
63 + status = vfs_unlink(dir->d_inode, dentry, rec_dir.path.mnt);
64 mutex_unlock(&dir->d_inode->i_mutex);
69 @@ -1832,7 +1832,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
73 - host_err = vfs_unlink(dirp, rdentry);
74 + host_err = vfs_unlink(dirp, rdentry, exp->ex_path.mnt);
75 } else { /* It's RMDIR */
76 host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt);
78 --- a/include/linux/fs.h
79 +++ b/include/linux/fs.h
80 @@ -1183,7 +1183,7 @@ extern int vfs_mknod(struct inode *, str
81 extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *);
82 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
83 extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
84 -extern int vfs_unlink(struct inode *, struct dentry *);
85 +extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);
86 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
91 @@ -746,7 +746,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __
92 err = mnt_want_write(mqueue_mnt);
95 - err = vfs_unlink(dentry->d_parent->d_inode, dentry);
96 + err = vfs_unlink(dentry->d_parent->d_inode, dentry, mqueue_mnt);
97 mnt_drop_write(mqueue_mnt);