aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-10-15 13:44:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-20 10:45:12 -0500
commit9436cf971ed1aa296e6ca36489f5240d3868ff84 (patch)
treef42bba0d45f0d73659f1c91359d66a22470aa83b
parentb395193ecf087a36e98b97c396f839b3fe9a4d19 (diff)
Btrfs: fix incorrect inode acl reset
commit 8185554d3eb09d23a805456b6fa98dcbb34aa518 upstream. When a directory has a default ACL and a subdirectory is created under that directory, btrfs_init_acl() is called when the subdirectory's inode is created to initialize the inode's ACL (inherited from the parent directory) but it was clearing the ACL from the inode after setting it if posix_acl_create() returned success, instead of clearing it only if it returned an error. To reproduce this issue: $ mkfs.btrfs -f /dev/loop0 $ mount /dev/loop0 /mnt $ mkdir /mnt/acl $ setfacl -d --set u::rwx,g::rwx,o::- /mnt/acl $ getfacl /mnt/acl user::rwx group::rwx other::r-x default:user::rwx default:group::rwx default:other::--- $ mkdir /mnt/acl/dir1 $ getfacl /mnt/acl/dir1 user::rwx group::rwx other::--- After unmounting and mounting again the filesystem, fgetacl returned the expected ACL: $ umount /mnt/acl $ mount /dev/loop0 /mnt $ getfacl /mnt/acl/dir1 user::rwx group::rwx other::--- default:user::rwx default:group::rwx default:other::--- Meaning that the underlying xattr was persisted. Reported-by: Giuseppe Fierro <giuseppe@fierro.org> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/btrfs/acl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index e15d2b0d8d3b..0890c83643e9 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -229,7 +229,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
229 if (ret > 0) { 229 if (ret > 0) {
230 /* we need an acl */ 230 /* we need an acl */
231 ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS); 231 ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
232 } else { 232 } else if (ret < 0) {
233 cache_no_acl(inode); 233 cache_no_acl(inode);
234 } 234 }
235 } else { 235 } else {