From patchwork Fri Jun 22 06:40:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10481363 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 924C660230 for ; Fri, 22 Jun 2018 06:40:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8009928E15 for ; Fri, 22 Jun 2018 06:40:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72E3628E2C; Fri, 22 Jun 2018 06:40:48 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 F059828A6E for ; Fri, 22 Jun 2018 06:40:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750913AbeFVGkr (ORCPT ); Fri, 22 Jun 2018 02:40:47 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:50070 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbeFVGkq (ORCPT ); Fri, 22 Jun 2018 02:40:46 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5M6cnCP005869; Fri, 22 Jun 2018 06:40:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=9MRUyJ8sVAGp2DfWeCeLl7qNxzixOq4IH/Es3cRD8iE=; b=g8LxrEmKwtrEgzZ75sMkI89PG346eJuS9Wd9U/QfVCCm6kwFbcDn9jeYH5qEdxf9yBvV WFnJ3N86es4V3ME8HHIm4B6W89vNTU93fW8/xiV6gNxQAltQEoOBb7qqXeuEFxd5PZ0R E2AU5jK7HsB5CgjShc4bZeX9TdfqdyI7LwAbyVhofLwguIHwA1oeXL7aH49VoH1pWTnY lm55uhKSI+jXJvlDeuHJEw7Zyth8wKudT/b1gG00rUcqKm8sf56sp1TMPhARhMYhjZ2k 2VfRSIzPfo1LPc/jl575zzZNOkgdwkzz0MWceXRVHV7QXFlUmTuhxAlY7ykeoik6hJBM Tw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2jrp8hrnv5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 06:40:45 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5M6eiSk018488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 06:40:44 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5M6ehtT006057; Fri, 22 Jun 2018 06:40:44 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Jun 2018 23:40:43 -0700 Date: Thu, 21 Jun 2018 23:40:42 -0700 From: "Darrick J. Wong" To: guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v2 2/4] xfs: regression test for rmapbt fdblocks accounting problems Message-ID: <20180622064042.GO4838@magnolia> References: <152960594943.26479.1457883867468749220.stgit@magnolia> <152960596196.26479.13083497192197135552.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <152960596196.26479.13083497192197135552.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8931 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806220075 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In "xfs: fix fdblocks accounting w/ RMAPBT per-AG reservation", we fixed the per-ag reservation code so that we always decrease fdblocks by the reserved size because rmapbt blocks are counted as free space. The primary symptom of this bug is that if the rmapbt has expanded since mount time, the disk block counters reported via statfs will change across a remount. Therefore, we exercise this as a regression test. Signed-off-by: Darrick J. Wong --- v2: add silence is golden message --- tests/xfs/712 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/712.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 67 insertions(+) create mode 100755 tests/xfs/712 create mode 100644 tests/xfs/712.out -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/xfs/712 b/tests/xfs/712 new file mode 100755 index 00000000..ab2342ef --- /dev/null +++ b/tests/xfs/712 @@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Oracle, Inc. All rights reserved. +# +# FS QA Test No. 712 +# +# Make sure that the statfs b_avail counter doesn't change across remount +# after the rmapbt has grown in size. +# +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 + +# remove previous \$seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_test_program "punch-alternating" +_require_xfs_scratch_rmapbt + +_scratch_mkfs >> $seqres.full +_scratch_mount + +# Make sure we allocate a big enough file such that punching out every other +# block will cause the rmapbt to expand by at least one block. +blksz=$(_get_file_block_size $SCRATCH_MNT) +nr_rmap_per_rmapbt=$(( (blksz - 56) / 24)) +blks=$(( (nr_rmap_per_rmapbt + 2) * 2)) +$XFS_IO_PROG -f -c "falloc 0 $((blks * blksz))" $SCRATCH_MNT/a >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/a + +# Do the stat counters change across the remount? +before=$(stat -f -c '%b %f' $SCRATCH_MNT) +_scratch_cycle_mount +after=$(stat -f -c '%b %f' $SCRATCH_MNT) + +if [ "${before}" != "${after}" ]; then + echo "counters changed: ${before} ${after}" + echo "before: ${before}" >> $seqres.full + echo "after: ${after}" >> $seqres.full +fi + +echo "Silence is golden." + +# success, all done +status=0 +exit diff --git a/tests/xfs/712.out b/tests/xfs/712.out new file mode 100644 index 00000000..33a76b21 --- /dev/null +++ b/tests/xfs/712.out @@ -0,0 +1,2 @@ +QA output created by 712 +Silence is golden. diff --git a/tests/xfs/group b/tests/xfs/group index 932ab909..2f1c8467 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -447,3 +447,4 @@ 447 auto mount 448 auto quick fuzzers 449 auto quick +712 auto quick rmap