]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.apparmor/vfs-link.diff
Changed checkfs to auto reboot after correctable fsck fixes.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.apparmor / vfs-link.diff
1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add struct vfsmount parameters to vfs_link()
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 | 9 +++++++--
13 fs/namei.c | 6 ++++--
14 fs/nfsd/vfs.c | 3 ++-
15 include/linux/fs.h | 2 +-
16 4 files changed, 14 insertions(+), 6 deletions(-)
17
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)
22 {
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;
28 u64 file_size_save;
29 int rc;
30
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,
40 - lower_new_dentry);
41 + rc = vfs_link(lower_old_dentry, lower_old_mnt,
42 + lower_dir_dentry->d_inode, lower_new_dentry,
43 + lower_new_mnt);
44 if (rc || !lower_new_dentry->d_inode)
45 goto out_lock;
46 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0);
47 --- a/fs/namei.c
48 +++ b/fs/namei.c
49 @@ -2412,7 +2412,7 @@ SYSCALL_DEFINE2(symlink, const char __us
50 return sys_symlinkat(oldname, AT_FDCWD, newname);
51 }
52
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)
55 {
56 struct inode *inode = old_dentry->d_inode;
57 int error;
58 @@ -2490,7 +2490,9 @@ SYSCALL_DEFINE5(linkat, int, olddfd, con
59 error = mnt_want_write(nd.path.mnt);
60 if (error)
61 goto out_dput;
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);
67 out_dput:
68 dput(new_dentry);
69 --- a/fs/nfsd/vfs.c
70 +++ b/fs/nfsd/vfs.c
71 @@ -1650,7 +1650,8 @@ nfsd_link(struct svc_rqst *rqstp, struct
72 err = nfserrno(host_err);
73 goto out_dput;
74 }
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);
78 if (!host_err) {
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 *);