From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25E3DC34031 for ; Wed, 19 Feb 2020 02:02:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F013124654 for ; Wed, 19 Feb 2020 02:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbgBSCCE (ORCPT ); Tue, 18 Feb 2020 21:02:04 -0500 Received: from sandeen.net ([63.231.237.45]:49140 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727811AbgBSCCE (ORCPT ); Tue, 18 Feb 2020 21:02:04 -0500 Received: from [10.0.0.4] (liberator [10.0.0.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id A20772A76; Tue, 18 Feb 2020 20:01:48 -0600 (CST) Subject: Re: [RFC PATCH] xfs: make sure our default quota warning limits and grace periods survive quotacheck To: "Darrick J. Wong" , Eric Sandeen , Eryu Guan Cc: xfs , fstests References: <20200219003423.GB9511@magnolia> From: Eric Sandeen Autocrypt: addr=sandeen@sandeen.net; prefer-encrypt=mutual; keydata= mQINBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaS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DAAKCRAgrhaS4T3e4BKwD/0ZOOmUNOZCSOLAMjZx3mtYtjYgfUNKi0ki YPveGoRWTqbis8UitPtNrG4XxgzLOijSdOEzQwkdOIp/QnZhGNssMejCnsluK0GQd+RkFVWN mcQT78hBeGcnEMAXZKq7bkIKzvc06GFmkMbX/gAl6DiNGv0UNAX+5FYh+ucCJZSyAp3sA+9/ LKjxnTedX0aygXA6rkpX0Y0FvN/9dfm47+LGq7WAqBOyYTU3E6/+Z72bZoG/cG7ANLxcPool LOrU43oqFnD8QwcN56y4VfFj3/jDF2MX3xu4v2OjglVjMEYHTCxP3mpxesGHuqOit/FR+mF0 MP9JGfj6x+bj/9JMBtCW1bY/aPeMdPGTJvXjGtOVYblGZrSjXRn5++Uuy36CvkcrjuziSDG+ JEexGxczWwN4mrOQWhMT5Jyb+18CO+CWxJfHaYXiLEW7dI1AynL4jjn4W0MSiXpWDUw+fsBO Pk6ah10C4+R1Jc7dyUsKksMfvvhRX1hTIXhth85H16706bneTayZBhlZ/hK18uqTX+s0onG/ m1F3vYvdlE4p2ts1mmixMF7KajN9/E5RQtiSArvKTbfsB6Two4MthIuLuf+M0mI4gPl9SPlf fWCYVPhaU9o83y1KFbD/+lh1pjP7bEu/YudBvz7F2Myjh4/9GUAijrCTNeDTDAgvIJDjXuLX pA== Message-ID: <5fe8f366-3fdd-6a0e-b39c-e7e2753e7c6f@sandeen.net> Date: Tue, 18 Feb 2020 20:02:02 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200219003423.GB9511@magnolia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org On 2/18/20 6:34 PM, Darrick J. Wong wrote: > From: Darrick J. Wong > > Make sure that the default quota grace period and maximum warning limits > set by the administrator survive quotacheck. > > Signed-off-by: Darrick J. Wong > --- > This is the testcase to go with 'xfs: preserve default grace interval > during quotacheck', though Eric and I haven't figured out how we're > going to land that one... This probably could be a generic test, though I don't know how we're supposed to handle the test matrix of all the different versions, types, and applications which can implement or manage quota... I guess since it's an xfs specific fix perhaps an xfs-specific test is reasonable. > --- > tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/913.out | 13 ++++++++++ > tests/xfs/group | 1 + > 3 files changed, 83 insertions(+) > create mode 100755 tests/xfs/913 > create mode 100644 tests/xfs/913.out > > diff --git a/tests/xfs/913 b/tests/xfs/913 > new file mode 100755 > index 00000000..94681b02 > --- /dev/null > +++ b/tests/xfs/913 > @@ -0,0 +1,69 @@ > +#! /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. 913 > +# > +# Make sure that the quota default grace period and maximum warning limits > +# survive quotacheck. > + > +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 > +_supported_os Linux > +_require_quota > + > +rm -f $seqres.full > + > +# Format filesystem and set up quota limits > +_scratch_mkfs > $seqres.full > +_qmount_option "usrquota" > +_scratch_mount >> $seqres.full > + > +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT > +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' > +_scratch_unmount ok as long as you're only doing one quota type and it's the user quota type this should survive future changes. Hm, actually I wonder if it'd be best to explicitly call "state -u" because state_f() does: if (!type) type = XFS_USER_QUOTA | XFS_GROUP_QUOTA | XFS_PROJ_QUOTA; and that bitmask'd type(s) gets eventually fed to xfsquotactl -> xtype_to_qtype which really only handles one quota type, not a bitmask, and if more than one is set it gives up and returns zero which magically happens to be XFS_USER_QUOTA. (whee!) tl;dr: "state -u" might be more deterministic in the long run. > + > +# Remount and check the limits > +_scratch_mount >> $seqres.full > +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' > +_scratch_unmount > + > +# Run repair to force quota check > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +# Remount (this time to run quotacheck) and check the limits. There's a bug > +# in quotacheck where we would reset the ondisk default grace period to zero > +# while the incore copy stays at whatever was read in prior to quotacheck. > +# This will show up after the /next/ remount. > +_scratch_mount >> $seqres.full > +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' > +_scratch_unmount > + > +# Remount and check the limits > +_scratch_mount >> $seqres.full > +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' > +_scratch_unmount > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/913.out b/tests/xfs/913.out > new file mode 100644 > index 00000000..ee989388 > --- /dev/null > +++ b/tests/xfs/913.out > @@ -0,0 +1,13 @@ > +QA output created by 913 > +Blocks grace time: [0 days 05:00:00] > +Inodes grace time: [0 days 05:00:00] > +Realtime Blocks grace time: [0 days 05:00:00] > +Blocks grace time: [0 days 05:00:00] > +Inodes grace time: [0 days 05:00:00] > +Realtime Blocks grace time: [0 days 05:00:00] > +Blocks grace time: [0 days 05:00:00] > +Inodes grace time: [0 days 05:00:00] > +Realtime Blocks grace time: [0 days 05:00:00] > +Blocks grace time: [0 days 05:00:00] > +Inodes grace time: [0 days 05:00:00] > +Realtime Blocks grace time: [0 days 05:00:00] > diff --git a/tests/xfs/group b/tests/xfs/group > index 056072fb..87b3c75d 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -539,4 +539,5 @@ > 910 auto quick inobtcount > 911 auto quick bigtime > 912 auto quick label > +913 auto quick quota > 997 auto quick mount >