From patchwork Wed Jul 19 05:51:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 9850539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F23D7602BD for ; Wed, 19 Jul 2017 05:51:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF8A32861F for ; Wed, 19 Jul 2017 05:51:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D403528622; Wed, 19 Jul 2017 05:51:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3732861D for ; Wed, 19 Jul 2017 05:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbdGSFv4 (ORCPT ); Wed, 19 Jul 2017 01:51:56 -0400 Received: from mail-qt0-f178.google.com ([209.85.216.178]:35330 "EHLO mail-qt0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbdGSFvz (ORCPT ); Wed, 19 Jul 2017 01:51:55 -0400 Received: by mail-qt0-f178.google.com with SMTP id b40so32943122qtb.2 for ; Tue, 18 Jul 2017 22:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=eB20/AJb//YXuZIbJhGDu2TmKF8n6t/2IroHdS4dKoE=; b=jKmTNRJUlrzUf3h1fnyYSAuHMzbENelvDparfjlNSfH+NUFSGLrm1ODMZAP5nhe3hz V6R6I8HlnUNqYWejTZKDyhIwUSCOSN7QZxQFFK+iijFRS6u99Ou52nho/hXYPLAZ6PvK P6NeGhYctbF1aCnEXKcP1036uCqbZgf48IH/zQRXQF/eTdjMAoxQCf2K8Z2fh3GjXlCO ZGMeVACw/DFrn4cHIPFxZUobWYkWS8T6DKoXs9K5NCF3gFs9N7SKX9HUgYHGCozRYreA 6kn3oQExmVomnbkVVmmTUZzObtGKa4+I+VNXDEex/v7wTk63ExYDv/G44k43tWepMqt3 qwbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=eB20/AJb//YXuZIbJhGDu2TmKF8n6t/2IroHdS4dKoE=; b=GQUkNVvFDkBZIKJLknyELJDnkYXyrWOQMH6wUC8L6J4xiBzq41QFizV3ddvk35oQk3 6ZssZNVHd13ccYR19/Vg4kATWC3fRk9Yta5lnRgvUPySPLXCzR2xNtfJs70AVr8Cn5pS dcGZn1YexCyvTR3+c4XzqDst6SE1hTfx59Vm884ydQgpT7jQfIQ1k8u2PTKRCSsgOrPC zplSbxZtWb0b+6oBn8M9X6Y70aZJtyAIqmI5BTESWVSjeqYTrezevq2m5MDv4U9mNxA/ LyOl0pArsWx3ZHeswP3XURSSai6XCeCfd3mmiRKN7AGBb5cqU99mmCSQbwHvk/fHsS46 NWvw== X-Gm-Message-State: AIVw111Uti2/hLP2xTrferJjMUiTbBVBUZeiAQzB0rXslZbRzhxYw2T3 h94vFDkgrA1wfEXIZ2Y= X-Received: by 10.200.3.213 with SMTP id z21mr1357359qtg.185.1500443514246; Tue, 18 Jul 2017 22:51:54 -0700 (PDT) Received: from debian.home ([181.47.180.188]) by smtp.gmail.com with ESMTPSA id r49sm3444787qte.34.2017.07.18.22.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 22:51:53 -0700 (PDT) Date: Wed, 19 Jul 2017 02:51:50 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: fstests@vger.kernel.org Cc: Christoph Hellwig , Eryu Guan , Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= Subject: [xfstests PATCH v4] generic: add test of file mode when setfacl fails Message-ID: <20170719055146.GA7249@debian.home> MIME-Version: 1.0 Content-Disposition: inline Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check that the group permission bits of a file are not altered when setfacl fails. At the time of this patch the test fails for at least ext2, ext4, jfs and btrfs. The failure in setfacl is induced by filling the device and setting as many user attributes to the file as possible. For xfs this is not enough, and the test will not run. Signed-off-by: Ernesto A. Fernández --- Changes in v4: - Continue to set attributes even when the filesystem claims to be out of space. With this change the test will now fail for btrfs. - Call _notrun when setfacl succeeds, since no check can be done. As suggested by Eryu Guan. Changes in v3: - Several fixes requested by Eryu Guan (thank you for your review), most importantly: - Place the jfs support in a separate patch, already sent. - Make the test fail when the scratch device does not mount, so rootfs won't be filled. - Add the test to auto and quick groups. Changes in v2: - Use the scratch dev instead of the test dev so we can make a small fs and fill it faster. As suggested by Christoph Hellwig. - Make jfs work with _scratch_mkfs_sized, needed for the above. - Remove the mention to an issue with reiserfs, since I now believe the problem is on their side. tests/generic/449 | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/449.out | 2 ++ tests/generic/group | 1 + 3 files changed, 101 insertions(+) create mode 100755 tests/generic/449 create mode 100644 tests/generic/449.out diff --git a/tests/generic/449 b/tests/generic/449 new file mode 100755 index 0000000..7c7a3f8 --- /dev/null +++ b/tests/generic/449 @@ -0,0 +1,98 @@ +#! /bin/bash +# FS QA Test 449 +# +# Fill the device and set as many extended attributes to a file as +# possible. Then call setfacl on it and, if this fails for lack of +# space, test that the permissions remain the same. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Ernesto A. Fernandez. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch +_require_test +_require_acls +_require_attrs + +_scratch_mkfs_sized $((50 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount || _fail "mount failed" + +TFILE=$SCRATCH_MNT/testfile.$seq + +# Create the test file and choose its permissions +touch $TFILE +chmod u+rwx $TFILE +chmod go-rwx $TFILE + +# Try to run out of space so setfacl will fail +$XFS_IO_PROG -c "pwrite 0 50m" $TFILE >>$seqres.full 2>&1 +i=1 +j=1 +ret=0 +while [ $ret -eq 0 ]; do + ret=1 + while [ $j -le 1000 ]; do + # On btrfs, setfattr will sometimes fail when free space is + # low, long before it's actually exhausted. Insist until it + # fails consistently. + setfattr -n user.$i"x"$j $TFILE &>/dev/null + ret=$(( $ret && $? )) + ((++j)) + done + j=1 + ((++i)) +done + +if setfacl -m m:r $TFILE &>/dev/null; then + # setfacl succeeded, so the test was meaningless + # The filesystem might still have an issue + _notrun "$FSTYP succeeds in setting acls despite running out of space for user attrs" +fi + +# Since setfacl failed, the permissions should not have changed +stat -c %A $TFILE + +status=0 +exit diff --git a/tests/generic/449.out b/tests/generic/449.out new file mode 100644 index 0000000..95177ef --- /dev/null +++ b/tests/generic/449.out @@ -0,0 +1,2 @@ +QA output created by 449 +-rwx------ diff --git a/tests/generic/group b/tests/generic/group index e626820..c1dd505 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -451,3 +451,4 @@ 446 auto quick rw dangerous 447 auto quick clone 448 auto quick rw +449 auto quick acl