From patchwork Tue Oct 27 19:02:37 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: 11861587 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 964EE14B4 for ; Tue, 27 Oct 2020 19:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F3F221556 for ; Tue, 27 Oct 2020 19:04:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dNy2H4lr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1829333AbgJ0TEn (ORCPT ); Tue, 27 Oct 2020 15:04:43 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50674 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1829330AbgJ0TEn (ORCPT ); Tue, 27 Oct 2020 15:04:43 -0400 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 09RIsvGh111768; Tue, 27 Oct 2020 19:04:40 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=qsNfI1wuTKWJ8pWR0QHvQzeLVrIEeYFFqFbpNG8gLbs=; b=dNy2H4lrTv8jd6LigQym5lKgqrRHXOXx8gXjiy77v5YoRJWD9H0CAkeJAYxmAHpDJuyS 9xj2JBLEo462LX0rTazgGPa3jGO0gLbkjfmCETy0Gh5aemAIz7yB0pgsN2i6+xdwm100 bqZ7NUd6p5iHWGyB/uLY40dHEX1gk8EFCkbFAEkzevqt+Qz2vzl0xdiVJyr+zjUp6pFn iEMxmc1oI1egojfbrrD+gHBvIh/8SUNpvkkoeOvlmDWXxRPgCMvOgCdp41IBTBbcSPTK rHw5A5oE2N7lXYTCg7C2Ht+1SYQ6PyvKzJEW/MUVn7AQNr57kcSF56tSCxFmdYHaydNI xg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 34dgm41fbn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:04:40 +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 09RIuK5W090794; Tue, 27 Oct 2020 19:02:39 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 34cx1r3ux7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:02:39 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09RJ2cnC006321; Tue, 27 Oct 2020 19:02:38 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:02:38 -0700 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: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 27 Oct 2020 12:02:37 -0700 Message-ID: <160382535741.1203387.10647004373989609905.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 Tue Oct 27 19:02:43 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: 11861521 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 33A8F14B7 for ; Tue, 27 Oct 2020 19:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11F46206DD for ; Tue, 27 Oct 2020 19:02:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Dhe2XsVk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501931AbgJ0TCt (ORCPT ); Tue, 27 Oct 2020 15:02:49 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:49052 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2501925AbgJ0TCs (ORCPT ); Tue, 27 Oct 2020 15:02:48 -0400 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 09RIsWk3111613; Tue, 27 Oct 2020 19:02:47 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=x6X8CAPXSwzRKFdwyvfXNGe4FWpLJ7uTCv7q/sUXCQU=; b=Dhe2XsVk7g4MQNeA9sK6fN7dldEisRJ688VFcDkBV8YnjjtSJp+TEPgqziPNN6WAwk+D gMq4TByARuIXCeEThceuMgEdTCqRH9NuryX8puxqdkhREheqRL8/9vrLn/RAHRZ4q0tz 7n9GW54tgOc2uj/JG1v3HKKQAEupkAuVbDNea0QOV0vExrKCeh7b9jUlAiD6AZv4HJQN W4328lQVMmBPVKFOhdSvcer2c78kga+9WH6ax3vk1vnwKZf4SdEqmDM5r1bEJ/4w7KnR QUXnhPAMgi1N6cbTRnNAaOWee/m2umkhd4COAJwGXQW1UyUKU59QksDktf/IPY37QcLt pA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm41f29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:02:46 +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 09RIsQDD076607; Tue, 27 Oct 2020 19:02:46 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 34cwumrj9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:02:46 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09RJ2ii4001365; Tue, 27 Oct 2020 19:02:45 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:02:44 -0700 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: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 27 Oct 2020 12:02:43 -0700 Message-ID: <160382536365.1203387.5299416996869850602.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 Tue Oct 27 19:02:49 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: 11861525 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 3CF4E14B7 for ; Tue, 27 Oct 2020 19:02:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14A4B21D42 for ; Tue, 27 Oct 2020 19:02:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BYdMYmNF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444503AbgJ0TC5 (ORCPT ); Tue, 27 Oct 2020 15:02:57 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:49156 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444454AbgJ0TC5 (ORCPT ); Tue, 27 Oct 2020 15:02:57 -0400 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 09RIt7d8111840; Tue, 27 Oct 2020 19:02:54 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=a8gBD1fea/H0dPH8kOtihSUREK4EHt25aOvKmGd+btk=; b=BYdMYmNFYSacSHWqpETAyfzbFiROR9XVhSZa3FHaCqXn/ltjiMS688V+uV+7uFHoRU9L zHWvtImYHCWFZJfv2dqHGzKCNN3ZJNOuisJL+5dVFNeLvThNSkN1UlL0QKHxPZPMzUBm cWXqcm0xKnltrV03lYm9Q8RT5K6qY9MNfKwkD96UFmoVYRG+1eSUXLWYfgytw+lc8bmY mNgQqjFUR694CfOhGiDNhhxR7HWbXyrxYAjcLb8VQtmte5+0jyV6UY1WoD4lhthVbp/Z uRbMjoxwiA5IPVWODUgHKTzHGf8SJ1UZF43995fbhiSRQR40t4eQvcxeMgvg1LF7z4TD yw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm41f2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:02:53 +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 09RIsPhO076554; Tue, 27 Oct 2020 19:02:53 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34cwumrjc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:02:52 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09RJ2qt9006394; Tue, 27 Oct 2020 19:02:52 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:02:52 -0700 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: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 27 Oct 2020 12:02:49 -0700 Message-ID: <160382536986.1203387.16617757455373368775.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 8054d874..cf4fdc23 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -615,3 +615,5 @@ 610 auto quick prealloc zero 611 auto quick attr 612 auto quick clone +947 auto quick rw clone +948 auto quick rw copy_range From patchwork Tue Oct 27 19:02:57 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: 11861529 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 D67C314B7 for ; Tue, 27 Oct 2020 19:03:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1DE421D42 for ; Tue, 27 Oct 2020 19:03:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ac3IDRp7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501925AbgJ0TDF (ORCPT ); Tue, 27 Oct 2020 15:03:05 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:49280 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444462AbgJ0TDE (ORCPT ); Tue, 27 Oct 2020 15:03:04 -0400 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 09RIsVbD111546; Tue, 27 Oct 2020 19:03:01 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=ac3IDRp7CED8Pv4IK9wmusKjNI/lowo6kvGhCoU6MmuEan+cOmUz5S2axXlIBHbfHtp9 V+LJvYGrNH9KbwJiOIVehnE83qq39Dq7g9bfT7HgzgVcxI9tp+sSpZpLwi+IvQBECK3d VAFBVpdFtEyMg8klIkFfZtlmhaOkumK00KfvyzrG4oj+vhOZU+3otoNgUHGZwccubJQf IENQLuBOJ0oXhvnbIrAEsNFptDmwjOI8k0cTzbd/UFB3rkTix2duPZ3gsfWfo4lI1ftm b8ZQYoxUdGhP+fARibybNmyjsph0g5gq2l4tOLhllaX4pYzcZJo2ZaGiqidnyekKIW3b lQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34dgm41f3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:03:01 +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 09RItKNA019925; Tue, 27 Oct 2020 19:03:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 34cx6wbn4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:03:01 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09RJ30M6001422; Tue, 27 Oct 2020 19:03:00 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:02:58 -0700 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, 27 Oct 2020 12:02:57 -0700 Message-ID: <160382537749.1203387.6096490479349127304.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 Tue Oct 27 19:03:03 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: 11861591 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 4C41114B7 for ; Tue, 27 Oct 2020 19:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25BF921527 for ; Tue, 27 Oct 2020 19:05:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="h4L7KTAa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S460393AbgJ0TFI (ORCPT ); Tue, 27 Oct 2020 15:05:08 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:48576 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460386AbgJ0TFI (ORCPT ); Tue, 27 Oct 2020 15:05:08 -0400 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 09RIt6wZ108088; Tue, 27 Oct 2020 19:05:06 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=h4L7KTAay9aF1tTU6Os5KDzGUSul5bG4gJBt2lT+yysEnTChQFGbldb42CLNJqQjxu9p i11yr0Wi3yT6K4sl99mQ7QRhzdJRwQFoV9oCizIKF1MThSgLAN3aCgHr4TfOSS2uxaH1 WyWV+M+17HguHsa9K/RLqTB7vWk+AWcipHlBVQTHPGShKv1UvVGbaYedkMI5GYwxahOV j7rq1ME755q1STUtDD9BOousKo+nS3SCHAimb0vt/Pvufo6FyNKvyJkm2QLBxbBBzjDO U7Eh4neiSb5NO1FFcyU0iQIbI7ZRvzD1Qd2ZPqXC6RR4XR+EGoWKlUk/jdqc34XQtH3J Fw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 34cc7kuv48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:05:06 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09RIu2LW133050; Tue, 27 Oct 2020 19:03:06 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 34cx5xg8u3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:03:06 +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 09RJ34nb027928; Tue, 27 Oct 2020 19:03:05 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:03:04 -0700 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, 27 Oct 2020 12:03:03 -0700 Message-ID: <160382538373.1203387.11759890489099193473.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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 Tue Oct 27 19:03:09 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: 11861533 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 4FBB514B7 for ; Tue, 27 Oct 2020 19:03:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B44421D7B for ; Tue, 27 Oct 2020 19:03:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iVlQ60Iv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501971AbgJ0TDU (ORCPT ); Tue, 27 Oct 2020 15:03:20 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:56606 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444462AbgJ0TDU (ORCPT ); Tue, 27 Oct 2020 15:03:20 -0400 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 09RIthIr022170; Tue, 27 Oct 2020 19:03:16 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=iVlQ60Iv7j3LJ9DLO27SN2jWSEI7r/zOmtsyVdt6WmCTn7PpuUUuP9pFkW+Z1bqY1WLl UFXdChnm5sbM6GiWSeMFRneEGz6PJS95Ledt4NWRWq2aY9CywdoD42FyelsjRkt6DvRq Hf2jdF+Tr8FmnlTO3PTTe3EKJMvMZWCi1ZX5rGKx72u94RG30qmqCljeV8L+Cq1HMbGP 0C8nV0eWc4NMAG9XmtJh8Wl1sPbdWofsefyxqPdE55ft7bPT5SzufTf6PleJ96ZmC+gj Pjadv3oyADCYa/y1lPu96ooROdTPcsjkbYzxXUVLZ1nBX896bMzJF2Qa9jl6PUFpzwK1 sg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 34c9sav09x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:03:16 +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 09RItJsv019768; Tue, 27 Oct 2020 19:03:15 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 34cx6wbnaf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:03:15 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09RJ3EDO001593; Tue, 27 Oct 2020 19:03:15 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:03:10 -0700 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, 27 Oct 2020 12:03:09 -0700 Message-ID: <160382538988.1203387.8122059769450904973.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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: 11861541 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 DAED714B7 for ; Tue, 27 Oct 2020 19:03:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B464421D42 for ; Tue, 27 Oct 2020 19:03:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Wi+VuTBl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502012AbgJ0TD2 (ORCPT ); Tue, 27 Oct 2020 15:03:28 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:56720 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444462AbgJ0TD1 (ORCPT ); Tue, 27 Oct 2020 15:03:27 -0400 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 09RItfgV022147; Tue, 27 Oct 2020 19:03:23 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=MBp5JDLnjyovIn4qBfQY5XOFnv86eLSoBvuY8mjHxjU=; b=Wi+VuTBlG57EYYtqsr5nXhS35ZDSnN/n8rm2wjyJe9dLSioHRUGafRUcRiv9KqqRLBRR JrXYvRZT6Mmsc00JJBV1HFrTLLpGUgUfGMowJG2yU2DuhcOluFGCxPshavZISJLTYFTr DG/pXXLtkVznBX6sXAIPjBHbV0CdXm2SCTVEICbHCHjBuodnMRat3ThFBiTCrsrk02Lq Ln4QDedbYLBDR89W+Ed5XEG8m8zyixihq7PSnlEt2POfxCpGpkDp5FFzkP78Z2Zby1fl PEMBAoEzihgMLY2tx/xBivYpM2bvrBhxp97yqfEdVuvfrFLGp9TyJ611qIVo2KDMJP6O eA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 34c9sav0am-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Oct 2020 19:03:23 +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 09RIsQFV076628; Tue, 27 Oct 2020 19:03:23 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 34cwumrjts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Oct 2020 19:03:23 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09RJ3Llq028006; Tue, 27 Oct 2020 19:03:22 GMT Received: from localhost (/10.159.243.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Oct 2020 12:03:17 -0700 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: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 27 Oct 2020 12:03:16 -0700 Message-ID: <160382539620.1203387.14717204905418805283.stgit@magnolia> In-Reply-To: <160382535113.1203387.16777876271740782481.stgit@magnolia> References: <160382535113.1203387.16777876271740782481.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9787 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270110 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 45c42e59..cfe09c6d 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -62,6 +62,7 @@ sizeof(struct xfs_agfl) = 36 sizeof(struct xfs_attr3_leaf_hdr) = 80 sizeof(struct xfs_attr3_leafblock) = 88 sizeof(struct xfs_attr3_rmt_hdr) = 56 +sizeof(struct xfs_attr_shortform) = 8 sizeof(struct xfs_btree_block) = 72 sizeof(struct xfs_btree_block_lhdr) = 64 sizeof(struct xfs_btree_block_shdr) = 48