From patchwork Wed Nov 11 00:43:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11895953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E95F41668 for ; Wed, 11 Nov 2020 00:44:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B652021D46 for ; Wed, 11 Nov 2020 00:44:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jdhWUfIF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732398AbgKKAoA (ORCPT ); Tue, 10 Nov 2020 19:44:00 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:34720 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731982AbgKKAoA (ORCPT ); Tue, 10 Nov 2020 19:44:00 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0ZXBP016893; Wed, 11 Nov 2020 00:43:57 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-2020-01-29; bh=ATLKDVJ58ExP0R6VeBy9RYzJdVfID4317QG8Nl3cEEg=; b=jdhWUfIFNIe4+DJcWAv6Qs1bPi41KqOIEsJr6nZWPr71rI6g+jso4WbXjE1oZYQxwkd4 Pa8WqaSDQCGGDgw9Bm1NDXvCw1iUzQZDNrHvmTlCe6WQHzcsnGoq4dlFEx8gX6G+Ydjl uyUAGUhdTNIgwpKy9KecapwB8gaxCWknhjsgo/snuTTrSeBUIEqN7dUxgUd7HeXGNJbV SFaM7w070q6qhyA4EB4BDNc05LpMN05DXqbz9C+cVLF2b/3YDC/yNMz8HD5l0kPV+ruX L1L1ZTJI3JiheRRBjL4KG5ulb5JT/fNx71dgTnnnDfZKrXAZwhQWU/wsjMxZDJbX4X01 rw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34p72emv4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:43:57 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0UAdE097653; Wed, 11 Nov 2020 00:43:57 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 34p5gxq753-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:43:57 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AB0huDr018103; Wed, 11 Nov 2020 00:43:56 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:43:55 -0800 Subject: [PATCH 1/7] xfs: test fallocate ops when rt extent size is and isn't a power of 2 From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: Chandan Babu R , linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:43:54 -0800 Message-ID: <160505543432.1388823.5291425950279344667.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Make sure that fallocate works when the rt extent size is and isn't a power of 2. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- tests/xfs/763 | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/763.out | 91 +++++++++++++++++++++++++++ tests/xfs/group | 1 3 files changed, 273 insertions(+) create mode 100755 tests/xfs/763 create mode 100644 tests/xfs/763.out diff --git a/tests/xfs/763 b/tests/xfs/763 new file mode 100755 index 00000000..4b0b08a0 --- /dev/null +++ b/tests/xfs/763 @@ -0,0 +1,181 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 763 +# +# Make sure that regular fallocate functions work ok when the realtime extent +# size is and isn't a power of 2. +# +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 / + _scratch_unmount >> $seqres.full 2>&1 + test -e "$rtdev" && losetup -d $rtdev >> $seqres.full 2>&1 + rm -f $tmp.* $TEST_DIR/$seq.rtvol +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_require_xfs_io_command "fpunch" +_require_xfs_io_command "fzero" +_require_xfs_io_command "fcollapse" +_require_xfs_io_command "finsert" +# Note that we don't _require_realtime because we synthesize a rt volume +# below. This also means we cannot run the post-test check. +_require_scratch_nocheck + +log() { + echo "$@" | tee -a $seqres.full +} + +mk_file() { + local file="$1" + local rextsize="$2" + + $XFS_IO_PROG -f \ + -c "pwrite -S 0x57 -b $rextsize 0 $rextsize" \ + -c "pwrite -S 0x58 -b $rextsize $rextsize $rextsize" \ + -c "pwrite -S 0x59 -b $rextsize $((rextsize * 2)) $rextsize" \ + -c fsync \ + "$file" >> $seqres.full +} + +check_file() { + filefrag -v "$1" >> $seqres.full + od -tx1 -Ad -c "$1" >> $seqres.full + md5sum "$1" | _filter_scratch | tee -a $seqres.full +} + +test_ops() { + local rextsize=$1 + local sz=$((rextsize * 3)) + local unaligned_sz=65536 + local unaligned_off=$((rextsize * 2 + unaligned_sz)) + local lunaligned_sz=$((rextsize * 2)) + local lunaligned_off=$unaligned_sz + + log "Format rtextsize=$rextsize" + _scratch_unmount + _scratch_mkfs -r extsize=$rextsize >> $seqres.full + _scratch_mount || \ + _notrun "Could not mount rextsize=$rextsize with synthetic rt volume" + + # Force all files to be realtime files + $XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT + + log "Test regular write, rextsize=$rextsize" + mk_file $SCRATCH_MNT/write $rextsize + check_file $SCRATCH_MNT/write + + log "Test aligned falloc, rextsize=$rextsize" + $XFS_IO_PROG -f -c "falloc 0 $sz" $SCRATCH_MNT/falloc >> $seqres.full + check_file $SCRATCH_MNT/falloc + + log "Test aligned fcollapse, rextsize=$rextsize" + mk_file $SCRATCH_MNT/collapse $rextsize + $XFS_IO_PROG -f -c "fcollapse $rextsize $rextsize" $SCRATCH_MNT/collapse >> $seqres.full + check_file $SCRATCH_MNT/collapse + + log "Test aligned finsert, rextsize=$rextsize" + mk_file $SCRATCH_MNT/insert $rextsize + $XFS_IO_PROG -f -c "finsert $rextsize $rextsize" $SCRATCH_MNT/insert >> $seqres.full + check_file $SCRATCH_MNT/insert + + log "Test aligned fzero, rextsize=$rextsize" + mk_file $SCRATCH_MNT/zero $rextsize + $XFS_IO_PROG -f -c "fzero $rextsize $rextsize" $SCRATCH_MNT/zero >> $seqres.full + check_file $SCRATCH_MNT/zero + + log "Test aligned fpunch, rextsize=$rextsize" + mk_file $SCRATCH_MNT/punch $rextsize + $XFS_IO_PROG -f -c "fpunch $rextsize $rextsize" $SCRATCH_MNT/punch >> $seqres.full + check_file $SCRATCH_MNT/punch + + log "Test unaligned falloc, rextsize=$rextsize" + $XFS_IO_PROG -f -c "falloc $unaligned_off $unaligned_sz" $SCRATCH_MNT/ufalloc >> $seqres.full + check_file $SCRATCH_MNT/ufalloc + + log "Test unaligned fcollapse, rextsize=$rextsize" + mk_file $SCRATCH_MNT/ucollapse $rextsize + $XFS_IO_PROG -f -c "fcollapse $unaligned_off $unaligned_sz" $SCRATCH_MNT/ucollapse >> $seqres.full + check_file $SCRATCH_MNT/ucollapse + + log "Test unaligned finsert, rextsize=$rextsize" + mk_file $SCRATCH_MNT/uinsert $rextsize + $XFS_IO_PROG -f -c "finsert $unaligned_off $unaligned_sz" $SCRATCH_MNT/uinsert >> $seqres.full + check_file $SCRATCH_MNT/uinsert + + log "Test unaligned fzero, rextsize=$rextsize" + mk_file $SCRATCH_MNT/uzero $rextsize + $XFS_IO_PROG -f -c "fzero $unaligned_off $unaligned_sz" $SCRATCH_MNT/uzero >> $seqres.full + check_file $SCRATCH_MNT/uzero + + log "Test unaligned fpunch, rextsize=$rextsize" + mk_file $SCRATCH_MNT/upunch $rextsize + $XFS_IO_PROG -f -c "fpunch $unaligned_off $unaligned_sz" $SCRATCH_MNT/upunch >> $seqres.full + check_file $SCRATCH_MNT/upunch + + log "Test large unaligned fzero, rextsize=$rextsize" + mk_file $SCRATCH_MNT/luzero $rextsize + $XFS_IO_PROG -f -c "fzero $lunaligned_off $lunaligned_sz" $SCRATCH_MNT/luzero >> $seqres.full + check_file $SCRATCH_MNT/luzero + + log "Test large unaligned fpunch, rextsize=$rextsize" + mk_file $SCRATCH_MNT/lpunch $rextsize + $XFS_IO_PROG -f -c "fpunch $lunaligned_off $lunaligned_sz" $SCRATCH_MNT/lpunch >> $seqres.full + check_file $SCRATCH_MNT/lpunch + + log "Remount and compare" + _scratch_cycle_mount + check_file $SCRATCH_MNT/write + check_file $SCRATCH_MNT/falloc + check_file $SCRATCH_MNT/collapse + check_file $SCRATCH_MNT/insert + check_file $SCRATCH_MNT/zero + check_file $SCRATCH_MNT/punch + check_file $SCRATCH_MNT/ufalloc + check_file $SCRATCH_MNT/ucollapse + check_file $SCRATCH_MNT/uinsert + check_file $SCRATCH_MNT/uzero + check_file $SCRATCH_MNT/upunch + check_file $SCRATCH_MNT/luzero + check_file $SCRATCH_MNT/lpunch + + log "Check everything, rextsize=$rextsize" + _check_scratch_fs +} + +echo "Create fake rt volume" +truncate -s 400m $TEST_DIR/$seq.rtvol +rtdev=$(_create_loop_device $TEST_DIR/$seq.rtvol) + +echo "Make sure synth rt volume works" +export USE_EXTERNAL=yes +export SCRATCH_RTDEV=$rtdev +_scratch_mkfs > $seqres.full +_scratch_mount || \ + _notrun "Could not mount with synthetic rt volume" + +# power of two +test_ops 262144 + +# not a power of two +test_ops 327680 + +# success, all done +status=0 +exit diff --git a/tests/xfs/763.out b/tests/xfs/763.out new file mode 100644 index 00000000..27c87bab --- /dev/null +++ b/tests/xfs/763.out @@ -0,0 +1,91 @@ +QA output created by 763 +Create fake rt volume +Make sure synth rt volume works +Format rtextsize=262144 +Test regular write, rextsize=262144 +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/write +Test aligned falloc, rextsize=262144 +cb18a5d28e77522dfec6a6255bc3847e SCRATCH_MNT/falloc +Test aligned fcollapse, rextsize=262144 +2e94746ab733025c21a9cae7d19c18d0 SCRATCH_MNT/collapse +Test aligned finsert, rextsize=262144 +24e228d3d5f68b612eceec47f8416a7d SCRATCH_MNT/insert +Test aligned fzero, rextsize=262144 +ecb6eb78ceb5c43ce86d523437b1fa95 SCRATCH_MNT/zero +Test aligned fpunch, rextsize=262144 +ecb6eb78ceb5c43ce86d523437b1fa95 SCRATCH_MNT/punch +Test unaligned falloc, rextsize=262144 +157e39521e47ad1c923a94edd69ad59c SCRATCH_MNT/ufalloc +Test unaligned fcollapse, rextsize=262144 +fallocate: Invalid argument +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/ucollapse +Test unaligned finsert, rextsize=262144 +fallocate: Invalid argument +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/uinsert +Test unaligned fzero, rextsize=262144 +4402ca12d4425d7f94c9f536b756d924 SCRATCH_MNT/uzero +Test unaligned fpunch, rextsize=262144 +4402ca12d4425d7f94c9f536b756d924 SCRATCH_MNT/upunch +Test large unaligned fzero, rextsize=262144 +be43c5a0de0b510a6a573d682b0df726 SCRATCH_MNT/luzero +Test large unaligned fpunch, rextsize=262144 +be43c5a0de0b510a6a573d682b0df726 SCRATCH_MNT/lpunch +Remount and compare +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/write +cb18a5d28e77522dfec6a6255bc3847e SCRATCH_MNT/falloc +2e94746ab733025c21a9cae7d19c18d0 SCRATCH_MNT/collapse +24e228d3d5f68b612eceec47f8416a7d SCRATCH_MNT/insert +ecb6eb78ceb5c43ce86d523437b1fa95 SCRATCH_MNT/zero +ecb6eb78ceb5c43ce86d523437b1fa95 SCRATCH_MNT/punch +157e39521e47ad1c923a94edd69ad59c SCRATCH_MNT/ufalloc +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/ucollapse +2dce060217cb2293dde96f7fdb3b9232 SCRATCH_MNT/uinsert +4402ca12d4425d7f94c9f536b756d924 SCRATCH_MNT/uzero +4402ca12d4425d7f94c9f536b756d924 SCRATCH_MNT/upunch +be43c5a0de0b510a6a573d682b0df726 SCRATCH_MNT/luzero +be43c5a0de0b510a6a573d682b0df726 SCRATCH_MNT/lpunch +Check everything, rextsize=262144 +Format rtextsize=327680 +Test regular write, rextsize=327680 +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/write +Test aligned falloc, rextsize=327680 +63a6c5a8b8da92e30cd0ef23c56d4f06 SCRATCH_MNT/falloc +Test aligned fcollapse, rextsize=327680 +8bdd728a7a4af4ac18bbcbe39dea14d5 SCRATCH_MNT/collapse +Test aligned finsert, rextsize=327680 +2b178c860f7bef4c0e55399be5172c5e SCRATCH_MNT/insert +Test aligned fzero, rextsize=327680 +350defefe2530d8eb8d6a6772c81c206 SCRATCH_MNT/zero +Test aligned fpunch, rextsize=327680 +350defefe2530d8eb8d6a6772c81c206 SCRATCH_MNT/punch +Test unaligned falloc, rextsize=327680 +cb18a5d28e77522dfec6a6255bc3847e SCRATCH_MNT/ufalloc +Test unaligned fcollapse, rextsize=327680 +fallocate: Invalid argument +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/ucollapse +Test unaligned finsert, rextsize=327680 +fallocate: Invalid argument +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/uinsert +Test unaligned fzero, rextsize=327680 +c9c7b8791f445ec8c5fbbf82cb26b33c SCRATCH_MNT/uzero +Test unaligned fpunch, rextsize=327680 +c9c7b8791f445ec8c5fbbf82cb26b33c SCRATCH_MNT/upunch +Test large unaligned fzero, rextsize=327680 +d8bf9fa95e4a7dd228d0b03768045db9 SCRATCH_MNT/luzero +Test large unaligned fpunch, rextsize=327680 +d8bf9fa95e4a7dd228d0b03768045db9 SCRATCH_MNT/lpunch +Remount and compare +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/write +63a6c5a8b8da92e30cd0ef23c56d4f06 SCRATCH_MNT/falloc +8bdd728a7a4af4ac18bbcbe39dea14d5 SCRATCH_MNT/collapse +2b178c860f7bef4c0e55399be5172c5e SCRATCH_MNT/insert +350defefe2530d8eb8d6a6772c81c206 SCRATCH_MNT/zero +350defefe2530d8eb8d6a6772c81c206 SCRATCH_MNT/punch +cb18a5d28e77522dfec6a6255bc3847e SCRATCH_MNT/ufalloc +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/ucollapse +dcc4a2d49adcac61bceae7db66611880 SCRATCH_MNT/uinsert +c9c7b8791f445ec8c5fbbf82cb26b33c SCRATCH_MNT/uzero +c9c7b8791f445ec8c5fbbf82cb26b33c SCRATCH_MNT/upunch +d8bf9fa95e4a7dd228d0b03768045db9 SCRATCH_MNT/luzero +d8bf9fa95e4a7dd228d0b03768045db9 SCRATCH_MNT/lpunch +Check everything, rextsize=327680 diff --git a/tests/xfs/group b/tests/xfs/group index b89c0a4e..ffd18166 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -519,3 +519,4 @@ 519 auto quick reflink 520 auto quick reflink 521 auto quick realtime growfs +763 auto quick rw realtime From patchwork Wed Nov 11 00:44:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11895957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB86F921 for ; Wed, 11 Nov 2020 00:44:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABE1B21D7F for ; Wed, 11 Nov 2020 00:44:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Fp3WGBHK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732419AbgKKAoH (ORCPT ); Tue, 10 Nov 2020 19:44:07 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:55624 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731982AbgKKAoH (ORCPT ); Tue, 10 Nov 2020 19:44:07 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0XriW040620; Wed, 11 Nov 2020 00:44:05 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-2020-01-29; bh=q2eArdOE80pDMk36TdUAOWKFQkhyQHT7TnZusOAno0c=; b=Fp3WGBHKuk3JIIRe9kODrPwqpT+1WrUADlV23aJwly3baBK9DZyriwBi77DsPqYRuoJs +DEoF25kty0/Sv+DJX2EftkIMiwDadhsdhM9xbIsaP9DBZCHYw+LWVCaY8+gq84SNXnO wlA7Me1RKqLt9D7d0x232MS4zlnkeNAlzPtmyu9oBexSWTgEmNi1XV3+GNlHDnbbYJo6 VHVettweLywyYbj2cMwAhmzv859sPbsTKxQDcwl4kEcw0vYLnQThrlUXj7yxY4nUourq CuC5OgurX2bGWBYY8eidgcHairM9L2R0N+vi50V3F6md2gg02McLwsEf/z6bU0iZ2opQ HQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 34nh3axw3e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:44:05 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0VEIb095369; Wed, 11 Nov 2020 00:44:04 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 34p55pau1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:04 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AB0i34r029020; Wed, 11 Nov 2020 00:44:03 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:03 -0800 Subject: [PATCH 2/7] xfs: test regression in xfs_bmap_validate_extent From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: Chandan Babu R , linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:00 -0800 Message-ID: <160505544097.1388823.12979233028549388010.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong This is a regression test to make sure that we can have realtime files with xattr blocks and not trip the verifiers. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- tests/xfs/758 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/758.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 62 insertions(+) create mode 100755 tests/xfs/758 create mode 100644 tests/xfs/758.out diff --git a/tests/xfs/758 b/tests/xfs/758 new file mode 100755 index 00000000..e522ae28 --- /dev/null +++ b/tests/xfs/758 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 758 +# +# This is a regression test for "xfs: fix xfs_bmap_validate_extent_raw when +# checking attr fork of rt files", which fixes the bmap record validator so +# that it will not check the attr fork extent mappings of a realtime file +# against the size of the realtime volume. + +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 + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_realtime + +rm -f $seqres.full + +# Format filesystem with very tiny realtime volume +_scratch_mkfs -r size=256k > $seqres.full +_scratch_mount >> $seqres.full + +# Create a realtime file +$XFS_IO_PROG -f -R -c 'pwrite 0 64k' -c stat $SCRATCH_MNT/v >> $seqres.full + +# Add enough xattr data to force creation of xattr blocks at a higher address +# on the data device than the size of the realtime volume +for i in `seq 0 16`; do + $ATTR_PROG -s user.test$i $SCRATCH_MNT/v < $SCRATCH_MNT/v >> $seqres.full +done + +# Force flushing extent maps to disk to trip the verifier +_scratch_cycle_mount + +# Now let that unmount +echo Silence is golden. + +# success, all done +status=0 +exit diff --git a/tests/xfs/758.out b/tests/xfs/758.out new file mode 100644 index 00000000..6d219f8e --- /dev/null +++ b/tests/xfs/758.out @@ -0,0 +1,2 @@ +QA output created by 758 +Silence is golden. diff --git a/tests/xfs/group b/tests/xfs/group index ffd18166..771680cf 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -519,4 +519,5 @@ 519 auto quick reflink 520 auto quick reflink 521 auto quick realtime growfs +758 auto quick rw attr realtime 763 auto quick rw realtime From patchwork Wed Nov 11 00:44:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11896001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB1161668 for ; Wed, 11 Nov 2020 00:46:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4BF221D7F for ; Wed, 11 Nov 2020 00:46:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="s0hbJZUj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732361AbgKKAqP (ORCPT ); Tue, 10 Nov 2020 19:46:15 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:36110 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731234AbgKKAqP (ORCPT ); Tue, 10 Nov 2020 19:46:15 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0ZaiW016919; Wed, 11 Nov 2020 00:46:12 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-2020-01-29; bh=v1IAZkiAF3NM9o24W9oT6qepmKmulpIzg/r4pzdzeh4=; b=s0hbJZUjEJeJ2NCO2iuLk4ZdyGKXXFowjBMIgrF1MqG0E6nYGTzglfTFECzoeo5RgbGK WVsDAZR5QzMervxZklyPDsQDL4BX85jto12/IjGv+hRBSbtfUPXwsiYTRusKYsEhJSRf /lHDN+3YbnqHiIeThXvvqyZDOZO5A5hPH8XLwl74tkNs5uFxMlmSaCz85D/qZGIbtEZK EG5s+lNe7yHheVpjKF0GzeXyF2HHOFC6mtUPwSFwodoJWZc8LvLcKkV6Y36eqCB8K6+N x09bVKicTWlFgKKJsbCkyqxnWGWhpd8Ga59XfdubwFhX2wYJqSYAl9UZl9t0yRm7tU8W 1Q== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34p72emv8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:46:11 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0VEth095433; Wed, 11 Nov 2020 00:44:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34p55pau3t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:11 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AB0iAOm018286; Wed, 11 Nov 2020 00:44:10 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:09 -0800 Subject: [PATCH 3/7] generic: test reflink and copy_file_range behavior with O_SYNC and FS_XFLAG_SYNC files From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: Chandan Babu R , linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:08 -0800 Message-ID: <160505544844.1388823.7727157246785406013.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Add two regression tests to make sure that FICLONERANGE and the splice based copy_file_range actually flush all data and metadata to disk before the call ends. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- tests/generic/947 | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/947.out | 15 ++++++ tests/generic/948 | 90 ++++++++++++++++++++++++++++++++++++++ tests/generic/948.out | 9 ++++ tests/generic/group | 2 + 5 files changed, 233 insertions(+) create mode 100755 tests/generic/947 create mode 100644 tests/generic/947.out create mode 100755 tests/generic/948 create mode 100644 tests/generic/948.out diff --git a/tests/generic/947 b/tests/generic/947 new file mode 100755 index 00000000..d2adf745 --- /dev/null +++ b/tests/generic/947 @@ -0,0 +1,117 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 947 +# +# Make sure that reflink forces the log out if we open the file with O_SYNC or +# set FS_XFLAG_SYNC on the file. We test that it actually forced the log by +# using dm-error to shut down the fs without flushing the log and then +# remounting to check file contents. + +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.* + _dmerror_unmount + _dmerror_cleanup +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink +. ./common/dmerror + +# real QA test starts here +_supported_fs generic +_require_dm_target error +_require_scratch_reflink +_require_xfs_io_command "chattr" "s" +_require_cp_reflink + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_require_metadata_journaling $SCRATCH_DEV +_dmerror_init +_dmerror_mount + +# Test that O_SYNC actually results in file data being written even if the +# fs immediately dies +echo "test o_sync write" +$XFS_IO_PROG -x -f -s -c "pwrite -S 0x58 0 1m -b 1m" $SCRATCH_MNT/0 >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/0 | _filter_scratch + +# Set up initial files for reflink test +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full +$XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full +_cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e +_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d +touch $SCRATCH_MNT/b +sync + +# Test that reflink forces dirty data/metadata to disk when destination file +# opened with O_SYNC +echo "test reflink flag not set o_sync" +$XFS_IO_PROG -x -s -c "reflink $SCRATCH_MNT/a" $SCRATCH_MNT/b >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch + +# Test that reflink to a shared file forces dirty data/metadata to disk when +# destination is opened with O_SYNC +echo "test reflink flag already set o_sync" +$XFS_IO_PROG -x -s -c "reflink $SCRATCH_MNT/a" $SCRATCH_MNT/d >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/d | _filter_scratch + +# Set up the two files with chattr +S +rm -f $SCRATCH_MNT/b $SCRATCH_MNT/d +_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d +touch $SCRATCH_MNT/b +chattr +S $SCRATCH_MNT/b $SCRATCH_MNT/d +sync + +# Test that reflink forces dirty data/metadata to disk when destination file +# has the sync iflag set +echo "test reflink flag not set iflag" +$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" $SCRATCH_MNT/b >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch + +# Test that reflink to a shared file forces dirty data/metadata to disk when +# destination file has the sync iflag set +echo "test reflink flag already set iflag" +$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" $SCRATCH_MNT/d >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/d | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/947.out b/tests/generic/947.out new file mode 100644 index 00000000..05ba10d1 --- /dev/null +++ b/tests/generic/947.out @@ -0,0 +1,15 @@ +QA output created by 947 +test o_sync write +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/0 +test reflink flag not set o_sync +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/b +test reflink flag already set o_sync +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/d +test reflink flag not set iflag +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/b +test reflink flag already set iflag +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/d diff --git a/tests/generic/948 b/tests/generic/948 new file mode 100755 index 00000000..83fe414b --- /dev/null +++ b/tests/generic/948 @@ -0,0 +1,90 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 948 +# +# Make sure that copy_file_range forces the log out if we open the file with +# O_SYNC or set FS_XFLAG_SYNC on the file. We test that it actually forced the +# log by using dm-error to shut down the fs without flushing the log and then +# remounting to check file contents. + +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.* + _dmerror_unmount + _dmerror_cleanup +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/dmerror + +# real QA test starts here +_supported_fs generic +_require_dm_target error +_require_xfs_io_command "chattr" "s" + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_require_metadata_journaling $SCRATCH_DEV +_dmerror_init +_dmerror_mount + +# Test that O_SYNC actually results in file data being written even if the +# fs immediately dies +echo "test o_sync write" +$XFS_IO_PROG -x -f -s -c "pwrite -S 0x58 0 1m -b 1m" $SCRATCH_MNT/0 >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/0 | _filter_scratch + +# Set up initial files for copy test +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full +touch $SCRATCH_MNT/b +sync + +# Test that unaligned copy file range forces dirty data/metadata to disk when +# destination file opened with O_SYNC +echo "test unaligned copy range o_sync" +$XFS_IO_PROG -x -s -c "copy_range -s 13 -d 13 -l 1048550 $SCRATCH_MNT/a" $SCRATCH_MNT/b >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch + +# Set up dest file with chattr +S +rm -f $SCRATCH_MNT/b +touch $SCRATCH_MNT/b +chattr +S $SCRATCH_MNT/b +sync + +# Test that unaligned copy file range forces dirty data/metadata to disk when +# destination file has the sync iflag set +echo "test unaligned copy range iflag" +$XFS_IO_PROG -x -c "copy_range -s 13 -d 13 -l 1048550 $SCRATCH_MNT/a" $SCRATCH_MNT/b >> $seqres.full +_dmerror_load_error_table +_dmerror_unmount +_dmerror_load_working_table +_dmerror_mount +md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/948.out b/tests/generic/948.out new file mode 100644 index 00000000..eec6c0dc --- /dev/null +++ b/tests/generic/948.out @@ -0,0 +1,9 @@ +QA output created by 948 +test o_sync write +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/0 +test unaligned copy range o_sync +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +2a715d2093b5aca82783a0c5943ac0b8 SCRATCH_MNT/b +test unaligned copy range iflag +310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a +2a715d2093b5aca82783a0c5943ac0b8 SCRATCH_MNT/b diff --git a/tests/generic/group b/tests/generic/group index ab8ae74e..4300158e 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -617,3 +617,5 @@ 612 auto quick clone 613 auto quick encrypt 614 auto quick rw +947 auto quick rw clone +948 auto quick rw copy_range From patchwork Wed Nov 11 00:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11895961 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F3781668 for ; Wed, 11 Nov 2020 00:44:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F13821D7F for ; Wed, 11 Nov 2020 00:44:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="w/2b7Njl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731982AbgKKAoW (ORCPT ); Tue, 10 Nov 2020 19:44:22 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:48132 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731713AbgKKAoU (ORCPT ); Tue, 10 Nov 2020 19:44:20 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0XmNV110546; Wed, 11 Nov 2020 00:44:18 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-2020-01-29; bh=GMDBIQZgzTV4yfSlXmY2gi1N9EFGXPHdydeM8RSOY7E=; b=w/2b7NjlbwkXMmmkdNZGOODwozsyvQrsQlckD5uOeqogZp0jxu4On/nZX/RPycewK7X/ uYkl5orh/jks4io2ztG9Q/jGBi/+uW15TVnE6V/fad5jffhbDEBwXJJEXUAk8Q97dxd8 3P+tUn665UFhFxpUB1WM2zryOdhX/j56LJ78ZMcyko5/CUSOTkaAWS18JSptWqTBrKDI jJWfODeTtGM1I6G9u7J+htBIjXGJ8fm8/kh/A87lu6cIWIEQ+8XN7OvQOsY2DUdCt2Qd TmEe+8WLh/NQkzeChsgB3gosnuRVNLf5bmNSc++6C3KpWVjZmbAx8NiRC1y/xKY8XzZI Nw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34nkhkxnnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:44:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0V7pT027737; Wed, 11 Nov 2020 00:44:17 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 34qgp7kqyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:17 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AB0iG7l029148; Wed, 11 Nov 2020 00:44:17 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:16 -0800 Subject: [PATCH 4/7] xfs: test rtalloc alignment and math errors From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:15 -0800 Message-ID: <160505545554.1388823.7888218443336440186.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Add a couple of regression tests for "xfs: make sure the rt allocator doesn't run off the end" and "xfs: ensure that fpunch, fcollapse, and finsert operations are aligned to rt extent size". Signed-off-by: Darrick J. Wong --- tests/xfs/759 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/759.out | 2 + tests/xfs/760 | 66 +++++++++++++++++++++++++++++++++++ tests/xfs/760.out | 9 +++++ tests/xfs/group | 2 + 5 files changed, 178 insertions(+) create mode 100755 tests/xfs/759 create mode 100644 tests/xfs/759.out create mode 100755 tests/xfs/760 create mode 100644 tests/xfs/760.out diff --git a/tests/xfs/759 b/tests/xfs/759 new file mode 100755 index 00000000..00573786 --- /dev/null +++ b/tests/xfs/759 @@ -0,0 +1,99 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 759 +# +# This is a regression test for an overflow error in the _near realtime +# allocator. If the rt bitmap ends exactly at the end of a block and the +# number of rt extents is large enough to allow an allocation request larger +# than the maximum extent size, it's possible that during a large allocation +# request, the allocator will fail to constrain maxlen on the second run +# through the loop, and the rt bitmap range check will run right off the end of +# the rtbitmap file. When this happens, xfs triggers a verifier error and +# returns EFSCORRUPTED. + +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 + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_realtime +_require_test_program "punch-alternating" + +rm -f $seqres.full + +# Format filesystem to get the block size +_scratch_mkfs > $seqres.full +_scratch_mount >> $seqres.full + +blksz=$(_get_block_size $SCRATCH_MNT) +rextsize=$($XFS_INFO_PROG $SCRATCH_MNT | grep realtime.*extsz | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +rextblks=$((rextsize / blksz)) + +echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full + +_scratch_unmount + +# Format filesystem with a realtime volume whose size fits the following: +# 1. Longer than (XFS MAXEXTLEN * blocksize) bytes. +# 2. Exactly a multiple of (NBBY * blksz * rextsize) bytes. + +rtsize1=$((2097151 * blksz)) +rtsize2=$((8 * blksz * rextsize)) +rtsize=$(( $(blockdev --getsz $SCRATCH_RTDEV) * 512 )) + +echo "rtsize1 $rtsize1 rtsize2 $rtsize2 rtsize $rtsize" >> $seqres.full + +test $rtsize -gt $rtsize1 || \ + _notrun "scratch rt device too small, need $rtsize1 bytes" +test $rtsize -gt $rtsize2 || \ + _notrun "scratch rt device too small, need $rtsize2 bytes" + +rtsize=$((rtsize - (rtsize % rtsize2))) + +echo "rt size will be $rtsize" >> $seqres.full + +_scratch_mkfs -r size=$rtsize >> $seqres.full +_scratch_mount >> $seqres.full + +# Make sure the root directory has rtinherit set so our test file will too +$XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT + +# Allocate some stuff at the start, to force the first falloc of the ouch file +# to happen somewhere in the middle of the rt volume +$XFS_IO_PROG -f -c 'falloc 0 64m' "$SCRATCH_MNT/b" +$here/src/punch-alternating -i $((rextblks * 2)) -s $((rextblks)) "$SCRATCH_MNT/b" + +avail="$(df -P "$SCRATCH_MNT" | awk 'END {print $4}')"1 +toobig="$((avail * 2))" + +# falloc the ouch file in the middle of the rt extent to exercise the near +# allocator in the last step. +$XFS_IO_PROG -f -c 'falloc 0 1g' "$SCRATCH_MNT/ouch" + +# Try to get the near allocator to overflow on an allocation that matches +# exactly one of the rtsummary size levels. This should return ENOSPC and +# not EFSCORRUPTED. +$XFS_IO_PROG -f -c "falloc 0 ${toobig}k" "$SCRATCH_MNT/ouch" + +# success, all done +status=0 +exit diff --git a/tests/xfs/759.out b/tests/xfs/759.out new file mode 100644 index 00000000..df693d50 --- /dev/null +++ b/tests/xfs/759.out @@ -0,0 +1,2 @@ +QA output created by 759 +fallocate: No space left on device diff --git a/tests/xfs/760 b/tests/xfs/760 new file mode 100755 index 00000000..7baa346c --- /dev/null +++ b/tests/xfs/760 @@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 760 +# +# Make sure we validate realtime extent size alignment for fallocate modes. + +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 + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_realtime +_require_xfs_io_command "fcollapse" +_require_xfs_io_command "finsert" +_require_xfs_io_command "funshare" +_require_xfs_io_command "fzero" +_require_xfs_io_command "falloc" + +rm -f $seqres.full + +# Format filesystem with a 256k realtime extent size +_scratch_mkfs -r extsize=256k > $seqres.full +_scratch_mount >> $seqres.full + +blksz=$(_get_block_size $SCRATCH_MNT) +rextsize=$($XFS_INFO_PROG $SCRATCH_MNT | grep realtime.*extsz | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +rextblks=$((rextsize / blksz)) + +echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full + +# Make sure the root directory has rtinherit set so our test file will too +$XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT + +sz=$((rextsize * 100)) +range="$((blksz * 3)) $blksz" + +for verb in fpunch finsert fcollapse fzero funshare falloc; do + echo "test $verb" + $XFS_IO_PROG -f -c "falloc 0 $sz" "$SCRATCH_MNT/b" + $XFS_IO_PROG -f -c "$verb $range" "$SCRATCH_MNT/b" + rm -f "$SCRATCH_MNT/b" + _scratch_cycle_mount +done + +# success, all done +status=0 +exit diff --git a/tests/xfs/760.out b/tests/xfs/760.out new file mode 100644 index 00000000..3d73c6fa --- /dev/null +++ b/tests/xfs/760.out @@ -0,0 +1,9 @@ +QA output created by 760 +test fpunch +test finsert +fallocate: Invalid argument +test fcollapse +fallocate: Invalid argument +test fzero +test funshare +test falloc diff --git a/tests/xfs/group b/tests/xfs/group index 771680cf..cb55a8ff 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -520,4 +520,6 @@ 520 auto quick reflink 521 auto quick realtime growfs 758 auto quick rw attr realtime +759 auto quick rw realtime +760 auto quick rw collapse punch insert zero prealloc 763 auto quick rw realtime From patchwork Wed Nov 11 00:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11895965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBB241668 for ; Wed, 11 Nov 2020 00:44:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95F9D21D7F for ; Wed, 11 Nov 2020 00:44:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="NaihXQzf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732421AbgKKAo2 (ORCPT ); Tue, 10 Nov 2020 19:44:28 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:48188 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731713AbgKKAo0 (ORCPT ); Tue, 10 Nov 2020 19:44:26 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0XwYX110639; Wed, 11 Nov 2020 00:44:24 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-2020-01-29; bh=p3IoS/TCxNzUjHVvmJQZ5eqdpq30LQbi99ALCACjd5E=; b=NaihXQzfgrB1kJnKPGCGvD6C1tjresYSWms9L1Yql9J9mQnl+p3TNYx/a9woeIUHnmBv dfE291CmyWaPaj0eOBp/zlrs75KuGmYF6SDHusgWmWsXuNlJTL4Tsq489aHrsNTI4zBI K3qO1Gx2bXgakY6LDX/pv1Ozi1KEyZ9ZBLcw4o+o5QemDo69NUfCAAKZLCJLRiaU22a9 8cj62HefWRGG18ebimwYh4wZKrCBOuC2XNnE8F1YReUaf6RxrABDGoUrYXmHF/dbGNq/ X8H6fX9UZ47if6IgGz4g60VRa6vKdxNYKjGxOlWCCsq5ZnUyNGk0ERvbvPtHWnwTjxrc tQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 34nkhkxnnr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:44:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0VEtk095433; Wed, 11 Nov 2020 00:44:24 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 34p55pau7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:24 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AB0iNkl000863; Wed, 11 Nov 2020 00:44:23 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:22 -0800 Subject: [PATCH 5/7] xfs: test mkfs min log size calculation w/ rt volumes From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:21 -0800 Message-ID: <160505546184.1388823.6675430976638809308.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong In "mkfs: set required parts of the realtime geometry before computing log geometry" we made sure that mkfs set up enough of the fs geometry to compute the minimum xfs log size correctly when formatting the filesystem. This is the regression test for that issue. Signed-off-by: Darrick J. Wong --- tests/xfs/761 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/761.out | 1 + tests/xfs/group | 1 + 3 files changed, 44 insertions(+) create mode 100755 tests/xfs/761 create mode 100644 tests/xfs/761.out diff --git a/tests/xfs/761 b/tests/xfs/761 new file mode 100755 index 00000000..36877bc9 --- /dev/null +++ b/tests/xfs/761 @@ -0,0 +1,42 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle. All Rights Reserved. +# +# FS QA Test No. 761 +# +# Make sure mkfs sets up enough of the rt geometry that we can compute the +# correct min log size for formatting the fs. + +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 + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_realtime + +rm -f $seqres.full + +# Format a tiny filesystem to force minimum log size, then see if it mounts +_scratch_mkfs -r size=1m -d size=100m > $seqres.full +_scratch_mount >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/761.out b/tests/xfs/761.out new file mode 100644 index 00000000..8c9d9e90 --- /dev/null +++ b/tests/xfs/761.out @@ -0,0 +1 @@ +QA output created by 761 diff --git a/tests/xfs/group b/tests/xfs/group index cb55a8ff..74f0d37c 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -522,4 +522,5 @@ 758 auto quick rw attr realtime 759 auto quick rw realtime 760 auto quick rw collapse punch insert zero prealloc +761 auto quick realtime 763 auto quick rw realtime From patchwork Wed Nov 11 00:44:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11895969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A556921 for ; Wed, 11 Nov 2020 00:44:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26EAF21D46 for ; Wed, 11 Nov 2020 00:44:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="T4WWrlZi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732426AbgKKAof (ORCPT ); Tue, 10 Nov 2020 19:44:35 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:48268 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731713AbgKKAof (ORCPT ); Tue, 10 Nov 2020 19:44:35 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0Xm4j110545; Wed, 11 Nov 2020 00:44:31 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-2020-01-29; bh=uhPgof/e9B7qGxLr1P/KJ+Ja5erJrvSl03qEyIlJQ8s=; b=T4WWrlZiy2cKNtofel7yKTI0hmdirJqKSv0KhXlLqfFLkcY9swURJYwf5VJysy8WD885 4KA5v+jNEKdR13UuRsoyMF9Pft/0NxoUSRDRfhQkjcK1fRio/oa0O9n2djObQxiL0SMo sgU8mL6cALI5+gjgap7rAJ51FzzghkexF9C5q6U/Ci5nWa7NRt2I/tiD+ZPsE+OoZvi5 zBTWXrx8GdA8onQEELEuU0aWF5S43kwxGvL7yB5bN24pdk/z/scLOtfRzPzMl8SvP2fH JSiIg4kkUdfRKQDfeJEXB0oBzyyV68Wp6yMz/ZqAuwSDnRIjFA9+nk35e+l98H7RXVKU AA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34nkhkxnnv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:44:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0V65b027434; Wed, 11 Nov 2020 00:44:30 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 34qgp7kr2t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:30 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AB0iTFU014020; Wed, 11 Nov 2020 00:44:29 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:29 -0800 Subject: [PATCH 6/7] xfs: test quota softlimit warning functionality From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:28 -0800 Message-ID: <160505546820.1388823.9325928100187068577.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Make sure that quota softlimits work, which is to say that one can exceed the softlimit up to warnlimit times before it starts enforcing that. Signed-off-by: Darrick J. Wong --- tests/xfs/915 | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/915.out | 151 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 3 files changed, 328 insertions(+) create mode 100755 tests/xfs/915 create mode 100644 tests/xfs/915.out diff --git a/tests/xfs/915 b/tests/xfs/915 new file mode 100755 index 00000000..0a37a1b5 --- /dev/null +++ b/tests/xfs/915 @@ -0,0 +1,176 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 915 +# +# Check that quota softlimit warnings work the way they should. This means +# that we can disobey the softlimit up to warnlimit times before it turns into +# hard(er) enforcement. + +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/quota + +# real QA test starts here +_supported_fs xfs +_require_xfs_quota +_require_scratch + +rm -f $seqres.full + +filter_report() +{ + tr -s '[:space:]' | \ + perl -npe ' + s/^\#'$id' /[NAME] /g; + s/^\#0 \d+ /[ROOT] 0 /g; + s/6 days/7 days/g' | + perl -npe ' + $val = 0; + if ($ENV{'LARGE_SCRATCH_DEV'}) { + $val = $ENV{'NUM_SPACE_FILES'}; + } + s/(^\[ROOT\] \S+ \S+ \S+ \S+ \[--------\] )(\S+)/$1@{[$2 - $val]}/g' | + perl -npe ' + s|^(.*?) (\d+) (\d+) (\d+)|$1 @{[$2 * 1024 /'$bsize']} @{[$3 * 1024 /'$bsize']} @{[$4 * 1024 /'$bsize']}|' +} + +qsetup() +{ + opt=$1 + enforce=0 + if [ $opt = "u" -o $opt = "uno" ]; then + type=u + eval `_choose_uid` + elif [ $opt = "g" -o $opt = "gno" ]; then + type=g + eval `_choose_gid` + elif [ $opt = "p" -o $opt = "pno" ]; then + type=p + eval `_choose_prid` + fi + [ $opt = "u" -o $opt = "g" -o $opt = "p" ] && enforce=1 + + echo "Using type=$type id=$id" >> $seqres.full +} + +exercise() { + _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs + cat $tmp.mkfs >>$seqres.full + + # keep the blocksize and data size for dd later + . $tmp.mkfs + + _qmount + + qsetup $1 + + echo "Using type=$type id=$id" >>$seqres.full + + echo + echo "*** report initial settings" | tee -a $seqres.full + $XFS_QUOTA_PROG -x \ + -c "limit -$type isoft=3 ihard=500000 $id" \ + -c "warn -$type -i -d 13" \ + $SCRATCH_DEV + $XFS_QUOTA_PROG -x \ + -c "state -$type" >> $seqres.full + $XFS_QUOTA_PROG -x \ + -c "repquota -birnN -$type" $SCRATCH_DEV | + filter_report | LC_COLLATE=POSIX sort -ru + + echo + echo "*** push past the soft inode limit" | tee -a $seqres.full + _file_as_id $SCRATCH_MNT/softok1 $id $type $bsize 0 + _file_as_id $SCRATCH_MNT/softok2 $id $type $bsize 0 + _file_as_id $SCRATCH_MNT/softok3 $id $type $bsize 0 + _file_as_id $SCRATCH_MNT/softwarn1 $id $type $bsize 0 + $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ + -c "repquota -birnN -$type" $SCRATCH_DEV | + filter_report | LC_COLLATE=POSIX sort -ru + + echo + echo "*** push further past the soft inode limit" | tee -a $seqres.full + for warn_nr in $(seq 2 5); do + _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0 + done + $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ + -c "repquota -birnN -$type" $SCRATCH_DEV | + filter_report | LC_COLLATE=POSIX sort -ru + + echo + echo "*** push past the soft inode warning limit" | tee -a $seqres.full + for warn_nr in $(seq 6 15); do + _file_as_id $SCRATCH_MNT/softwarn$warn_nr $id $type $bsize 0 + done + $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \ + -c "repquota -birnN -$type" $SCRATCH_DEV | + filter_report | LC_COLLATE=POSIX sort -ru + + echo + echo "*** unmount" + _scratch_unmount +} + +_scratch_mkfs > $seqres.full +_scratch_mount >> $seqres.full + +chmod a+rwx $SCRATCH_MNT $seqres.full # arbitrary users will write here +bsize=$(_get_file_block_size $SCRATCH_MNT) +_scratch_unmount + +cat >$tmp.projects <$tmp.projid < X-Patchwork-Id: 11895973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4C131668 for ; Wed, 11 Nov 2020 00:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF4F221D7F for ; Wed, 11 Nov 2020 00:44:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="d0YV9Jx8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732429AbgKKAok (ORCPT ); Tue, 10 Nov 2020 19:44:40 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:35160 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731713AbgKKAoj (ORCPT ); Tue, 10 Nov 2020 19:44:39 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0ZaiR016919; Wed, 11 Nov 2020 00:44:37 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-2020-01-29; bh=atYemPZBsWov6lHhJQg/LW4GDgtllAhk02fu6dVnZhk=; b=d0YV9Jx8TdsNZZGzfyLhegopgg9q+jWga5S9gvVFiz9/SoXaAXpKGW6GnMdwebslU4XF lsTRErrGcNP1Shorq5iwKOogz04W3dxT1CYu17rp4iqNW82Y9ubl+J/FspHozZ8gABrP PDpaG3mvDqQtroH+GGbCxkMRQA99C93yQkM5hTmBCwfloKFC3hhiuTGebjv2pHxjMBlD ZSCesukiCuZVHPuwBMv066gDsZAZlfFpMWzcc6T/dHdOPtSEzpmTF+4ZMTGkmuBkCzMo FL+VKOx/bnwEuOTbd1GveJS9/2pTQtsl9T4rUmlJxq0fYyOHjyiJxtYbGXke1FgEStWW gw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34p72emv63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 00:44:37 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AB0VEC2095386; Wed, 11 Nov 2020 00:44:36 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 34p55paub8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Nov 2020 00:44:36 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AB0ianc014027; Wed, 11 Nov 2020 00:44:36 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Nov 2020 16:44:35 -0800 Subject: [PATCH 7/7] xfs/122: fix test for xfs_attr_shortform_t conversion From: "Darrick J. Wong" To: darrick.wong@oracle.com, guaneryu@gmail.com Cc: Chandan Babu R , linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 10 Nov 2020 16:44:34 -0800 Message-ID: <160505547480.1388823.13194081097582987.stgit@magnolia> In-Reply-To: <160505542802.1388823.10368384826199448253.stgit@magnolia> References: <160505542802.1388823.10368384826199448253.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9801 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011110001 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The typedef xfs_attr_shortform_t was converted to a struct in 5.10. Update this test to pass. Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- tests/xfs/122 | 1 - tests/xfs/122.out | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/122 b/tests/xfs/122 index a4248031..322e1d81 100755 --- a/tests/xfs/122 +++ b/tests/xfs/122 @@ -72,7 +72,6 @@ for hdr in /usr/include/xfs/xfs*.h; do done # missing: -# xfs_attr_shortform_t # xfs_trans_header_t cat >$tmp.ignore <