1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add struct vfsmount parameters to vfs_link()
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 | 9 +++++++--
15 include/linux/fs.h | 2 +-
16 4 files changed, 14 insertions(+), 6 deletions(-)
18 --- a/fs/ecryptfs/inode.c
19 +++ b/fs/ecryptfs/inode.c
20 @@ -403,19 +403,24 @@ static int ecryptfs_link(struct dentry *
21 struct dentry *new_dentry)
23 struct dentry *lower_old_dentry;
24 + struct vfsmount *lower_old_mnt;
25 struct dentry *lower_new_dentry;
26 + struct vfsmount *lower_new_mnt;
27 struct dentry *lower_dir_dentry;
31 file_size_save = i_size_read(old_dentry->d_inode);
32 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
33 + lower_old_mnt = ecryptfs_dentry_to_lower_mnt(old_dentry);
34 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
35 + lower_new_mnt = ecryptfs_dentry_to_lower_mnt(new_dentry);
36 dget(lower_old_dentry);
37 dget(lower_new_dentry);
38 lower_dir_dentry = lock_parent(lower_new_dentry);
39 - rc = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
41 + rc = vfs_link(lower_old_dentry, lower_old_mnt,
42 + lower_dir_dentry->d_inode, lower_new_dentry,
44 if (rc || !lower_new_dentry->d_inode)
46 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0);
49 @@ -2412,7 +2412,7 @@ SYSCALL_DEFINE2(symlink, const char __us
50 return sys_symlinkat(oldname, AT_FDCWD, newname);
53 -int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
54 +int vfs_link(struct dentry *old_dentry, struct vfsmount *old_mnt, struct inode *dir, struct dentry *new_dentry, struct vfsmount *new_mnt)
56 struct inode *inode = old_dentry->d_inode;
58 @@ -2490,7 +2490,9 @@ SYSCALL_DEFINE5(linkat, int, olddfd, con
59 error = mnt_want_write(nd.path.mnt);
62 - error = vfs_link(old_path.dentry, nd.path.dentry->d_inode, new_dentry);
63 + error = vfs_link(old_path.dentry, old_path.mnt,
64 + nd.path.dentry->d_inode,
65 + new_dentry, nd.path.mnt);
66 mnt_drop_write(nd.path.mnt);
71 @@ -1650,7 +1650,8 @@ nfsd_link(struct svc_rqst *rqstp, struct
72 err = nfserrno(host_err);
75 - host_err = vfs_link(dold, dirp, dnew);
76 + host_err = vfs_link(dold, tfhp->fh_export->ex_path.mnt, dirp,
77 + dnew, ffhp->fh_export->ex_path.mnt);
79 if (EX_ISSYNC(ffhp->fh_export)) {
80 err = nfserrno(nfsd_sync_dir(ddir));
81 --- a/include/linux/fs.h
82 +++ b/include/linux/fs.h
83 @@ -1181,7 +1181,7 @@ extern int vfs_create(struct inode *, st
84 extern int vfs_mkdir(struct inode *, struct dentry *, struct vfsmount *, int);
85 extern int vfs_mknod(struct inode *, struct dentry *, struct vfsmount *, int, dev_t);
86 extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *);
87 -extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
88 +extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
89 extern int vfs_rmdir(struct inode *, struct dentry *);
90 extern int vfs_unlink(struct inode *, struct dentry *);
91 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);