aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 11:38:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 11:38:04 -0500
commitbf3d846b783327359ddc4bd4f52627b36abb4d1d (patch)
treec6b8fddbf04a2962dfcf9f487af25033f11b10b9 /fs/gfs2/inode.c
parent54c0a4b46150db1571d955d598cd342c9f1d9657 (diff)
parentf6500801522c61782d4990fa1ad96154cb397cd4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "Assorted stuff; the biggest pile here is Christoph's ACL series. Plus assorted cleanups and fixes all over the place... There will be another pile later this week" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (43 commits) __dentry_path() fixes vfs: Remove second variable named error in __dentry_path vfs: Is mounted should be testing mnt_ns for NULL or error. Fix race when checking i_size on direct i/o read hfsplus: remove can_set_xattr nfsd: use get_acl and ->set_acl fs: remove generic_acl nfs: use generic posix ACL infrastructure for v3 Posix ACLs gfs2: use generic posix ACL infrastructure jfs: use generic posix ACL infrastructure xfs: use generic posix ACL infrastructure reiserfs: use generic posix ACL infrastructure ocfs2: use generic posix ACL infrastructure jffs2: use generic posix ACL infrastructure hfsplus: use generic posix ACL infrastructure f2fs: use generic posix ACL infrastructure ext2/3/4: use generic posix ACL infrastructure btrfs: use generic posix ACL infrastructure fs: make posix_acl_create more useful fs: make posix_acl_chmod more useful ...
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 890588c7fb33..5c524180c98e 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -571,6 +571,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
571 unsigned int size, int excl, int *opened) 571 unsigned int size, int excl, int *opened)
572{ 572{
573 const struct qstr *name = &dentry->d_name; 573 const struct qstr *name = &dentry->d_name;
574 struct posix_acl *default_acl, *acl;
574 struct gfs2_holder ghs[2]; 575 struct gfs2_holder ghs[2];
575 struct inode *inode = NULL; 576 struct inode *inode = NULL;
576 struct gfs2_inode *dip = GFS2_I(dir), *ip; 577 struct gfs2_inode *dip = GFS2_I(dir), *ip;
@@ -633,10 +634,14 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
633 if (!inode) 634 if (!inode)
634 goto fail_gunlock; 635 goto fail_gunlock;
635 636
637 error = posix_acl_create(dir, &mode, &default_acl, &acl);
638 if (error)
639 goto fail_free_vfs_inode;
640
636 ip = GFS2_I(inode); 641 ip = GFS2_I(inode);
637 error = gfs2_rs_alloc(ip); 642 error = gfs2_rs_alloc(ip);
638 if (error) 643 if (error)
639 goto fail_free_inode; 644 goto fail_free_acls;
640 645
641 inode->i_mode = mode; 646 inode->i_mode = mode;
642 set_nlink(inode, S_ISDIR(mode) ? 2 : 1); 647 set_nlink(inode, S_ISDIR(mode) ? 2 : 1);
@@ -704,7 +709,16 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
704 gfs2_set_iop(inode); 709 gfs2_set_iop(inode);
705 insert_inode_hash(inode); 710 insert_inode_hash(inode);
706 711
707 error = gfs2_acl_create(dip, inode); 712 if (default_acl) {
713 error = gfs2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
714 posix_acl_release(default_acl);
715 }
716 if (acl) {
717 if (!error)
718 error = gfs2_set_acl(inode, acl, ACL_TYPE_ACCESS);
719 posix_acl_release(acl);
720 }
721
708 if (error) 722 if (error)
709 goto fail_gunlock3; 723 goto fail_gunlock3;
710 724
@@ -738,6 +752,12 @@ fail_free_inode:
738 if (ip->i_gl) 752 if (ip->i_gl)
739 gfs2_glock_put(ip->i_gl); 753 gfs2_glock_put(ip->i_gl);
740 gfs2_rs_delete(ip, NULL); 754 gfs2_rs_delete(ip, NULL);
755fail_free_acls:
756 if (default_acl)
757 posix_acl_release(default_acl);
758 if (acl)
759 posix_acl_release(acl);
760fail_free_vfs_inode:
741 free_inode_nonrcu(inode); 761 free_inode_nonrcu(inode);
742 inode = NULL; 762 inode = NULL;
743fail_gunlock: 763fail_gunlock:
@@ -1716,10 +1736,11 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1716 error = gfs2_setattr_size(inode, attr->ia_size); 1736 error = gfs2_setattr_size(inode, attr->ia_size);
1717 else if (attr->ia_valid & (ATTR_UID | ATTR_GID)) 1737 else if (attr->ia_valid & (ATTR_UID | ATTR_GID))
1718 error = setattr_chown(inode, attr); 1738 error = setattr_chown(inode, attr);
1719 else if ((attr->ia_valid & ATTR_MODE) && IS_POSIXACL(inode)) 1739 else {
1720 error = gfs2_acl_chmod(ip, attr);
1721 else
1722 error = gfs2_setattr_simple(inode, attr); 1740 error = gfs2_setattr_simple(inode, attr);
1741 if (!error && attr->ia_valid & ATTR_MODE)
1742 error = posix_acl_chmod(inode, inode->i_mode);
1743 }
1723 1744
1724out: 1745out:
1725 if (!error) 1746 if (!error)
@@ -1879,6 +1900,7 @@ const struct inode_operations gfs2_file_iops = {
1879 .removexattr = gfs2_removexattr, 1900 .removexattr = gfs2_removexattr,
1880 .fiemap = gfs2_fiemap, 1901 .fiemap = gfs2_fiemap,
1881 .get_acl = gfs2_get_acl, 1902 .get_acl = gfs2_get_acl,
1903 .set_acl = gfs2_set_acl,
1882}; 1904};
1883 1905
1884const struct inode_operations gfs2_dir_iops = { 1906const struct inode_operations gfs2_dir_iops = {
@@ -1900,6 +1922,7 @@ const struct inode_operations gfs2_dir_iops = {
1900 .removexattr = gfs2_removexattr, 1922 .removexattr = gfs2_removexattr,
1901 .fiemap = gfs2_fiemap, 1923 .fiemap = gfs2_fiemap,
1902 .get_acl = gfs2_get_acl, 1924 .get_acl = gfs2_get_acl,
1925 .set_acl = gfs2_set_acl,
1903 .atomic_open = gfs2_atomic_open, 1926 .atomic_open = gfs2_atomic_open,
1904}; 1927};
1905 1928
@@ -1915,6 +1938,5 @@ const struct inode_operations gfs2_symlink_iops = {
1915 .listxattr = gfs2_listxattr, 1938 .listxattr = gfs2_listxattr,
1916 .removexattr = gfs2_removexattr, 1939 .removexattr = gfs2_removexattr,
1917 .fiemap = gfs2_fiemap, 1940 .fiemap = gfs2_fiemap,
1918 .get_acl = gfs2_get_acl,
1919}; 1941};
1920 1942