From patchwork Wed Oct 16 14:04:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 3052891 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E705ABF924 for ; Wed, 16 Oct 2013 14:05:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBD1E203FB for ; Wed, 16 Oct 2013 14:05:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84C66203A3 for ; Wed, 16 Oct 2013 14:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934285Ab3JPOFO (ORCPT ); Wed, 16 Oct 2013 10:05:14 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:43757 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934214Ab3JPOFN (ORCPT ); Wed, 16 Oct 2013 10:05:13 -0400 Received: by mail-wg0-f42.google.com with SMTP id n12so3992537wgh.5 for ; Wed, 16 Oct 2013 07:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5nBLHBkn8eWSv4zKdAlJHv/9nTNpqcdfWVTurJVgJlA=; b=GNCO2sRzS/2JrrXcQoyvy67uDlSO4cER62yRjjwrRcVgwYCCgvebaFD5qS/v/uBsX4 6I+IWhiE7C6U+H0VYK+er+lc74HJPz7jsd85NXlQ2ODIueZwV7TARP5wk4NQoGYDRkY9 3lqC+M3ZXvplR+ozB+0GnVYM9l/Zfsqtg91DUDlXQkvINgohcEQ3ZJtog8et+9shJ/Nv yT+peH+eVy+H3f04Wtdfq893gked2M9vh12lQLujSGVd9kE70KIFQ4j5Jk0hwChVnrmw nRAP5yanhn02++K9BpHm26PuyjBH0elKcLe8PfW8ag98enYv1g8q+JqRwuvryOLxpwD6 oIxA== X-Received: by 10.194.48.74 with SMTP id j10mr2175523wjn.41.1381932311639; Wed, 16 Oct 2013 07:05:11 -0700 (PDT) Received: from storm-desktop.lan (bl5-77-122.dsl.telepac.pt. [82.154.77.122]) by mx.google.com with ESMTPSA id e5sm6252405wiy.2.2013.10.16.07.05.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Oct 2013 07:05:11 -0700 (PDT) From: Filipe David Borba Manana To: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com Cc: jbacik@fusionio.com, dsterba@suse.cz, Filipe David Borba Manana Subject: [PATCH] xfstests: add specific test for default ACL inheritance Date: Wed, 16 Oct 2013 15:04:56 +0100 Message-Id: <1381932296-14674-1-git-send-email-fdmanana@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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::--- +