fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>, fstests <fstests@vger.kernel.org>
Subject: [PATCH 4/4] fstests: individual user grace period extension via xfs_quota
Date: Mon, 18 May 2020 15:01:08 -0500	[thread overview]
Message-ID: <b4810aff-10c4-744a-2b36-053a1606e70f@redhat.com> (raw)
In-Reply-To: <9c9a63f3-13ab-d5b6-923c-4ea684b6b2f8@redhat.com>

Test that we can extend an individual user's grace time once they
reach their soft limit.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 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
-- 
2.17.0



  parent reply	other threads:[~2020-05-18 20:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ea649599-f8a9-deb9-726e-329939befade@redhat.com>
2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
2020-05-31 16:17     ` Eryu Guan
2020-05-18 20:00   ` [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout Eric Sandeen
2020-05-31 16:15     ` Eryu Guan
2020-06-01 12:48       ` Zorro Lang
2020-06-01 14:36         ` Eric Sandeen
2020-06-01 16:39         ` Darrick J. Wong
2020-06-11  5:12           ` Zorro Lang
2020-06-11 15:40             ` Darrick J. Wong
2020-05-18 20:00   ` [PATCH 3/4] fstests: individual user grace period extension via setquota Eric Sandeen
2020-05-18 20:01   ` Eric Sandeen [this message]
2020-05-20 15:39   ` [PATCH 0/4] fstests: more quota related tests Darrick J. Wong
2020-05-20 15:46     ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4810aff-10c4-744a-2b36-053a1606e70f@redhat.com \
    --to=sandeen@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).