aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 15:53:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 15:53:15 -0400
commit0003230e8200699860f0b10af524dc47bf8aecad (patch)
tree8addb0c889b32111d6973c46cd3d0a5b5c17606c /fs/reiserfs
parent4b478cedcdc1b2d131170f22bd3f916e53472f52 (diff)
parent4e34e719e457f2e031297175410fc0bd4016a085 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: fs: take the ACL checks to common code bury posix_acl_..._masq() variants kill boilerplates around posix_acl_create_masq() generic_acl: no need to clone acl just to push it to set_cached_acl() kill boilerplate around posix_acl_chmod_masq() reiserfs: cache negative ACLs for v1 stat format xfs: cache negative ACLs if there is no attribute fork 9p: do no return 0 from ->check_acl without actually checking vfs: move ACL cache lookup into generic code CIFS: Fix oops while mounting with prefixpath xfs: Fix wrong return value of xfs_file_aio_write fix devtmpfs race caam: don't pass bogus S_IFCHR to debugfs_create_...() get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose asus-wmi: ->is_visible() can't return negative fix jffs2 ACLs on big-endian with 16bit mode_t 9p: close ACL leaks ocfs2_init_acl(): fix a leak VFS : mount lock scalability for internal mounts
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/reiserfs/inode.c5
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/reiserfs/xattr.c27
-rw-r--r--fs/reiserfs/xattr_acl.c71
5 files changed, 34 insertions, 77 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index c7156dc39ce7..ace635053a36 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -319,5 +319,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
319 .listxattr = reiserfs_listxattr, 319 .listxattr = reiserfs_listxattr,
320 .removexattr = reiserfs_removexattr, 320 .removexattr = reiserfs_removexattr,
321 .permission = reiserfs_permission, 321 .permission = reiserfs_permission,
322 .check_acl = reiserfs_check_acl, 322 .get_acl = reiserfs_get_acl,
323}; 323};
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2922b90ceac1..9b0d4b78b4fb 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1475,6 +1475,11 @@ void reiserfs_read_locked_inode(struct inode *inode,
1475 1475
1476 reiserfs_check_path(&path_to_sd); /* init inode should be relsing */ 1476 reiserfs_check_path(&path_to_sd); /* init inode should be relsing */
1477 1477
1478 /*
1479 * Stat data v1 doesn't support ACLs.
1480 */
1481 if (get_inode_sd_version(inode) == STAT_DATA_V1)
1482 cache_no_acl(inode);
1478} 1483}
1479 1484
1480/** 1485/**
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 551f1b79dbc4..ef392324bbf1 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1529,7 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
1529 .listxattr = reiserfs_listxattr, 1529 .listxattr = reiserfs_listxattr,
1530 .removexattr = reiserfs_removexattr, 1530 .removexattr = reiserfs_removexattr,
1531 .permission = reiserfs_permission, 1531 .permission = reiserfs_permission,
1532 .check_acl = reiserfs_check_acl, 1532 .get_acl = reiserfs_get_acl,
1533}; 1533};
1534 1534
1535/* 1535/*
@@ -1546,7 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
1546 .listxattr = reiserfs_listxattr, 1546 .listxattr = reiserfs_listxattr,
1547 .removexattr = reiserfs_removexattr, 1547 .removexattr = reiserfs_removexattr,
1548 .permission = reiserfs_permission, 1548 .permission = reiserfs_permission,
1549 .check_acl = reiserfs_check_acl, 1549 .get_acl = reiserfs_get_acl,
1550 1550
1551}; 1551};
1552 1552
@@ -1560,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
1560 .listxattr = reiserfs_listxattr, 1560 .listxattr = reiserfs_listxattr,
1561 .removexattr = reiserfs_removexattr, 1561 .removexattr = reiserfs_removexattr,
1562 .permission = reiserfs_permission, 1562 .permission = reiserfs_permission,
1563 .check_acl = reiserfs_check_acl, 1563 .get_acl = reiserfs_get_acl,
1564}; 1564};
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 6938d8c68d6e..6bc346c160e7 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -867,33 +867,6 @@ out:
867 return err; 867 return err;
868} 868}
869 869
870int reiserfs_check_acl(struct inode *inode, int mask)
871{
872 struct posix_acl *acl;
873 int error = -EAGAIN; /* do regular unix permission checks by default */
874
875 /*
876 * Stat data v1 doesn't support ACLs.
877 */
878 if (get_inode_sd_version(inode) == STAT_DATA_V1)
879 return -EAGAIN;
880
881 if (mask & MAY_NOT_BLOCK)
882 return -ECHILD;
883
884 acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
885
886 if (acl) {
887 if (!IS_ERR(acl)) {
888 error = posix_acl_permission(inode, acl, mask);
889 posix_acl_release(acl);
890 } else if (PTR_ERR(acl) != -ENODATA)
891 error = PTR_ERR(acl);
892 }
893
894 return error;
895}
896
897static int create_privroot(struct dentry *dentry) 870static int create_privroot(struct dentry *dentry)
898{ 871{
899 int err; 872 int err;
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 3dc38f1206fc..7362cf4c946a 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -354,9 +354,7 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
354 return PTR_ERR(acl); 354 return PTR_ERR(acl);
355 355
356 if (acl) { 356 if (acl) {
357 struct posix_acl *acl_copy;
358 mode_t mode = inode->i_mode; 357 mode_t mode = inode->i_mode;
359 int need_acl;
360 358
361 /* Copy the default ACL to the default ACL of a new directory */ 359 /* Copy the default ACL to the default ACL of a new directory */
362 if (S_ISDIR(inode->i_mode)) { 360 if (S_ISDIR(inode->i_mode)) {
@@ -368,29 +366,15 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
368 366
369 /* Now we reconcile the new ACL and the mode, 367 /* Now we reconcile the new ACL and the mode,
370 potentially modifying both */ 368 potentially modifying both */
371 acl_copy = posix_acl_clone(acl, GFP_NOFS); 369 err = posix_acl_create(&acl, GFP_NOFS, &mode);
372 if (!acl_copy) { 370 if (err < 0)
373 err = -ENOMEM; 371 return err;
374 goto cleanup;
375 }
376 372
377 need_acl = posix_acl_create_masq(acl_copy, &mode); 373 inode->i_mode = mode;
378 if (need_acl >= 0) {
379 if (mode != inode->i_mode) {
380 inode->i_mode = mode;
381 }
382 374
383 /* If we need an ACL.. */ 375 /* If we need an ACL.. */
384 if (need_acl > 0) { 376 if (err > 0)
385 err = reiserfs_set_acl(th, inode, 377 err = reiserfs_set_acl(th, inode, ACL_TYPE_ACCESS, acl);
386 ACL_TYPE_ACCESS,
387 acl_copy);
388 if (err)
389 goto cleanup_copy;
390 }
391 }
392 cleanup_copy:
393 posix_acl_release(acl_copy);
394 cleanup: 378 cleanup:
395 posix_acl_release(acl); 379 posix_acl_release(acl);
396 } else { 380 } else {
@@ -445,7 +429,10 @@ int reiserfs_cache_default_acl(struct inode *inode)
445 429
446int reiserfs_acl_chmod(struct inode *inode) 430int reiserfs_acl_chmod(struct inode *inode)
447{ 431{
448 struct posix_acl *acl, *clone; 432 struct reiserfs_transaction_handle th;
433 struct posix_acl *acl;
434 size_t size;
435 int depth;
449 int error; 436 int error;
450 437
451 if (S_ISLNK(inode->i_mode)) 438 if (S_ISLNK(inode->i_mode))
@@ -463,30 +450,22 @@ int reiserfs_acl_chmod(struct inode *inode)
463 return 0; 450 return 0;
464 if (IS_ERR(acl)) 451 if (IS_ERR(acl))
465 return PTR_ERR(acl); 452 return PTR_ERR(acl);
466 clone = posix_acl_clone(acl, GFP_NOFS); 453 error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
467 posix_acl_release(acl); 454 if (error)
468 if (!clone) 455 return error;
469 return -ENOMEM; 456
470 error = posix_acl_chmod_masq(clone, inode->i_mode); 457 size = reiserfs_xattr_nblocks(inode, reiserfs_acl_size(acl->a_count));
458 depth = reiserfs_write_lock_once(inode->i_sb);
459 error = journal_begin(&th, inode->i_sb, size * 2);
471 if (!error) { 460 if (!error) {
472 struct reiserfs_transaction_handle th; 461 int error2;
473 size_t size = reiserfs_xattr_nblocks(inode, 462 error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS, acl);
474 reiserfs_acl_size(clone->a_count)); 463 error2 = journal_end(&th, inode->i_sb, size * 2);
475 int depth; 464 if (error2)
476 465 error = error2;
477 depth = reiserfs_write_lock_once(inode->i_sb);
478 error = journal_begin(&th, inode->i_sb, size * 2);
479 if (!error) {
480 int error2;
481 error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS,
482 clone);
483 error2 = journal_end(&th, inode->i_sb, size * 2);
484 if (error2)
485 error = error2;
486 }
487 reiserfs_write_unlock_once(inode->i_sb, depth);
488 } 466 }
489 posix_acl_release(clone); 467 reiserfs_write_unlock_once(inode->i_sb, depth);
468 posix_acl_release(acl);
490 return error; 469 return error;
491} 470}
492 471