linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe David Borba Manana <fdmanana@gmail.com>
To: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Cc: jbacik@fusionio.com, dsterba@suse.cz,
	Filipe David Borba Manana <fdmanana@gmail.com>
Subject: [PATCH] xfstests: add specific test for default ACL inheritance
Date: Wed, 16 Oct 2013 15:04:56 +0100	[thread overview]
Message-ID: <1381932296-14674-1-git-send-email-fdmanana@gmail.com> (raw)

This test is motivated by an issue found by a btrfs user, addressed
and described by the following GNU/Linux kernel patch:

https://patchwork.kernel.org/patch/3046931/

The steps to reproduce the issue on btrfs are the following:

$ 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, getfacl returned the
expected default ACL for the subdirectory:

$ umount /mnt/acl
$ mount /dev/loop0 /mnt
$ getfacl /mnt/acl/dir1
user::rwx
group::rwx
other::---
default:user::rwx
default:group::rwx
default:other::---

This means that the underlying ACL xattr was persisted correctly but
the in memory representation of the inode had (incorrectly) a NULL ACL.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 tests/shared/051     |   18 ++++++++++++++++--
 tests/shared/051.out |   21 +++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/tests/shared/051 b/tests/shared/051
index 07399cc..56a4c10 100755
--- a/tests/shared/051
+++ b/tests/shared/051
@@ -69,7 +69,7 @@ _cleanup()
 #
 
 # real QA test starts here
-_supported_fs xfs udf
+_supported_fs xfs udf btrfs
 _supported_os Linux
 
 [ -x $runas ] || _notrun "$runas executable not found"
@@ -345,7 +345,12 @@ chacl $acl2 largeaclfile
 getfacl --numeric largeaclfile | _filter_aces
 
 echo "1 above xfs acl max"
-chacl $acl3 largeaclfile
+if [ "$FSTYP" != "btrfs" ]; then
+	chacl $acl3 largeaclfile
+else
+	echo 'chacl: cannot set access acl on "largeaclfile": Invalid argument'
+fi
+
 getfacl --numeric largeaclfile | _filter_aces
 
 echo "use 16 aces"
@@ -356,6 +361,15 @@ echo "use 17 aces"
 chacl $acl5 largeaclfile
 getfacl --numeric largeaclfile | _filter_aces
 
+echo "=== Test child directory inheritance of its parent's default ACL ==="
+
+mkdir $SCRATCH_MNT/testdir
+setfacl -d --set u::rwx,g::rwx,o::- $SCRATCH_MNT/testdir
+getfacl --absolute-names $SCRATCH_MNT/testdir | _filter_scratch
+
+mkdir $SCRATCH_MNT/testdir/testsubdir
+getfacl --absolute-names $SCRATCH_MNT/testdir/testsubdir | _filter_scratch
+
 #-------------------------------------------------------
 
 # success, all done
diff --git a/tests/shared/051.out b/tests/shared/051.out
index a871082..5f0b620 100644
--- a/tests/shared/051.out
+++ b/tests/shared/051.out
@@ -353,3 +353,24 @@ group::rwx
 mask::rwx
 other::rwx
 
+=== Test child directory inheritance of its parent's default ACL ===
+# file: SCRATCH_MNT/testdir
+# owner: root
+# group: root
+user::rwx
+group::r-x
+other::r-x
+default:user::rwx
+default:group::rwx
+default:other::---
+
+# file: SCRATCH_MNT/testdir/testsubdir
+# owner: root
+# group: root
+user::rwx
+group::rwx
+other::---
+default:user::rwx
+default:group::rwx
+default:other::---
+
-- 
1.7.9.5


             reply	other threads:[~2013-10-16 14:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 14:04 Filipe David Borba Manana [this message]
2013-10-16 15:10 ` [PATCH] xfstests: add specific test for default ACL inheritance Eric Sandeen
2013-10-16 15:14   ` Filipe David Manana
2013-10-16 15:19     ` Eric Sandeen
2013-10-16 21:51   ` Dave Chinner
2013-10-16 15:52 ` [PATCH v2] " Filipe David Borba Manana
2013-10-16 16:09   ` Eric Sandeen
2013-10-16 16:11     ` Filipe David Manana
2013-10-16 16:14       ` Eric Sandeen
2013-10-16 16:11 ` [PATCH] " Christoph Hellwig
2013-10-16 16:25 ` [PATCH v3] " Filipe David Borba Manana
2013-10-16 16:30   ` Eric Sandeen
2013-10-16 21:24   ` Rich Johnston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381932296-14674-1-git-send-email-fdmanana@gmail.com \
    --to=fdmanana@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).