From patchwork Thu Jun 21 18:32: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: 10480383 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 1EDF3604D3 for ; Thu, 21 Jun 2018 18:32:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 080F029196 for ; Thu, 21 Jun 2018 18:32:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F120A2919C; Thu, 21 Jun 2018 18:32:49 +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 8605A29196 for ; Thu, 21 Jun 2018 18:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbeFUSct (ORCPT ); Thu, 21 Jun 2018 14:32:49 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51902 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754012AbeFUScs (ORCPT ); Thu, 21 Jun 2018 14:32:48 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5LITGSv083051; Thu, 21 Jun 2018 18:32:46 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-2017-10-26; bh=RRMxB2OeWdHnRESnMfOl+PnFYgSobFnOYhmtXhCXe6M=; b=OOXo2v/r4YUuntWvsb/EK/RDvz5jbHELtObuMxdfwqbbf2fU1VdU/tymJ/Sqb01dx6OA T4hlQDf0n6Oa66vh0e8fS3qBTLBM7D0OoVffnKVQrIdCebb00+IkJqX9rqQe1F2mvvAc FrXHQqTD+Gx12hZuL7Ur9JsBE7fCu/TnMV0gfSWXnAtyHV8fbrr3AeDaLyfYd70IKMF2 rCiNcCJcBIo9BQv9I2YAdwVtQgPkufBJA1aV1kgeUomiQZtL1/PX/2+TONv0tbEx/G2p gEPnODIkx4aHXJlsGb0dEyys7riN2OGeKVCHLZJFjtUn3g96RJzzwTHZM7pchG9Ik0LD zw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2jmr2mubey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jun 2018 18:32:46 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5LIWjVm007503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jun 2018 18:32:46 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5LIWiWh031871; Thu, 21 Jun 2018 18:32:44 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Jun 2018 11:32:44 -0700 Subject: [PATCH 2/4] xfs: regression test for rmapbt fdblocks accounting problems From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Thu, 21 Jun 2018 11:32:42 -0700 Message-ID: <152960596196.26479.13083497192197135552.stgit@magnolia> In-Reply-To: <152960594943.26479.1457883867468749220.stgit@magnolia> References: <152960594943.26479.1457883867468749220.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8931 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1805220000 definitions=main-1806210199 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 --- tests/xfs/712 | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/712.out | 1 + tests/xfs/group | 1 + 3 files changed, 64 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..f90c7ec9 --- /dev/null +++ b/tests/xfs/712 @@ -0,0 +1,62 @@ +#! /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 + +# success, all done +status=0 +exit diff --git a/tests/xfs/712.out b/tests/xfs/712.out new file mode 100644 index 00000000..4e900419 --- /dev/null +++ b/tests/xfs/712.out @@ -0,0 +1 @@ +QA output created by 712 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