1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: aufs: AppArmor compatibility
4 This patch adds NULL vfsmounts for AppArmor enabled kernels.
6 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
8 fs/aufs25/vfsub.c | 18 +++++++++---------
9 1 file changed, 9 insertions(+), 9 deletions(-)
11 --- a/fs/aufs25/vfsub.c
12 +++ b/fs/aufs25/vfsub.c
13 @@ -127,9 +127,9 @@ int do_vfsub_create(struct inode *dir, s
16 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
17 -#define VfsubSymlinkArgs dir, dentry, symname
18 +#define VfsubSymlinkArgs dir, dentry, NULL, symname
20 -#define VfsubSymlinkArgs dir, dentry, symname, mode
21 +#define VfsubSymlinkArgs dir, dentry, NULL, symname, mode
24 int do_vfsub_symlink(struct inode *dir, struct dentry *dentry,
25 @@ -158,7 +158,7 @@ int do_vfsub_mknod(struct inode *dir, st
26 LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
29 - err = vfs_mknod(dir, dentry, mode, dev);
30 + err = vfs_mknod(dir, dentry, NULL, mode, dev);
32 /* dir inode is locked */
33 au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
34 @@ -177,7 +177,7 @@ int do_vfsub_link(struct dentry *src_den
38 - err = vfs_link(src_dentry, dir, dentry);
39 + err = vfs_link(src_dentry, NULL, dir, dentry, 0);
42 LKTRTrace("src_i %p, dst_i %p\n",
43 @@ -203,7 +203,7 @@ int do_vfsub_rename(struct inode *src_di
47 - err = vfs_rename(src_dir, src_dentry, dir, dentry);
48 + err = vfs_rename(src_dir, src_dentry, NULL, dir, dentry, 0);
51 /* dir inode is locked */
52 @@ -221,7 +221,7 @@ int do_vfsub_mkdir(struct inode *dir, st
53 LKTRTrace("i%lu, %.*s, 0x%x\n", dir->i_ino, AuDLNPair(dentry), mode);
56 - err = vfs_mkdir(dir, dentry, mode);
57 + err = vfs_mkdir(dir, dentry, NULL, mode);
59 /* dir inode is locked */
60 au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
61 @@ -238,7 +238,7 @@ int do_vfsub_rmdir(struct inode *dir, st
65 - err = vfs_rmdir(dir, dentry);
66 + err = vfs_rmdir(dir, dentry, 0);
68 /* dir inode is locked */
70 @@ -255,7 +255,7 @@ int do_vfsub_unlink(struct inode *dir, s
72 /* vfs_unlink() locks inode */
74 - err = vfs_unlink(dir, dentry);
75 + err = vfs_unlink(dir, dentry, 0);
77 /* dir inode is locked */
79 @@ -493,7 +493,7 @@ static void call_notify_change(void *arg
80 if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
81 vfsub_ignore(a->vargs);
83 - *a->errp = notify_change(a->h_dentry, a->ia);
84 + *a->errp = notify_change(a->h_dentry, NULL, a->ia);
87 au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/
89 From: Jeff Mahoney <jeffm@suse.com>
92 An AppArmor patch removed ia_file and ATTR_FILE from struct iattr and
93 replaced it with the fsetattr file_operation.
95 This patch fixes aufs to use it.
97 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
100 fs/aufs25/f_op.c | 1 +
101 fs/aufs25/i_op.c | 25 ++++++++++++++-----------
102 fs/aufs25/inode.h | 1 +
103 fs/aufs25/misc.c | 5 ++---
104 fs/aufs25/vfsub.c | 13 ++++++++++---
105 fs/aufs25/vfsub.h | 2 ++
106 7 files changed, 31 insertions(+), 17 deletions(-)
108 --- a/fs/aufs25/dir.c
109 +++ b/fs/aufs25/dir.c
110 @@ -546,4 +546,5 @@ struct file_operations aufs_dir_fop = {
111 .release = aufs_release_dir,
113 .fsync = aufs_fsync_dir,
114 + .fsetattr = aufs_fsetattr,
116 --- a/fs/aufs25/f_op.c
117 +++ b/fs/aufs25/f_op.c
118 @@ -665,4 +665,5 @@ struct file_operations aufs_file_fop = {
119 .splice_write = aufs_splice_write,
120 .splice_read = aufs_splice_read,
122 + .fsetattr = aufs_fsetattr,
124 --- a/fs/aufs25/i_op.c
125 +++ b/fs/aufs25/i_op.c
126 @@ -727,13 +727,13 @@ static int au_lock_and_icpup(struct dent
130 -static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
131 +static int aufs_do_setattr(struct dentry *dentry, struct iattr *ia,
136 struct super_block *sb;
140 struct au_icpup_args *a;
142 @@ -751,12 +751,8 @@ static int aufs_setattr(struct dentry *d
143 si_read_lock(sb, AuLock_FLUSH);
144 vfsub_args_init(&a->vargs, a->ign, au_test_dlgt(au_mntflags(sb)), 0);
146 - if (ia->ia_valid & ATTR_FILE) {
147 - /* currently ftruncate(2) only */
148 - file = ia->ia_file;
151 - ia->ia_file = au_h_fptr(file, au_fbstart(file));
155 if ((ia->ia_valid & ATTR_SIZE)
156 @@ -800,11 +796,8 @@ static int aufs_setattr(struct dentry *d
158 di_write_unlock(dentry);
162 fi_write_unlock(file);
163 - ia->ia_file = file;
164 - ia->ia_valid |= ATTR_FILE;
169 @@ -812,6 +805,16 @@ static int aufs_setattr(struct dentry *d
173 +static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
175 + return aufs_do_setattr(dentry, ia, NULL);
178 +int aufs_fsetattr(struct file *file, struct iattr *ia)
180 + return aufs_do_setattr(file->f_dentry, ia, file);
183 /* ---------------------------------------------------------------------- */
185 static int h_readlink(struct dentry *dentry, int bindex, char __user *buf,
186 --- a/fs/aufs25/inode.h
187 +++ b/fs/aufs25/inode.h
188 @@ -84,6 +84,7 @@ int au_test_h_perm_sio(struct inode *h_i
191 extern struct inode_operations aufs_iop, aufs_symlink_iop, aufs_dir_iop;
192 +int aufs_fsetattr(struct file *file, struct iattr *ia);
194 /* au_wr_dir flags */
195 #define AuWrDir_ADD_ENTRY 1
196 --- a/fs/aufs25/misc.c
197 +++ b/fs/aufs25/misc.c
198 @@ -267,13 +267,12 @@ int au_copy_file(struct file *dst, struc
201 ia->ia_size = dst->f_pos;
202 - ia->ia_valid = ATTR_SIZE | ATTR_FILE;
204 + ia->ia_valid = ATTR_SIZE;
205 vfsub_args_reinit(vargs);
206 vfsub_ign_hinode(vargs, vfsub_events_notify_change(ia),
208 mutex_lock_nested(&h_i->i_mutex, AuLsc_I_CHILD2);
209 - err = vfsub_notify_change(h_d, ia, vargs);
210 + err = vfsub_fnotify_change(h_d, ia, vargs, dst);
211 mutex_unlock(&h_i->i_mutex);
214 --- a/fs/aufs25/vfsub.c
215 +++ b/fs/aufs25/vfsub.c
216 @@ -477,6 +477,7 @@ struct notify_change_args {
217 struct dentry *h_dentry;
219 struct vfsub_args *vargs;
223 static void call_notify_change(void *args)
224 @@ -493,7 +494,7 @@ static void call_notify_change(void *arg
225 if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
226 vfsub_ignore(a->vargs);
228 - *a->errp = notify_change(a->h_dentry, NULL, a->ia);
229 + *a->errp = fnotify_change(a->h_dentry, NULL, a->ia, a->file);
232 au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/
233 @@ -525,8 +526,8 @@ static void vfsub_notify_change_dlgt(str
237 -int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
238 - struct vfsub_args *vargs)
239 +int vfsub_fnotify_change(struct dentry *dentry, struct iattr *ia,
240 + struct vfsub_args *vargs, struct file *file)
243 struct notify_change_args args = {
244 @@ -570,6 +571,12 @@ int vfsub_sio_notify_change(struct au_hi
248 +int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
249 + struct vfsub_args *vargs)
251 + return vfsub_fnotify_change(dentry, ia, vargs, NULL);
254 /* ---------------------------------------------------------------------- */
257 --- a/fs/aufs25/vfsub.h
258 +++ b/fs/aufs25/vfsub.h
259 @@ -508,6 +508,8 @@ int vfsub_sio_notify_change(struct au_hi
261 /* ---------------------------------------------------------------------- */
263 +int vfsub_fnotify_change(struct dentry *dentry, struct iattr *ia,
264 + struct vfsub_args *vargs, struct file *file);
265 int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
266 struct vfsub_args *vargs);
267 int vfsub_unlink(struct inode *dir, struct dentry *dentry,