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,12 +445,13 @@ 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;
31 lower_dir_dentry = lock_parent(lower_dentry);
32 - rc = vfs_unlink(lower_dir_inode, lower_dentry);
33 + rc = vfs_unlink(lower_dir_inode, lower_dentry, lower_mnt);
35 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
39 @@ -2248,7 +2248,7 @@ SYSCALL_DEFINE1(rmdir, const char __user
40 return do_rmdir(AT_FDCWD, pathname);
43 -int vfs_unlink(struct inode *dir, struct dentry *dentry)
44 +int vfs_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt)
46 int error = may_delete(dir, dentry, 0);
48 @@ -2313,7 +2313,7 @@ static long do_unlinkat(int dfd, const c
49 error = mnt_want_write(nd.path.mnt);
52 - error = vfs_unlink(nd.path.dentry->d_inode, dentry);
53 + error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt);
54 mnt_drop_write(nd.path.mnt);
57 --- a/fs/nfsd/nfs4recover.c
58 +++ b/fs/nfsd/nfs4recover.c
59 @@ -264,7 +264,7 @@ nfsd4_remove_clid_file(struct dentry *di
62 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
63 - status = vfs_unlink(dir->d_inode, dentry);
64 + status = vfs_unlink(dir->d_inode, dentry, rec_dir.path.mnt);
65 mutex_unlock(&dir->d_inode->i_mutex);
70 @@ -1833,7 +1833,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
74 - host_err = vfs_unlink(dirp, rdentry);
75 + host_err = vfs_unlink(dirp, rdentry, exp->ex_path.mnt);
76 } else { /* It's RMDIR */
77 host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt);
79 --- a/include/linux/fs.h
80 +++ b/include/linux/fs.h
81 @@ -1183,7 +1183,7 @@ extern int vfs_mknod(struct inode *, str
82 extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *);
83 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
84 extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
85 -extern int vfs_unlink(struct inode *, struct dentry *);
86 +extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);
87 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
92 @@ -746,7 +746,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __
93 err = mnt_want_write(mqueue_mnt);
96 - err = vfs_unlink(dentry->d_parent->d_inode, dentry);
97 + err = vfs_unlink(dentry->d_parent->d_inode, dentry, mqueue_mnt);
98 mnt_drop_write(mqueue_mnt);