From patchwork Mon Mar 4 21:19:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10838627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 812FE1823 for ; Mon, 4 Mar 2019 21:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 714CC2A953 for ; Mon, 4 Mar 2019 21:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65A552B2D3; Mon, 4 Mar 2019 21:19:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable 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 593822B2C5 for ; Mon, 4 Mar 2019 21:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726127AbfCDVTk (ORCPT ); Mon, 4 Mar 2019 16:19:40 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:42206 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfCDVTk (ORCPT ); Mon, 4 Mar 2019 16:19:40 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x24LJKvd015472; Mon, 4 Mar 2019 21:19:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=tCjovMYSKrfU5lJEum3PnuyNzQrkQDrPn0tWuwee76I=; b=LOoSmaj1Xu8U2zViZkMvaPSdpbs9jW9vj4PHvubxgS6XNpzHAyczVazfRBUQMYIlpA+p p5dtYhI4gzdxA2XlqULYzc+qKJw+Qly4w9ptITHMXe7dcIGqsCNZVzvSIsp+ZSJgPjYW O5eAQVpB5HnM/4nORrlwRM+NMyApJ3eW5gbJYbHdxZOV6IPwhMr8xaj9rzuo1d0FNMHd Cwk/LR7hXR5Hi+xkgnAWWPOu39e8QrZHGieuoJ/EwPU9At8nCedBjQR1s7OISqOopWcs L5P56EgxfRoFUnbnTfDW7l1iKw9zofKunZVCEFqaBLZTnDt8YwnEyMw6eE59rBDEKZq5 lw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qyfbe1m2m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Mar 2019 21:19:38 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x24LJb1Y024935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Mar 2019 21:19:37 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x24LJa29023954; Mon, 4 Mar 2019 21:19:36 GMT Received: from localhost (/10.159.248.244) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Mar 2019 13:19:36 -0800 Subject: [PATCH 4/5] generic: test statx attribute_mask setting From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Mon, 04 Mar 2019 13:19:35 -0800 Message-ID: <155173437536.767.4083133841860983852.stgit@magnolia> In-Reply-To: <155173434205.767.15128498725168844621.stgit@magnolia> References: <155173434205.767.15128498725168844621.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9185 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903040150 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Make sure the filesystem reports attribute_mask for the attributes it supports. Signed-off-by: Darrick J. Wong --- tests/generic/713 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/713.out | 1 + tests/generic/group | 1 + 3 files changed, 69 insertions(+) create mode 100755 tests/generic/713 create mode 100644 tests/generic/713.out diff --git a/tests/generic/713 b/tests/generic/713 new file mode 100755 index 00000000..cd128d9c --- /dev/null +++ b/tests/generic/713 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2019 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 713 +# +# Regression test for a bug where XFS fails to set statx attributes_mask but +# sets attribute flags anyway. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* $testfile +} + +# get standard environment, filters and checks +. ./common/rc + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_test + +get_attributes() { + $XFS_IO_PROG -r -c "statx -r" $1 | grep 'stat.attributes =' | cut -d ' ' -f 3 +} + +get_attributes_mask() { + $XFS_IO_PROG -r -c "statx -r" $1 | grep 'stat.attributes_mask =' | cut -d ' ' -f 3 +} + +check_statx_attributes() +{ + attrs=$(get_attributes $testfile) + mask=$(get_attributes_mask $testfile) + + echo "MASK:$mask:ATTRS:$attrs:" >> $seqres.full + + test -z "$mask" && _notrun "xfs_io statx command does not support attributes_mask" + test $(( mask )) -eq 0 && echo "attributes mask is zero" + test $(( attrs & ~(mask) )) -ne 0 && echo "attributes $attrs do not appear in mask $mask" +} + +# Create file, check for incorrect mask +testfile=$TEST_DIR/$$.test +touch $testfile +check_statx_attributes + +# Do it again, but this time try to turn on one of the attributes. +if chattr +i $testfile > /dev/null 2>&1; then + check_statx_attributes + chattr -i $testfile +fi +if chattr +a $testfile > /dev/null 2>&1; then + check_statx_attributes + chattr -a $testfile +fi + +status=0 +exit diff --git a/tests/generic/713.out b/tests/generic/713.out new file mode 100644 index 00000000..066598d3 --- /dev/null +++ b/tests/generic/713.out @@ -0,0 +1 @@ +QA output created by 713 diff --git a/tests/generic/group b/tests/generic/group index 15227b67..d04bf39f 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -534,3 +534,4 @@ 529 auto quick attr 530 auto quick unlink 531 auto quick unlink +713 auto quick