diff options
author | KaiGai Kohei <kaigai@ak.jp.nec.com> | 2007-09-14 02:16:35 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-10-20 09:10:54 -0400 |
commit | cfc8dc6f6f69ede939e09c2af06a01adee577285 (patch) | |
tree | a37149d6353fb4b911beb5ad4ad18f2ec2b1468a /fs | |
parent | e8b8c977734193adedf2b0f607d6252c78e86394 (diff) |
[JFFS2] Tidy up fix for ACL/permissions problem.
[In commit 9ed437c50d89eabae763dd422579f73fdebf288d we fixed a problem
with standard permissions on newly-created inodes, when POSIX ACLs are
enabled. This cleans it up...]
The attached patch separate jffs2_init_acl() into two parts.
The one is jffs2_init_acl_pre() called from jffs2_new_inode().
It compute ACL oriented inode->i_mode bits, and allocate in-memory ACL
objects associated with the new inode just before when inode meta
infomation is written to the medium.
The other is jffs2_init_acl_post() called from jffs2_symlink(),
jffs2_mkdir(), jffs2_mknod() and jffs2_do_create().
It actually writes in-memory ACL objects into the medium next to
the success of writing meta-information.
In the current implementation, we have to write a same inode meta
infomation twice when inode->i_mode is updated by the default ACL.
However, we can avoid the behavior by putting an updated i_mode
before it is written at first, as jffs2_init_acl_pre() doing.
Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/acl.c | 101 | ||||
-rw-r--r-- | fs/jffs2/acl.h | 12 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 35 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 21 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 4 | ||||
-rw-r--r-- | fs/jffs2/write.c | 8 |
6 files changed, 94 insertions, 87 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 8ec9323e830a..9728614b8958 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -228,11 +228,28 @@ struct posix_acl *jffs2_get_acl(struct inode *inode, int type) | |||
228 | return acl; | 228 | return acl; |
229 | } | 229 | } |
230 | 230 | ||
231 | static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *acl) | ||
232 | { | ||
233 | char *value = NULL; | ||
234 | size_t size = 0; | ||
235 | int rc; | ||
236 | |||
237 | if (acl) { | ||
238 | value = jffs2_acl_to_medium(acl, &size); | ||
239 | if (IS_ERR(value)) | ||
240 | return PTR_ERR(value); | ||
241 | } | ||
242 | rc = do_jffs2_setxattr(inode, xprefix, "", value, size, 0); | ||
243 | if (!value && rc == -ENODATA) | ||
244 | rc = 0; | ||
245 | kfree(value); | ||
246 | |||
247 | return rc; | ||
248 | } | ||
249 | |||
231 | static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | 250 | static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) |
232 | { | 251 | { |
233 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 252 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
234 | size_t size = 0; | ||
235 | char *value = NULL; | ||
236 | int rc, xprefix; | 253 | int rc, xprefix; |
237 | 254 | ||
238 | if (S_ISLNK(inode->i_mode)) | 255 | if (S_ISLNK(inode->i_mode)) |
@@ -267,17 +284,7 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
267 | default: | 284 | default: |
268 | return -EINVAL; | 285 | return -EINVAL; |
269 | } | 286 | } |
270 | if (acl) { | 287 | rc = __jffs2_set_acl(inode, xprefix, acl); |
271 | value = jffs2_acl_to_medium(acl, &size); | ||
272 | if (IS_ERR(value)) | ||
273 | return PTR_ERR(value); | ||
274 | } | ||
275 | |||
276 | rc = do_jffs2_setxattr(inode, xprefix, "", value, size, 0); | ||
277 | if (!value && rc == -ENODATA) | ||
278 | rc = 0; | ||
279 | if (value) | ||
280 | kfree(value); | ||
281 | if (!rc) { | 288 | if (!rc) { |
282 | switch(type) { | 289 | switch(type) { |
283 | case ACL_TYPE_ACCESS: | 290 | case ACL_TYPE_ACCESS: |
@@ -312,37 +319,59 @@ int jffs2_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
312 | return generic_permission(inode, mask, jffs2_check_acl); | 319 | return generic_permission(inode, mask, jffs2_check_acl); |
313 | } | 320 | } |
314 | 321 | ||
315 | int jffs2_init_acl(struct inode *inode, struct posix_acl *acl) | 322 | int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode) |
316 | { | 323 | { |
317 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 324 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
318 | struct posix_acl *clone; | 325 | struct posix_acl *acl, *clone; |
319 | mode_t mode; | 326 | int rc; |
320 | int rc = 0; | ||
321 | 327 | ||
322 | f->i_acl_access = JFFS2_ACL_NOT_CACHED; | 328 | f->i_acl_default = NULL; |
323 | f->i_acl_default = JFFS2_ACL_NOT_CACHED; | 329 | f->i_acl_access = NULL; |
330 | |||
331 | if (S_ISLNK(*i_mode)) | ||
332 | return 0; /* Symlink always has no-ACL */ | ||
333 | |||
334 | acl = jffs2_get_acl(dir_i, ACL_TYPE_DEFAULT); | ||
335 | if (IS_ERR(acl)) | ||
336 | return PTR_ERR(acl); | ||
337 | |||
338 | if (!acl) { | ||
339 | *i_mode &= ~current->fs->umask; | ||
340 | } else { | ||
341 | if (S_ISDIR(*i_mode)) | ||
342 | jffs2_iset_acl(inode, &f->i_acl_default, acl); | ||
324 | 343 | ||
325 | if (acl) { | ||
326 | if (S_ISDIR(inode->i_mode)) { | ||
327 | rc = jffs2_set_acl(inode, ACL_TYPE_DEFAULT, acl); | ||
328 | if (rc) | ||
329 | goto cleanup; | ||
330 | } | ||
331 | clone = posix_acl_clone(acl, GFP_KERNEL); | 344 | clone = posix_acl_clone(acl, GFP_KERNEL); |
332 | rc = -ENOMEM; | ||
333 | if (!clone) | 345 | if (!clone) |
334 | goto cleanup; | 346 | return -ENOMEM; |
335 | mode = inode->i_mode; | 347 | rc = posix_acl_create_masq(clone, (mode_t *)i_mode); |
336 | rc = posix_acl_create_masq(clone, &mode); | 348 | if (rc < 0) |
337 | if (rc >= 0) { | 349 | return rc; |
338 | inode->i_mode = mode; | 350 | if (rc > 0) |
339 | if (rc > 0) | 351 | jffs2_iset_acl(inode, &f->i_acl_access, clone); |
340 | rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, clone); | 352 | |
341 | } | ||
342 | posix_acl_release(clone); | 353 | posix_acl_release(clone); |
343 | } | 354 | } |
344 | cleanup: | 355 | return 0; |
345 | posix_acl_release(acl); | 356 | } |
357 | |||
358 | int jffs2_init_acl_post(struct inode *inode) | ||
359 | { | ||
360 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | ||
361 | int rc; | ||
362 | |||
363 | if (f->i_acl_default) { | ||
364 | rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, f->i_acl_default); | ||
365 | if (rc) | ||
366 | return rc; | ||
367 | } | ||
368 | |||
369 | if (f->i_acl_access) { | ||
370 | rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, f->i_acl_access); | ||
371 | if (rc) | ||
372 | return rc; | ||
373 | } | ||
374 | |||
346 | return rc; | 375 | return rc; |
347 | } | 376 | } |
348 | 377 | ||
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 90a2dbf59051..76c6ebd1acd9 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h | |||
@@ -31,7 +31,8 @@ struct jffs2_acl_header { | |||
31 | extern struct posix_acl *jffs2_get_acl(struct inode *inode, int type); | 31 | extern struct posix_acl *jffs2_get_acl(struct inode *inode, int type); |
32 | extern int jffs2_permission(struct inode *, int, struct nameidata *); | 32 | extern int jffs2_permission(struct inode *, int, struct nameidata *); |
33 | extern int jffs2_acl_chmod(struct inode *); | 33 | extern int jffs2_acl_chmod(struct inode *); |
34 | extern int jffs2_init_acl(struct inode *, struct posix_acl *); | 34 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, int *); |
35 | extern int jffs2_init_acl_post(struct inode *); | ||
35 | extern void jffs2_clear_acl(struct jffs2_inode_info *); | 36 | extern void jffs2_clear_acl(struct jffs2_inode_info *); |
36 | 37 | ||
37 | extern struct xattr_handler jffs2_acl_access_xattr_handler; | 38 | extern struct xattr_handler jffs2_acl_access_xattr_handler; |
@@ -39,10 +40,11 @@ extern struct xattr_handler jffs2_acl_default_xattr_handler; | |||
39 | 40 | ||
40 | #else | 41 | #else |
41 | 42 | ||
42 | #define jffs2_get_acl(inode, type) (NULL) | 43 | #define jffs2_get_acl(inode, type) (NULL) |
43 | #define jffs2_permission NULL | 44 | #define jffs2_permission (NULL) |
44 | #define jffs2_acl_chmod(inode) (0) | 45 | #define jffs2_acl_chmod(inode) (0) |
45 | #define jffs2_init_acl(inode,dir) (0) | 46 | #define jffs2_init_acl_pre(dir_i,inode,mode) (0) |
47 | #define jffs2_init_acl_post(inode) (0) | ||
46 | #define jffs2_clear_acl(f) | 48 | #define jffs2_clear_acl(f) |
47 | 49 | ||
48 | #endif /* CONFIG_JFFS2_FS_POSIX_ACL */ | 50 | #endif /* CONFIG_JFFS2_FS_POSIX_ACL */ |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 8353eb9c1799..787e392ffd41 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -182,7 +182,6 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
182 | struct jffs2_inode_info *f, *dir_f; | 182 | struct jffs2_inode_info *f, *dir_f; |
183 | struct jffs2_sb_info *c; | 183 | struct jffs2_sb_info *c; |
184 | struct inode *inode; | 184 | struct inode *inode; |
185 | struct posix_acl *acl; | ||
186 | int ret; | 185 | int ret; |
187 | 186 | ||
188 | ri = jffs2_alloc_raw_inode(); | 187 | ri = jffs2_alloc_raw_inode(); |
@@ -193,7 +192,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
193 | 192 | ||
194 | D1(printk(KERN_DEBUG "jffs2_create()\n")); | 193 | D1(printk(KERN_DEBUG "jffs2_create()\n")); |
195 | 194 | ||
196 | inode = jffs2_new_inode(dir_i, mode, ri, &acl); | 195 | inode = jffs2_new_inode(dir_i, mode, ri); |
197 | 196 | ||
198 | if (IS_ERR(inode)) { | 197 | if (IS_ERR(inode)) { |
199 | D1(printk(KERN_DEBUG "jffs2_new_inode() failed\n")); | 198 | D1(printk(KERN_DEBUG "jffs2_new_inode() failed\n")); |
@@ -211,14 +210,6 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
211 | 210 | ||
212 | ret = jffs2_do_create(c, dir_f, f, ri, | 211 | ret = jffs2_do_create(c, dir_f, f, ri, |
213 | dentry->d_name.name, dentry->d_name.len); | 212 | dentry->d_name.name, dentry->d_name.len); |
214 | |||
215 | if (ret) | ||
216 | goto fail_acl; | ||
217 | |||
218 | ret = jffs2_init_security(inode, dir_i); | ||
219 | if (ret) | ||
220 | goto fail_acl; | ||
221 | ret = jffs2_init_acl(inode, acl); | ||
222 | if (ret) | 213 | if (ret) |
223 | goto fail; | 214 | goto fail; |
224 | 215 | ||
@@ -231,8 +222,6 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
231 | inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages)); | 222 | inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages)); |
232 | return 0; | 223 | return 0; |
233 | 224 | ||
234 | fail_acl: | ||
235 | posix_acl_release(acl); | ||
236 | fail: | 225 | fail: |
237 | make_bad_inode(inode); | 226 | make_bad_inode(inode); |
238 | iput(inode); | 227 | iput(inode); |
@@ -309,7 +298,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
309 | struct jffs2_full_dirent *fd; | 298 | struct jffs2_full_dirent *fd; |
310 | int namelen; | 299 | int namelen; |
311 | uint32_t alloclen; | 300 | uint32_t alloclen; |
312 | struct posix_acl *acl; | ||
313 | int ret, targetlen = strlen(target); | 301 | int ret, targetlen = strlen(target); |
314 | 302 | ||
315 | /* FIXME: If you care. We'd need to use frags for the target | 303 | /* FIXME: If you care. We'd need to use frags for the target |
@@ -336,7 +324,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
336 | return ret; | 324 | return ret; |
337 | } | 325 | } |
338 | 326 | ||
339 | inode = jffs2_new_inode(dir_i, S_IFLNK | S_IRWXUGO, ri, &acl); | 327 | inode = jffs2_new_inode(dir_i, S_IFLNK | S_IRWXUGO, ri); |
340 | 328 | ||
341 | if (IS_ERR(inode)) { | 329 | if (IS_ERR(inode)) { |
342 | jffs2_free_raw_inode(ri); | 330 | jffs2_free_raw_inode(ri); |
@@ -366,7 +354,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
366 | up(&f->sem); | 354 | up(&f->sem); |
367 | jffs2_complete_reservation(c); | 355 | jffs2_complete_reservation(c); |
368 | jffs2_clear_inode(inode); | 356 | jffs2_clear_inode(inode); |
369 | posix_acl_release(acl); | ||
370 | return PTR_ERR(fn); | 357 | return PTR_ERR(fn); |
371 | } | 358 | } |
372 | 359 | ||
@@ -377,7 +364,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
377 | up(&f->sem); | 364 | up(&f->sem); |
378 | jffs2_complete_reservation(c); | 365 | jffs2_complete_reservation(c); |
379 | jffs2_clear_inode(inode); | 366 | jffs2_clear_inode(inode); |
380 | posix_acl_release(acl); | ||
381 | return -ENOMEM; | 367 | return -ENOMEM; |
382 | } | 368 | } |
383 | 369 | ||
@@ -395,10 +381,9 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
395 | ret = jffs2_init_security(inode, dir_i); | 381 | ret = jffs2_init_security(inode, dir_i); |
396 | if (ret) { | 382 | if (ret) { |
397 | jffs2_clear_inode(inode); | 383 | jffs2_clear_inode(inode); |
398 | posix_acl_release(acl); | ||
399 | return ret; | 384 | return ret; |
400 | } | 385 | } |
401 | ret = jffs2_init_acl(inode, acl); | 386 | ret = jffs2_init_acl_post(inode); |
402 | if (ret) { | 387 | if (ret) { |
403 | jffs2_clear_inode(inode); | 388 | jffs2_clear_inode(inode); |
404 | return ret; | 389 | return ret; |
@@ -476,7 +461,6 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
476 | struct jffs2_full_dirent *fd; | 461 | struct jffs2_full_dirent *fd; |
477 | int namelen; | 462 | int namelen; |
478 | uint32_t alloclen; | 463 | uint32_t alloclen; |
479 | struct posix_acl *acl; | ||
480 | int ret; | 464 | int ret; |
481 | 465 | ||
482 | mode |= S_IFDIR; | 466 | mode |= S_IFDIR; |
@@ -499,7 +483,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
499 | return ret; | 483 | return ret; |
500 | } | 484 | } |
501 | 485 | ||
502 | inode = jffs2_new_inode(dir_i, mode, ri, &acl); | 486 | inode = jffs2_new_inode(dir_i, mode, ri); |
503 | 487 | ||
504 | if (IS_ERR(inode)) { | 488 | if (IS_ERR(inode)) { |
505 | jffs2_free_raw_inode(ri); | 489 | jffs2_free_raw_inode(ri); |
@@ -526,7 +510,6 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
526 | up(&f->sem); | 510 | up(&f->sem); |
527 | jffs2_complete_reservation(c); | 511 | jffs2_complete_reservation(c); |
528 | jffs2_clear_inode(inode); | 512 | jffs2_clear_inode(inode); |
529 | posix_acl_release(acl); | ||
530 | return PTR_ERR(fn); | 513 | return PTR_ERR(fn); |
531 | } | 514 | } |
532 | /* No data here. Only a metadata node, which will be | 515 | /* No data here. Only a metadata node, which will be |
@@ -540,10 +523,9 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
540 | ret = jffs2_init_security(inode, dir_i); | 523 | ret = jffs2_init_security(inode, dir_i); |
541 | if (ret) { | 524 | if (ret) { |
542 | jffs2_clear_inode(inode); | 525 | jffs2_clear_inode(inode); |
543 | posix_acl_release(acl); | ||
544 | return ret; | 526 | return ret; |
545 | } | 527 | } |
546 | ret = jffs2_init_acl(inode, acl); | 528 | ret = jffs2_init_acl_post(inode); |
547 | if (ret) { | 529 | if (ret) { |
548 | jffs2_clear_inode(inode); | 530 | jffs2_clear_inode(inode); |
549 | return ret; | 531 | return ret; |
@@ -639,7 +621,6 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
639 | union jffs2_device_node dev; | 621 | union jffs2_device_node dev; |
640 | int devlen = 0; | 622 | int devlen = 0; |
641 | uint32_t alloclen; | 623 | uint32_t alloclen; |
642 | struct posix_acl *acl; | ||
643 | int ret; | 624 | int ret; |
644 | 625 | ||
645 | if (!new_valid_dev(rdev)) | 626 | if (!new_valid_dev(rdev)) |
@@ -666,7 +647,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
666 | return ret; | 647 | return ret; |
667 | } | 648 | } |
668 | 649 | ||
669 | inode = jffs2_new_inode(dir_i, mode, ri, &acl); | 650 | inode = jffs2_new_inode(dir_i, mode, ri); |
670 | 651 | ||
671 | if (IS_ERR(inode)) { | 652 | if (IS_ERR(inode)) { |
672 | jffs2_free_raw_inode(ri); | 653 | jffs2_free_raw_inode(ri); |
@@ -695,7 +676,6 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
695 | up(&f->sem); | 676 | up(&f->sem); |
696 | jffs2_complete_reservation(c); | 677 | jffs2_complete_reservation(c); |
697 | jffs2_clear_inode(inode); | 678 | jffs2_clear_inode(inode); |
698 | posix_acl_release(acl); | ||
699 | return PTR_ERR(fn); | 679 | return PTR_ERR(fn); |
700 | } | 680 | } |
701 | /* No data here. Only a metadata node, which will be | 681 | /* No data here. Only a metadata node, which will be |
@@ -709,10 +689,9 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de | |||
709 | ret = jffs2_init_security(inode, dir_i); | 689 | ret = jffs2_init_security(inode, dir_i); |
710 | if (ret) { | 690 | if (ret) { |
711 | jffs2_clear_inode(inode); | 691 | jffs2_clear_inode(inode); |
712 | posix_acl_release(acl); | ||
713 | return ret; | 692 | return ret; |
714 | } | 693 | } |
715 | ret = jffs2_init_acl(inode, acl); | 694 | ret = jffs2_init_acl_post(inode); |
716 | if (ret) { | 695 | if (ret) { |
717 | jffs2_clear_inode(inode); | 696 | jffs2_clear_inode(inode); |
718 | return ret; | 697 | return ret; |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index ed85f9afdbc8..d2e06f7ea96f 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -402,8 +402,7 @@ void jffs2_write_super (struct super_block *sb) | |||
402 | 402 | ||
403 | /* jffs2_new_inode: allocate a new inode and inocache, add it to the hash, | 403 | /* jffs2_new_inode: allocate a new inode and inocache, add it to the hash, |
404 | fill in the raw_inode while you're at it. */ | 404 | fill in the raw_inode while you're at it. */ |
405 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_inode *ri, | 405 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_inode *ri) |
406 | struct posix_acl **acl) | ||
407 | { | 406 | { |
408 | struct inode *inode; | 407 | struct inode *inode; |
409 | struct super_block *sb = dir_i->i_sb; | 408 | struct super_block *sb = dir_i->i_sb; |
@@ -438,19 +437,11 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i | |||
438 | 437 | ||
439 | /* POSIX ACLs have to be processed now, at least partly. | 438 | /* POSIX ACLs have to be processed now, at least partly. |
440 | The umask is only applied if there's no default ACL */ | 439 | The umask is only applied if there's no default ACL */ |
441 | if (!S_ISLNK(mode)) { | 440 | ret = jffs2_init_acl_pre(dir_i, inode, &mode); |
442 | *acl = jffs2_get_acl(dir_i, ACL_TYPE_DEFAULT); | 441 | if (ret) { |
443 | if (IS_ERR(*acl)) { | 442 | make_bad_inode(inode); |
444 | make_bad_inode(inode); | 443 | iput(inode); |
445 | iput(inode); | 444 | return ERR_PTR(ret); |
446 | inode = (void *)*acl; | ||
447 | *acl = NULL; | ||
448 | return inode; | ||
449 | } | ||
450 | if (!(*acl)) | ||
451 | mode &= ~current->fs->umask; | ||
452 | } else { | ||
453 | *acl = NULL; | ||
454 | } | 445 | } |
455 | ret = jffs2_do_new_inode (c, f, mode, ri); | 446 | ret = jffs2_do_new_inode (c, f, mode, ri); |
456 | if (ret) { | 447 | if (ret) { |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index f6743a915cf3..bf64686cf098 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -173,15 +173,13 @@ int jffs2_ioctl(struct inode *, struct file *, unsigned int, unsigned long); | |||
173 | extern const struct inode_operations jffs2_symlink_inode_operations; | 173 | extern const struct inode_operations jffs2_symlink_inode_operations; |
174 | 174 | ||
175 | /* fs.c */ | 175 | /* fs.c */ |
176 | struct posix_acl; | ||
177 | |||
178 | int jffs2_setattr (struct dentry *, struct iattr *); | 176 | int jffs2_setattr (struct dentry *, struct iattr *); |
179 | int jffs2_do_setattr (struct inode *, struct iattr *); | 177 | int jffs2_do_setattr (struct inode *, struct iattr *); |
180 | void jffs2_read_inode (struct inode *); | 178 | void jffs2_read_inode (struct inode *); |
181 | void jffs2_clear_inode (struct inode *); | 179 | void jffs2_clear_inode (struct inode *); |
182 | void jffs2_dirty_inode(struct inode *inode); | 180 | void jffs2_dirty_inode(struct inode *inode); |
183 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, | 181 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, |
184 | struct jffs2_raw_inode *ri, struct posix_acl **acl); | 182 | struct jffs2_raw_inode *ri); |
185 | int jffs2_statfs (struct dentry *, struct kstatfs *); | 183 | int jffs2_statfs (struct dentry *, struct kstatfs *); |
186 | void jffs2_write_super (struct super_block *); | 184 | void jffs2_write_super (struct super_block *); |
187 | int jffs2_remount_fs (struct super_block *, int *, char *); | 185 | int jffs2_remount_fs (struct super_block *, int *, char *); |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 2f5695446d0f..147e2cbee9e4 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -465,6 +465,14 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
465 | 465 | ||
466 | up(&f->sem); | 466 | up(&f->sem); |
467 | jffs2_complete_reservation(c); | 467 | jffs2_complete_reservation(c); |
468 | |||
469 | ret = jffs2_init_security(&f->vfs_inode, &dir_f->vfs_inode); | ||
470 | if (ret) | ||
471 | return ret; | ||
472 | ret = jffs2_init_acl_post(&f->vfs_inode); | ||
473 | if (ret) | ||
474 | return ret; | ||
475 | |||
468 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, | 476 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
469 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 477 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
470 | 478 | ||