From patchwork Mon May 18 19:59:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 11556231 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 A6B1213B4 for ; Mon, 18 May 2020 19:59:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E8F42081A for ; Mon, 18 May 2020 19:59:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zyu6IbFT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbgERT7r (ORCPT ); Mon, 18 May 2020 15:59:47 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:39801 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728592AbgERT7q (ORCPT ); Mon, 18 May 2020 15:59:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589831984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=O22ZnOhuK7BEfDMk0dHYXju3qO0/jFq1UCkPd5OWRsw=; b=Zyu6IbFT/zVW7agNSCpA4YdjNMYnIpr5RSPV40o3eiqA80alvRgk8l9SyJFrwBQ1YVIsXr W/aC9sWdU3vAa6UWOyv3s/oq/ybnH9gevxMU+dz8YqLOjql1d348uB/3Qt6bZ09gOvDcbI 0Xyh3/JnUp4lo0ffcAN6XAv0wluw9Wg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-z3wKlkNQNnCrm6uEdGqqfg-1; Mon, 18 May 2020 15:59:41 -0400 X-MC-Unique: z3wKlkNQNnCrm6uEdGqqfg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B4FB8018A5; Mon, 18 May 2020 19:59:40 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3527782A18; Mon, 18 May 2020 19:59:40 +0000 (UTC) Subject: [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck From: Eric Sandeen To: linux-xfs , fstests References: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Autocrypt: addr=sandeen@redhat.com; prefer-encrypt=mutual; keydata= mQINBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaSBLHUq2ju2gJJLfBoL7V3807PQcI18YzkF+ WL05ODFQ2cemDhx5uLghHEeOxuGj+1AI+kh/FCzMedHc6k87Yu2ZuaWF+Gh1W2ix6hikRJmQ vj5BEeAx7xKkyBhzdbNIbbjV/iGi9b26B/dNcyd5w2My2gxMtxaiP7q5b6GM2rsQklHP8FtW ZiYO7jsg/qIppR1C6Zr5jK1GQlMUIclYFeBbKggJ9mSwXJH7MIftilGQ8KDvNuV5AbkronGC sEEHj2khs7GfVv4pmUUHf1MRIvV0x3WJkpmhuZaYg8AdJlyGKgp+TQ7B+wCjNTdVqMI1vDk2 BS6Rg851ay7AypbCPx2w4d8jIkQEgNjACHVDU89PNKAjScK1aTnW+HNUqg9BliCvuX5g4z2j gJBs57loTWAGe2Ve3cMy3V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eb FzNbA3ias5BaExPknJv7XwI74JbEl8dpheIsRbt0jUDKcviOOfhbQxKJelYNTD5+wE4+TpqH XQLj5HUlzt3JSwqSwx+++FFfWFMheG2HzkfXrvTpud5NrJkGGVn+ErXy6pNf6zSicb+bUXe9 i92UTina2zWaaLEwXspqM338TlFC2JICu8pNt+wHpPCjgy2Ei4u5/4zSYjiA+X1I+V99YJhU +FpT2jzfLUoVsP/6WHWmM/tsS79i50G/PsXYzKOHj/0ZQCKOsJM14NMMCC8gkONe4tek Message-ID: <4b264d49-c5d4-4e0f-3710-38a3e0c321a1@redhat.com> Date: Mon, 18 May 2020 14:59:39 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- tests/xfs/900 | 69 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/900.out | 13 +++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/900 create mode 100644 tests/xfs/900.out diff --git a/tests/xfs/900 b/tests/xfs/900 new file mode 100755 index 00000000..106a7367 --- /dev/null +++ b/tests/xfs/900 @@ -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. 900 +# +# 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 + +# 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/900.out b/tests/xfs/900.out new file mode 100644 index 00000000..90d0482c --- /dev/null +++ b/tests/xfs/900.out @@ -0,0 +1,13 @@ +QA output created by 900 +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 12eb55c9..0818c5c6 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -513,3 +513,4 @@ 513 auto mount 514 auto quick db 515 auto quick quota +900 auto quick quota From patchwork Mon May 18 20:00:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 11556235 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 31B8214E3 for ; Mon, 18 May 2020 20:00:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AB172065F for ; Mon, 18 May 2020 20:00:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="egp3LHbq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726378AbgERUAS (ORCPT ); Mon, 18 May 2020 16:00:18 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37981 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727938AbgERUAS (ORCPT ); Mon, 18 May 2020 16:00:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589832015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=BtU+U/LfupdBhFjEMxUATfaI3CkvipSgCx5PjBpML/s=; b=egp3LHbqX2upnFYtbz66TwRiY54TYQOPYrNTLGUC73DDJJ9DH29Btc6E1z5NkRjUIEQHbn FcTps3+wVF/JbaEWPwXzAUbMMhLGoNXBdIzSmX+3UytTwTrL/Hl7iz3IgN39iGLeZbquOl TzGuKRMHBLJCQZ8lofndwKRRzznLdE0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-6Y_N6Z3UM9Oa8dXIh0J45g-1; Mon, 18 May 2020 16:00:13 -0400 X-MC-Unique: 6Y_N6Z3UM9Oa8dXIh0J45g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E5121005510; Mon, 18 May 2020 20:00:12 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9E657526B; Mon, 18 May 2020 20:00:11 +0000 (UTC) Subject: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout From: Eric Sandeen To: linux-xfs , fstests References: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Autocrypt: addr=sandeen@redhat.com; prefer-encrypt=mutual; keydata= mQINBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaSBLHUq2ju2gJJLfBoL7V3807PQcI18YzkF+ WL05ODFQ2cemDhx5uLghHEeOxuGj+1AI+kh/FCzMedHc6k87Yu2ZuaWF+Gh1W2ix6hikRJmQ vj5BEeAx7xKkyBhzdbNIbbjV/iGi9b26B/dNcyd5w2My2gxMtxaiP7q5b6GM2rsQklHP8FtW ZiYO7jsg/qIppR1C6Zr5jK1GQlMUIclYFeBbKggJ9mSwXJH7MIftilGQ8KDvNuV5AbkronGC sEEHj2khs7GfVv4pmUUHf1MRIvV0x3WJkpmhuZaYg8A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MMXYxffG7i/Y6OCVWMwRgdMLE/eanF6wYe6o6K38VH6YXQw/0kZ +PrH5uP/0kwG0JbVtj9o94x08ZMm9eMa05VhuUZmtKNdGfn75S7LfoK+RyuO7OJIMb4kR7Eb FzNbA3ias5BaExPknJv7XwI74JbEl8dpheIsRbt0jUDKcviOOfhbQxKJelYNTD5+wE4+TpqH XQLj5HUlzt3JSwqSwx+++FFfWFMheG2HzkfXrvTpud5NrJkGGVn+ErXy6pNf6zSicb+bUXe9 i92UTina2zWaaLEwXspqM338TlFC2JICu8pNt+wHpPCjgy2Ei4u5/4zSYjiA+X1I+V99YJhU +FpT2jzfLUoVsP/6WHWmM/tsS79i50G/PsXYzKOHj/0ZQCKOsJM14NMMCC8gkONe4tek Message-ID: <7102e1e3-bee6-7aa2-dce6-c0e7e0ce2983@redhat.com> Date: Mon, 18 May 2020 15:00:11 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Zorro Lang Set different block & inode grace timers for user, group and project quotas, then test softlimit enforcement timeout, make sure different grace timers as expected. Signed-off-by: Zorro Lang Signed-off-by: Eric Sandeen --- common/quota | 4 + tests/generic/902 | 187 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/902.out | 41 +++++++++ tests/generic/group | 1 + 4 files changed, 233 insertions(+) create mode 100755 tests/generic/902 create mode 100644 tests/generic/902.out diff --git a/common/quota b/common/quota index 240e0bbc..1437d5f7 100644 --- a/common/quota +++ b/common/quota @@ -217,6 +217,10 @@ _qmount() if [ "$FSTYP" != "xfs" ]; then quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1 quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1 + # try to turn on project quota if it's supported + if quotaon --help 2>&1 | grep -q '\-\-project'; then + quotaon --project $SCRATCH_MNT >>$seqres.full 2>&1 + fi fi chmod ugo+rwx $SCRATCH_MNT } diff --git a/tests/generic/902 b/tests/generic/902 new file mode 100755 index 00000000..03b4dcb3 --- /dev/null +++ b/tests/generic/902 @@ -0,0 +1,187 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 902 +# +# Test per-type(user, group and project) filesystem quota timers, make sure +# 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() +{ + restore_project + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# remove previous $seqres.full before test +rm -f $seqres.full + +require_project() +{ + rm -f $tmp.projects $tmp.projid + if [ -f /etc/projects ];then + cat /etc/projects > $tmp.projects + fi + if [ -f /etc/projid ];then + cat /etc/projid > $tmp.projid + fi + + cat >/etc/projects </etc/projid < /etc/projects + fi + if [ -f $tmp.projid ];then + cat $tmp.projid > /etc/projid + fi + fi +} + +init_files() +{ + local dir=$1 + + echo "### Initialize files, and their mode and ownership" + touch $dir/file{1,2} 2>/dev/null + chown $qa_user $dir/file{1,2} 2>/dev/null + chgrp $qa_user $dir/file{1,2} 2>/dev/null + chmod 777 $dir 2>/dev/null +} + +cleanup_files() +{ + echo "### Remove all files" + rm -f ${1}/file{1,2,3,4,5,6} +} + +test_grace() +{ + local type=$1 + local dir=$2 + local bgrace=$3 + local igrace=$4 + + init_files $dir + echo "--- Test block quota ---" + # Firstly fit below block soft limit + echo "Write 225 blocks..." + su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' \ + -c fsync $dir/file1" 2>&1 >>$seqres.full | \ + _filter_xfs_io_error | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Secondly overcome block soft limit + echo "Rewrite 250 blocks plus 1 byte, over the block softlimit..." + su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' \ + -c fsync $dir/file1" 2>&1 >>$seqres.full | \ + _filter_xfs_io_error | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Reset grace time here, make below grace time test more accurate + setquota -$type $qa_user -T $bgrace $igrace $SCRATCH_MNT 2>/dev/null + # Now sleep enough grace time and check that softlimit got enforced + sleep $((bgrace + 1)) + echo "Try to write 1 one more block after grace..." + su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \ + $dir/file2" 2>&1 >>$seqres.full | _filter_xfs_io_error | \ + tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + echo "--- Test inode quota ---" + # And now the softlimit test for inodes + # First reset space limits so that we don't have problems with + # space reservations on XFS + setquota -$type $qa_user 0 0 3 100 $SCRATCH_MNT + echo "Create 2 more files, over the inode softlimit..." + su $qa_user -c "touch $dir/file3 $dir/file4" 2>&1 >>$seqres.full | \ + _filter_scratch | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Reset grace time here, make below grace time test more accurate + setquota -$type $qa_user -T $bgrace $igrace $SCRATCH_MNT 2>/dev/null + # Wait and check grace time enforcement + sleep $((igrace+1)) + echo "Try to create one more inode after grace..." + su $qa_user -c "touch $dir/file5" 2>&1 >>$seqres.full | + _filter_scratch | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + cleanup_files $dir +} + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_setquota_project +_require_quota +_require_user +_require_group + +_scratch_mkfs >$seqres.full 2>&1 +_scratch_enable_pquota +_qmount_option "usrquota,grpquota,prjquota" +_qmount +_require_prjquota $SCRATCH_DEV +BLOCK_SIZE=$(_get_file_block_size $SCRATCH_MNT) +rm -rf $SCRATCH_MNT/t +mkdir $SCRATCH_MNT/t +$XFS_IO_PROG -r -c "chproj 100" -c "chattr +P" $SCRATCH_MNT/t +require_project + +echo "### Set up different grace timers to each type of quota" +UBGRACE=12 +UIGRACE=10 +GBGRACE=4 +GIGRACE=2 +PBGRACE=8 +PIGRACE=6 + +setquota -u $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -u -t $UBGRACE $UIGRACE $SCRATCH_MNT +echo; echo "### Test user quota softlimit and grace time" +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE +# Reset the user quota space & inode limits, avoid it affect later test +setquota -u $qa_user 0 0 0 0 $SCRATCH_MNT + +setquota -g $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -g -t $GBGRACE $GIGRACE $SCRATCH_MNT +echo; echo "### Test group quota softlimit and grace time" +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE +# Reset the group quota space & inode limits, avoid it affect later test +setquota -g $qa_user 0 0 0 0 $SCRATCH_MNT + +setquota -P $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -P -t $PBGRACE $PIGRACE $SCRATCH_MNT +echo; echo "### Test project quota softlimit and grace time" +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE +# Reset the project quota space & inode limits +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT + +# success, all done +status=0 +exit diff --git a/tests/generic/902.out b/tests/generic/902.out new file mode 100644 index 00000000..6e15eaeb --- /dev/null +++ b/tests/generic/902.out @@ -0,0 +1,41 @@ +QA output created by 902 +### Set up different grace timers to each type of quota + +### Test user quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/file5': Disk quota exceeded +### Remove all files + +### Test group quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/file5': Disk quota exceeded +### Remove all files + +### Test project quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/t/file5': Disk quota exceeded +### Remove all files diff --git a/tests/generic/group b/tests/generic/group index 50c340a6..66e71a70 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -601,3 +601,4 @@ 596 auto quick 900 auto quick perms 901 auto quick perms +902 auto quick quota From patchwork Mon May 18 20:00:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 11556239 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 7A64414C0 for ; Mon, 18 May 2020 20:00:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62E352083E for ; Mon, 18 May 2020 20:00:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a1genvGR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbgERUAn (ORCPT ); Mon, 18 May 2020 16:00:43 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:50429 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726386AbgERUAn (ORCPT ); Mon, 18 May 2020 16:00:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589832041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=QnnruCmyRHYCzu+8Z7oM/Vw7YBsghxJ8R6WQbz+52As=; b=a1genvGRmskDKQzrMY5cOyJriyEeIkn5jjPBgMkpUfHlPenGQc4xleu6e5cHAIKU2ha2bL s6uqrBqb3Slxi6kBPWxcLMEqHzSwh6qq11KovwAWquNiRiiMFFspMGN6dg/FA/Smgh8iSI vy8fZkhz1u2UuPGrL7qmcwJRXYG0pKg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-Zut7kjeIP9STCov2qo1XwA-1; Mon, 18 May 2020 16:00:38 -0400 X-MC-Unique: Zut7kjeIP9STCov2qo1XwA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D09AD1800D42; Mon, 18 May 2020 20:00:37 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95B4582A18; Mon, 18 May 2020 20:00:37 +0000 (UTC) Subject: [PATCH 3/4] fstests: individual user grace period extension via setquota From: Eric Sandeen To: linux-xfs , fstests References: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Autocrypt: addr=sandeen@redhat.com; prefer-encrypt=mutual; keydata= mQINBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaSBLHUq2ju2gJJLfBoL7V3807PQcI18YzkF+ WL05ODFQ2cemDhx5uLghHEeOxuGj+1AI+kh/FCzMedHc6k87Yu2ZuaWF+Gh1W2ix6hikRJmQ vj5BEeAx7xKkyBhzdbNIbbjV/iGi9b26B/dNcyd5w2My2gxMtxaiP7q5b6GM2rsQklHP8FtW ZiYO7jsg/qIppR1C6Zr5jK1GQlMUIclYFeBbKggJ9mSwXJH7MIftilGQ8KDvNuV5AbkronGC sEEHj2khs7GfVv4pmUUHf1MRIvV0x3WJkpmhuZaYg8AdJlyGKgp+TQ7B+wCjNTdVqMI1vDk2 BS6Rg851ay7AypbCPx2w4d8jIkQEgNjACHVDU89PNKAjScK1aTnW+HNUqg9BliCvuX5g4z2j gJBs57loTWAGe2Ve3cMy3VoQ40Wt3yKK0Eno8jfgzgb48wyycINZgnseMRhxc2c8hd51tftK LKhPj4c7uqjnBjrgOVaVBupGUmvLiePlnW56zJZ51BR5igWnILeOJ1ZIcf7KsaHyE6B1mG+X dmYtjDhjf3NAcoBWJuj8euxMB6TcQN2MrSXy5wSKaw40evooGwARAQABtCRFcmljIFIuIFNh bmRlZW4gPHNhbmRlZW5AcmVkaGF0LmNvbT6JAjgEEwECACIFAk6yrl4CGwMGCwkIBwMCBhUI AgkKCwQWAgMBAh4BAheAAAoJECCuFpLhPd7gh2kP/A6CRmIF2MSttebyBk+6Ppx47ct+Kcmp Y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 15:00:36 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Test that we can extend an individual user's grace time once they reach their soft limit. Signed-off-by: Eric Sandeen --- tests/generic/903 | 67 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/903.out | 1 + tests/generic/group | 1 + 3 files changed, 69 insertions(+) create mode 100755 tests/generic/903 create mode 100644 tests/generic/903.out diff --git a/tests/generic/903 b/tests/generic/903 new file mode 100755 index 00000000..1903755e --- /dev/null +++ b/tests/generic/903 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 903 +# +# Test individual user ID quota grace period extension +# This is the linux quota-tools version of the test +# +# This test only exercises user quota because it's not known whether the +# filesystem can set individual grace timers for each quota type +# +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 + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_quota +_require_user +_require_setquota_project + +_scratch_mkfs >$seqres.full 2>&1 +_qmount_option "usrquota" +_qmount + +# Set a default user inode grace period of 1 second +setquota -t -u 0 1 $SCRATCH_MNT +# Soft inode limit 1, hard limit 5 +setquota -u $qa_user 0 0 1 5 $SCRATCH_MNT +# Run qa user over soft limit and go over grace period +su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2" +sleep 3 +# Extend grace to now + 100s +now=`date +%s` +let set=now+100 +setquota -T -u $qa_user 0 100 $SCRATCH_MNT 2>&1 | grep -v "^setquota" +get=`repquota -up $SCRATCH_MNT | grep "^$qa_user" | awk '{print $NF}'` + +if [ "$get" != "$set" ]; then + echo "set grace to $set but got grace $get" +fi + +# success, all done +status=0 +exit diff --git a/tests/generic/903.out b/tests/generic/903.out new file mode 100644 index 00000000..c0f7f92a --- /dev/null +++ b/tests/generic/903.out @@ -0,0 +1 @@ +QA output created by 903 diff --git a/tests/generic/group b/tests/generic/group index 66e71a70..ab1b4b8f 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -602,3 +602,4 @@ 900 auto quick perms 901 auto quick perms 902 auto quick quota +903 auto quick quota From patchwork Mon May 18 20:01:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 11556241 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 8494C14C0 for ; Mon, 18 May 2020 20:01:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6733C20829 for ; Mon, 18 May 2020 20:01:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dmtYFoWH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726386AbgERUBO (ORCPT ); Mon, 18 May 2020 16:01:14 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57633 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726369AbgERUBN (ORCPT ); Mon, 18 May 2020 16:01:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589832072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=ZLOA4z01ceJ5aOvYxHarIfpLYoT+JyFiuBv9Mze9XkM=; b=dmtYFoWHoHE+0cc5qDjROlE0gz385EbcoBUjbCovY6/0sx86k+ikouyeZjbjjBwSepICsR HQn+T6LnBQNofg/AeojSAHNXh4wYZdt4t0NgZFyebyvqlUoXbwOEcI8SkqOkWosqt2PEEh VmeKDaSdiRsuoaj/xKFAG8gs8LyelME= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-qmCndoW8Pn-Y_CgF44KFOQ-1; Mon, 18 May 2020 16:01:10 -0400 X-MC-Unique: qmCndoW8Pn-Y_CgF44KFOQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82B09835B43; Mon, 18 May 2020 20:01:09 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1892819634; Mon, 18 May 2020 20:01:09 +0000 (UTC) Subject: [PATCH 4/4] fstests: individual user grace period extension via xfs_quota From: Eric Sandeen To: linux-xfs , fstests References: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Autocrypt: addr=sandeen@redhat.com; prefer-encrypt=mutual; keydata= mQINBE6x99QBEADMR+yNFBc1Y5avoUhzI/sdR9ANwznsNpiCtZlaO4pIWvqQJCjBzp96cpCs nQZV32nqJBYnDpBDITBqTa/EF+IrHx8gKq8TaS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AhsMAAoJECCuFpLhPd7gErAP/Rk46ZQ05kJI4sAyNnHea1i2NiB9Q0qLSSJg+94a hFZOpuKzxSK0+02sbhfGDMs6KNJ04TNDCR04in9CdmEY2ywx6MKeyW4rQZB35GQVVY2ZxBPv yEF4ZycQwBdkqrtuQgrO9zToYWaQxtf+ACXoOI0a/RQ0Bf7kViH65wIllLICnewD738sqPGd N51fRrKBcDquSlfRjQW83/11+bjv4sartYCoE7JhNTcTr/5nvZtmgb9wbsA0vFw+iiUs6tTj eioWcPxDBw3nrLhV8WPf+MMXYxffG7i/Y6OCVWMwRgdMLE/eanF6wYe6o6K38VH6YXQw/0kZ +PrH5uP/0kwG0JbVtj9o94x08ZMm9eMa05VhuUZmtKNdGfn75S7LfoK+RyuO7OJIMb4kR7Eb FzNbA3ias5BaExPknJv7XwI74JbEl8dpheIsRbt0jUDKcviOOfhbQxKJelYNTD5+wE4+TpqH XQLj5HUlzt3JSwqSwx+++FFfWFMheG2HzkfXrvTpud5NrJkGGVn+ErXy6pNf6zSicb+bUXe9 i92UTina2zWaaLEwXspqM338TlFC2JICu8pNt+wHpPCjgy2Ei4u5/4zSYjiA+X1I+V99YJhU +FpT2jzfLUoVsP/6WHWmM/tsS79i50G/PsXYzKOHj/0ZQCKOsJM14NMMCC8gkONe4tek Message-ID: Date: Mon, 18 May 2020 15:01:08 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Test that we can extend an individual user's grace time once they reach their soft limit. Signed-off-by: Eric Sandeen --- tests/generic/904 | 78 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/904.out | 1 + tests/generic/group | 1 + 3 files changed, 80 insertions(+) create mode 100755 tests/generic/904 create mode 100644 tests/generic/904.out diff --git a/tests/generic/904 b/tests/generic/904 new file mode 100755 index 00000000..8a3b52f2 --- /dev/null +++ b/tests/generic/904 @@ -0,0 +1,78 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 902 +# +# Test individual user ID quota grace period extension +# This is the xfs_quota version of the test +# +# This test only exercises user quota because it's not known whether the +# filesystem can set individual grace timers for each quota type +# +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 + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_quota +_require_user +# for xfs_quota on generic fs +_require_xfs_quota_foreign +# for repquota (if setquota supports it, repquota does too) +_require_setquota_project + +_scratch_mkfs >$seqres.full 2>&1 +_qmount_option "usrquota" +_qmount + +# Test individual timer update functionality; if "-d" is accepted +# this is xfs_quota that can do default /or/ individual timers +$XFS_QUOTA_PROG -x -c "timer 0 -d" $SCRATCH_MNT 2>&1 \ + | grep -q ^timer \ + && _notrun "xfs_quota does not support individual grace extension" + +# Set a default user inode grace period of 1 second +$XFS_QUOTA_PROG -x -c "timer -u -i -d 1" $SCRATCH_MNT +# Soft inode limit 1, hard limit 5 +$XFS_QUOTA_PROG -x -c "limit -u isoft=1 ihard=5 $qa_user" $SCRATCH_MNT +# Run qa user over soft limit and go over grace period +su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2" +sleep 3 +# Extend grace to now + 100s +now=`date +%s` +let set=now+100 +$XFS_QUOTA_PROG -x -c "timer -u -i 100 $qa_user" $SCRATCH_MNT +# XXX We use repquota because xfs_quota doesn't know how to return +# raw ("since epoch") grace expiry +get=`repquota -up $SCRATCH_MNT | grep "^$qa_user" | awk '{print $NF}'` + +if [ "$get" != "$set" ]; then + echo "set grace to $set but got grace $get" +fi + +# success, all done +status=0 +exit diff --git a/tests/generic/904.out b/tests/generic/904.out new file mode 100644 index 00000000..c07a2a3c --- /dev/null +++ b/tests/generic/904.out @@ -0,0 +1 @@ +QA output created by 904 diff --git a/tests/generic/group b/tests/generic/group index ab1b4b8f..d19271aa 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -603,3 +603,4 @@ 901 auto quick perms 902 auto quick quota 903 auto quick quota +904 auto quick quota