]>
Commit | Line | Data |
---|---|---|
6d52e732 | 1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: aufs: AppArmor compatibility | |
3 | ||
4 | This patch adds NULL vfsmounts for AppArmor enabled kernels. | |
5 | ||
6 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
7 | --- | |
8 | fs/aufs25/vfsub.c | 18 +++++++++--------- | |
9 | 1 file changed, 9 insertions(+), 9 deletions(-) | |
10 | ||
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 | |
14 | } | |
15 | ||
16 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | |
17 | -#define VfsubSymlinkArgs dir, dentry, symname | |
18 | +#define VfsubSymlinkArgs dir, dentry, NULL, symname | |
19 | #else | |
20 | -#define VfsubSymlinkArgs dir, dentry, symname, mode | |
21 | +#define VfsubSymlinkArgs dir, dentry, NULL, symname, mode | |
22 | #endif | |
23 | ||
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); | |
27 | IMustLock(dir); | |
28 | ||
29 | - err = vfs_mknod(dir, dentry, mode, dev); | |
30 | + err = vfs_mknod(dir, dentry, NULL, mode, dev); | |
31 | if (!err) { | |
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 | |
35 | IMustLock(dir); | |
36 | ||
37 | lockdep_off(); | |
38 | - err = vfs_link(src_dentry, dir, dentry); | |
39 | + err = vfs_link(src_dentry, NULL, dir, dentry, 0); | |
40 | lockdep_on(); | |
41 | if (!err) { | |
42 | LKTRTrace("src_i %p, dst_i %p\n", | |
43 | @@ -203,7 +203,7 @@ int do_vfsub_rename(struct inode *src_di | |
44 | IMustLock(src_dir); | |
45 | ||
46 | lockdep_off(); | |
47 | - err = vfs_rename(src_dir, src_dentry, dir, dentry); | |
48 | + err = vfs_rename(src_dir, src_dentry, NULL, dir, dentry, 0); | |
49 | lockdep_on(); | |
50 | if (!err) { | |
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); | |
54 | IMustLock(dir); | |
55 | ||
56 | - err = vfs_mkdir(dir, dentry, mode); | |
57 | + err = vfs_mkdir(dir, dentry, NULL, mode); | |
58 | if (!err) { | |
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 | |
62 | IMustLock(dir); | |
63 | ||
64 | lockdep_off(); | |
65 | - err = vfs_rmdir(dir, dentry); | |
66 | + err = vfs_rmdir(dir, dentry, 0); | |
67 | lockdep_on(); | |
68 | /* dir inode is locked */ | |
69 | if (!err) | |
70 | @@ -255,7 +255,7 @@ int do_vfsub_unlink(struct inode *dir, s | |
71 | ||
72 | /* vfs_unlink() locks inode */ | |
73 | lockdep_off(); | |
74 | - err = vfs_unlink(dir, dentry); | |
75 | + err = vfs_unlink(dir, dentry, 0); | |
76 | lockdep_on(); | |
77 | /* dir inode is locked */ | |
78 | if (!err) | |
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); | |
82 | lockdep_off(); | |
83 | - *a->errp = notify_change(a->h_dentry, a->ia); | |
84 | + *a->errp = notify_change(a->h_dentry, NULL, a->ia); | |
85 | lockdep_on(); | |
86 | if (!*a->errp) | |
87 | au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/ | |
88 | ||
89 | From: Jeff Mahoney <jeffm@suse.com> | |
90 | Subject: Add fsetattr | |
91 | ||
92 | An AppArmor patch removed ia_file and ATTR_FILE from struct iattr and | |
93 | replaced it with the fsetattr file_operation. | |
94 | ||
95 | This patch fixes aufs to use it. | |
96 | ||
97 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
98 | --- | |
99 | fs/aufs25/dir.c | 1 + | |
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(-) | |
107 | ||
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, | |
112 | .flush = aufs_flush, | |
113 | .fsync = aufs_fsync_dir, | |
114 | + .fsetattr = aufs_fsetattr, | |
115 | }; | |
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, | |
121 | #endif | |
122 | + .fsetattr = aufs_fsetattr, | |
123 | }; | |
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 | |
127 | return err; | |
128 | } | |
129 | ||
130 | -static int aufs_setattr(struct dentry *dentry, struct iattr *ia) | |
131 | +static int aufs_do_setattr(struct dentry *dentry, struct iattr *ia, | |
132 | + struct file *file) | |
133 | { | |
134 | int err; | |
135 | struct inode *inode; | |
136 | struct super_block *sb; | |
137 | __u32 events; | |
138 | - struct file *file; | |
139 | loff_t sz; | |
140 | struct au_icpup_args *a; | |
141 | ||
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); | |
145 | ||
146 | - if (ia->ia_valid & ATTR_FILE) { | |
147 | - /* currently ftruncate(2) only */ | |
148 | - file = ia->ia_file; | |
149 | + if (file) | |
150 | fi_write_lock(file); | |
151 | - ia->ia_file = au_h_fptr(file, au_fbstart(file)); | |
152 | - } | |
153 | ||
154 | sz = -1; | |
155 | if ((ia->ia_valid & ATTR_SIZE) | |
156 | @@ -800,11 +796,8 @@ static int aufs_setattr(struct dentry *d | |
157 | au_unpin(&a->pin); | |
158 | di_write_unlock(dentry); | |
159 | out_si: | |
160 | - if (file) { | |
161 | + if (file) | |
162 | fi_write_unlock(file); | |
163 | - ia->ia_file = file; | |
164 | - ia->ia_valid |= ATTR_FILE; | |
165 | - } | |
166 | si_read_unlock(sb); | |
167 | kfree(a); | |
168 | out: | |
169 | @@ -812,6 +805,16 @@ static int aufs_setattr(struct dentry *d | |
170 | return err; | |
171 | } | |
172 | ||
173 | +static int aufs_setattr(struct dentry *dentry, struct iattr *ia) | |
174 | +{ | |
175 | + return aufs_do_setattr(dentry, ia, NULL); | |
176 | +} | |
177 | + | |
178 | +int aufs_fsetattr(struct file *file, struct iattr *ia) | |
179 | +{ | |
180 | + return aufs_do_setattr(file->f_dentry, ia, file); | |
181 | +} | |
182 | + | |
183 | /* ---------------------------------------------------------------------- */ | |
184 | ||
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 | |
189 | ||
190 | /* i_op.c */ | |
191 | extern struct inode_operations aufs_iop, aufs_symlink_iop, aufs_dir_iop; | |
192 | +int aufs_fsetattr(struct file *file, struct iattr *ia); | |
193 | ||
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 | |
199 | if (err == 1) { | |
200 | ia = (void *)buf; | |
201 | ia->ia_size = dst->f_pos; | |
202 | - ia->ia_valid = ATTR_SIZE | ATTR_FILE; | |
203 | - ia->ia_file = dst; | |
204 | + ia->ia_valid = ATTR_SIZE; | |
205 | vfsub_args_reinit(vargs); | |
206 | vfsub_ign_hinode(vargs, vfsub_events_notify_change(ia), | |
207 | hdir); | |
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); | |
212 | } | |
213 | } | |
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; | |
218 | struct iattr *ia; | |
219 | struct vfsub_args *vargs; | |
220 | + struct file *file; | |
221 | }; | |
222 | ||
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); | |
227 | lockdep_off(); | |
228 | - *a->errp = notify_change(a->h_dentry, NULL, a->ia); | |
229 | + *a->errp = fnotify_change(a->h_dentry, NULL, a->ia, a->file); | |
230 | lockdep_on(); | |
231 | if (!*a->errp) | |
232 | au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/ | |
233 | @@ -525,8 +526,8 @@ static void vfsub_notify_change_dlgt(str | |
234 | } | |
235 | #endif | |
236 | ||
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) | |
241 | { | |
242 | int err; | |
243 | struct notify_change_args args = { | |
244 | @@ -570,6 +571,12 @@ int vfsub_sio_notify_change(struct au_hi | |
245 | return err; | |
246 | } | |
247 | ||
248 | +int vfsub_notify_change(struct dentry *dentry, struct iattr *ia, | |
249 | + struct vfsub_args *vargs) | |
250 | +{ | |
251 | + return vfsub_fnotify_change(dentry, ia, vargs, NULL); | |
252 | +} | |
253 | + | |
254 | /* ---------------------------------------------------------------------- */ | |
255 | ||
256 | struct unlink_args { | |
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 | |
260 | ||
261 | /* ---------------------------------------------------------------------- */ | |
262 | ||
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, |