Skip to contentSkip to conversation

prepare for removing support to disable quota accounting v2

PATCH In review Christoph Hellwig 3 participants 15 messages Jul 22, 2021 – Jul 25, 2021

lore
Share & tools
lore
#0 lore raw

Hi all,

this series contains all the patches to make xfstests cope with a kernel that does not support disabling quota accounting on a running XFS file system.

Changes since v1:
- keep a helper function in xfs/106
- add a patch to use $XFS_QUOTA_PROG instead of xfs_quota

#1 lore raw

PATCH 1/7 common/quota: allow removing quota options entirely in _qmount_option

Add support for dropping all quota related options instead of only overriding them with new ones to _qmount_option.

---
 common/quota | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
common/quota +3 -1
index 883a28a2..7fa1a61a 100644
@@ -263,7 +263,9 @@ _qmount_option()
 			-e 's/prjquota/quota/g'`
 	fi
 	# Ensure we have the given quota option - duplicates are fine
-	export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $OPTS"
+	if [ -n "$OPTS" ]; then
+		export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $OPTS"
+	fi
 	echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
 }
 
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/7 xfs/007: unmount after disabling quota

In reply to Christoph Hellwig

With the pending patches to remove support for disabling quota accounting on a mounted file system we need to unmount the file system first before removing the quota files.

---
 tests/xfs/007 | 3 +++
 1 file changed, 3 insertions(+)
tests/xfs/007 +3 -0
index 09268e8c..d1946524 100755
@@ -41,6 +41,9 @@ do_test()
 	_qmount
 	echo "*** turn off $off_opts quotas"
 	xfs_quota -x -c "off -$off_opts" $SCRATCH_MNT
+	_scratch_unmount
+	_qmount_option ""
+	_scratch_mount
 	xfs_quota -x -c "remove -$off_opts" $SCRATCH_MNT
 	echo "*** umount"
 	_scratch_unmount
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/7 xfs/106: don't test disabling quota accounting

In reply to Christoph Hellwig

Switch the test that removes the quota files to just disable enforcement and then unmount the file system as disabling quota accounting is about to go away.

---
 tests/xfs/106     | 42 ++++++++++++++++++----------------
 tests/xfs/106.out | 58 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 72 insertions(+), 28 deletions(-)
tests/xfs/106 +23 -19
index f1397f94..d8f55441 100755
@@ -155,9 +155,9 @@ test_enable()
 
 test_off()
 {
-	echo "checking off command (type=$type)"
-	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-			-c "off -$type -v" $SCRATCH_MNT | _filter_scratch
+	_scratch_unmount
+	_qmount_option ""
+	_qmount
 }
 
 test_remove()
@@ -194,6 +194,15 @@ test_restore()
 
 test_xfs_quota()
 {
+	_qmount_option $1
+	_qmount
+
+	if [ $type == "p" ]; then
+		_require_prjquota $SCRATCH_DEV
+		$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
+			-c "project -s $id" $SCRATCH_MNT > /dev/null
+	fi
+
 	# init quota
 	echo "init quota limit and timer, and dump it"
 	echo "create_files 1024k 15"; create_files 1024k 15
@@ -236,14 +245,19 @@ test_xfs_quota()
 	echo ; test_report -N
 
 	# off and remove test
-	echo "off and remove test"
+	echo "disable and remove test"
 	echo ; test_limit 100m 100m 100 100
 	echo ; test_quota -N
-	echo ; test_off
+	echo ; test_disable
 	echo ; test_state
+	echo ; test_off
 	echo ; test_remove
 	echo ; test_report -N
-	echo "quota remount"; _qmount
+	_scratch_unmount
+
+	echo "quota remount";
+	_qmount_option $1
+	_qmount
 	echo ; test_report -N
 
 	# restore test
@@ -255,33 +269,23 @@ test_xfs_quota()
 }
 
 echo "----------------------- uquota,sync ---------------------------"
-_qmount_option "uquota,sync"
-_qmount
 type=u
 id=$uqid
-test_xfs_quota
+test_xfs_quota "uquota,sync"
 
 echo "----------------------- gquota,sync ---------------------------"
-_qmount_option "gquota,sync"
-_qmount
 type=g
 id=$gqid
-test_xfs_quota
+test_xfs_quota "gquota,sync"
 
 echo "----------------------- pquota,sync ---------------------------"
 # Need to clean the group quota before test project quota, because
 # V4 xfs doesn't support separate project inode. So mkfs at here.
 _scratch_unmount
 _scratch_mkfs_xfs >>$seqres.full 2>&1
-_qmount_option "pquota,sync"
-_qmount
 type=p
 id=$pqid
-_require_prjquota $SCRATCH_DEV
-$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-		-c "project -s $id" \
-		$SCRATCH_MNT > /dev/null
-test_xfs_quota
+test_xfs_quota "pquota,sync"
 
 _scratch_unmount
 # success, all done
tests/xfs/106.out +49 -9

100 lines not on this page · raw message

Signature · 1 line
2.30.2
Reviewed-by on v1 3/7
#4 lore raw

Re: [PATCH 3/7] xfs/106: don't test disabling quota accounting

Quoted 5 lines · Christoph Hellwig

Switch the test that removes the quota files to just disable enforcement and then unmount the file system as disabling quota accounting is about to go away.

Looks reasonable to me,

--D

Quoted 208 lines
---
 tests/xfs/106     | 42 ++++++++++++++++++----------------
 tests/xfs/106.out | 58 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 72 insertions(+), 28 deletions(-)
tests/xfs/106 +23 -19
index f1397f94..d8f55441 100755
@@ -155,9 +155,9 @@ test_enable()
 
 test_off()
 {
-	echo "checking off command (type=$type)"
-	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-			-c "off -$type -v" $SCRATCH_MNT | _filter_scratch
+	_scratch_unmount
+	_qmount_option ""
+	_qmount
 }
 
 test_remove()
@@ -194,6 +194,15 @@ test_restore()
 
 test_xfs_quota()
 {
+	_qmount_option $1
+	_qmount
+
+	if [ $type == "p" ]; then
+		_require_prjquota $SCRATCH_DEV
+		$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
+			-c "project -s $id" $SCRATCH_MNT > /dev/null
+	fi
+
 	# init quota
 	echo "init quota limit and timer, and dump it"
 	echo "create_files 1024k 15"; create_files 1024k 15
@@ -236,14 +245,19 @@ test_xfs_quota()
 	echo ; test_report -N
 
 	# off and remove test
-	echo "off and remove test"
+	echo "disable and remove test"
 	echo ; test_limit 100m 100m 100 100
 	echo ; test_quota -N
-	echo ; test_off
+	echo ; test_disable
 	echo ; test_state
+	echo ; test_off
 	echo ; test_remove
 	echo ; test_report -N
-	echo "quota remount"; _qmount
+	_scratch_unmount
+
+	echo "quota remount";
+	_qmount_option $1
+	_qmount
 	echo ; test_report -N
 
 	# restore test
@@ -255,33 +269,23 @@ test_xfs_quota()
 }
 
 echo "----------------------- uquota,sync ---------------------------"
-_qmount_option "uquota,sync"
-_qmount
 type=u
 id=$uqid
-test_xfs_quota
+test_xfs_quota "uquota,sync"
 
 echo "----------------------- gquota,sync ---------------------------"
-_qmount_option "gquota,sync"
-_qmount
 type=g
 id=$gqid
-test_xfs_quota
+test_xfs_quota "gquota,sync"
 
 echo "----------------------- pquota,sync ---------------------------"
 # Need to clean the group quota before test project quota, because
 # V4 xfs doesn't support separate project inode. So mkfs at here.
 _scratch_unmount
 _scratch_mkfs_xfs >>$seqres.full 2>&1
-_qmount_option "pquota,sync"
-_qmount
 type=p
 id=$pqid
-_require_prjquota $SCRATCH_DEV
-$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-		-c "project -s $id" \
-		$SCRATCH_MNT > /dev/null
-test_xfs_quota
+test_xfs_quota "pquota,sync"
 
 _scratch_unmount
 # success, all done
tests/xfs/106.out +49 -9
index e36375d3..3e6805a6 100644
@@ -124,17 +124,31 @@ Realtime Blocks grace time: [7 days]
 checking report command (type=u)
 fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days]
 
-off and remove test
+disable and remove test
 
 checking limit command (type=u, bsoft=100m, bhard=100m, isoft=100, ihard=100)
 
 checking quota command (type=u)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
-checking off command (type=u)
-User quota are not enabled on SCRATCH_DEV
+checking disable command (type=u)
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
 
 checking state command (type=u)
+User quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
+
 
 checking remove command (type=u)
 User quota are not enabled on SCRATCH_DEV
@@ -288,17 +302,30 @@ Realtime Blocks grace time: [7 days]
 checking report command (type=g)
 fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days]
 
-off and remove test
+disable and remove test
 
 checking limit command (type=g, bsoft=100m, bhard=100m, isoft=100, ihard=100)
 
 checking quota command (type=g)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
-checking off command (type=g)
-Group quota are not enabled on SCRATCH_DEV
+checking disable command (type=g)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
 
 checking state command (type=g)
+Group quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
 
 checking remove command (type=g)
 Group quota are not enabled on SCRATCH_DEV
@@ -452,17 +479,30 @@ Realtime Blocks grace time: [7 days]
 checking report command (type=p)
 fsgqa 1024 512 2048 00 [3 days] 15 10 20 00 [3 days]
 
-off and remove test
+disable and remove test
 
 checking limit command (type=p, bsoft=100m, bhard=100m, isoft=100, ihard=100)
 
 checking quota command (type=p)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
-checking off command (type=p)
-Project quota are not enabled on SCRATCH_DEV
+checking disable command (type=p)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
 
 checking state command (type=p)
+Project quota state on SCRATCH_MNT (SCRATCH_DEV)
+ Accounting: ON
+ Enforcement: OFF
+ Inode: #[INO] (X blocks, Y extents)
+Blocks grace time: [3 days]
+Inodes grace time: [3 days]
+Realtime Blocks grace time: [7 days]
 
 checking remove command (type=p)
 Project quota are not enabled on SCRATCH_DEV
Signature · 1 line
2.30.2
#5 lore raw

PATCH 4/7 xfs/220: avoid failure when disabling quota accounting is not supported

In reply to Christoph Hellwig

Doing a proper _requires for quotaoff support is rather hard, as we need to test it on a specific file system. Instead just use sed to remove the warning and let the test case pass. Eventually it should just be removed entirely.

---
 tests/xfs/220 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/xfs/220 +6 -1
index 8d955225..c847a0dc 100755
@@ -54,7 +54,12 @@ _scratch_mount -o uquota
 
 # turn off quota and remove space allocated to the quota files
 # (this used to give wrong ENOSYS returns in 2.6.31)
-xfs_quota -x -c off -c remove $SCRATCH_DEV
+#
+# The sed expression below replaces a notrun to cater for kernels that have
+# removed the ability to disable quota accounting at runtime.  On those
+# kernel this test is rather useless, and in a few years we can drop it.
+xfs_quota -x -c off -c remove $SCRATCH_DEV 2>&1 | \
+	sed -e '/XFS_QUOTARM: Invalid argument/d'
 
 # and unmount again
 _scratch_unmount
Signature · 1 line
2.30.2
Reviewed-by on v1 4/7
#6 lore raw

Re: [PATCH 4/7] xfs/220: avoid failure when disabling quota accounting is not supported

Quoted 6 lines · Christoph Hellwig

Doing a proper _requires for quotaoff support is rather hard, as we need to test it on a specific file system. Instead just use sed to remove the warning and let the test case pass. Eventually it should just be removed entirely.

Looks good,

--D

Quoted 25 lines
---
 tests/xfs/220 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/xfs/220 +6 -1
index 8d955225..c847a0dc 100755
@@ -54,7 +54,12 @@ _scratch_mount -o uquota
 
 # turn off quota and remove space allocated to the quota files
 # (this used to give wrong ENOSYS returns in 2.6.31)
-xfs_quota -x -c off -c remove $SCRATCH_DEV
+#
+# The sed expression below replaces a notrun to cater for kernels that have
+# removed the ability to disable quota accounting at runtime.  On those
+# kernel this test is rather useless, and in a few years we can drop it.
+xfs_quota -x -c off -c remove $SCRATCH_DEV 2>&1 | \
+	sed -e '/XFS_QUOTARM: Invalid argument/d'
 
 # and unmount again
 _scratch_unmount
Signature · 1 line
2.30.2
#7 lore raw

PATCH 5/7 xfs/304: don't turn quota accounting off

In reply to Christoph Hellwig

The test case tests just as much when just testing turning quota enforcement off, so switch it to that. This is in preparation for removing support to turn quota accounting off.

---
 tests/xfs/304 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/xfs/304 +3 -3
index 2716ccd5..91fa5d97 100755
@@ -31,7 +31,7 @@ QUOTA_DIR=$SCRATCH_MNT/quota_dir
 
 mkdir -p $QUOTA_DIR
 echo "*** turn off group quotas"
-xfs_quota -x -c 'off -g' $SCRATCH_MNT
+xfs_quota -x -c 'disable -g' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -39,7 +39,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off project quotas"
-xfs_quota -x -c 'off -p' $SCRATCH_MNT
+xfs_quota -x -c 'disable -p' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -47,7 +47,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off group/project quotas"
-xfs_quota -x -c 'off -gp' $SCRATCH_MNT
+xfs_quota -x -c 'disable -gp' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
Signature · 1 line
2.30.2
#8 lore raw

PATCH 6/7 xfs/305: don't turn quota accounting off

In reply to Christoph Hellwig

The test case tests just as much when just testing turning quota enforcement off, so switch it to that. This is in preparation for removing support to turn quota accounting off.

---
 tests/xfs/305 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/305 +1 -1
index 140557a0..0b89499a 100755
@@ -38,7 +38,7 @@ _exercise()
 
 	$FSSTRESS_PROG -d $QUOTA_DIR -n 1000000 -p 100 $FSSTRESS_AVOID >/dev/null 2>&1 &
 	sleep 10
-	xfs_quota -x -c "off -$type" $SCRATCH_DEV
+	xfs_quota -x -c "disable -$type" $SCRATCH_DEV
 	sleep 5
 	$KILLALL_PROG -q $FSSTRESS_PROG
 	wait
Signature · 1 line
2.30.2
#9 lore raw

PATCH 7/7 xfs: use $XFS_QUOTA_PROG instead of hardcoding xfs_quota

In reply to Christoph Hellwig
---
 tests/xfs/007 |  4 ++--
 tests/xfs/052 |  4 ++--
 tests/xfs/108 |  6 +++---
 tests/xfs/220 |  4 ++--
 tests/xfs/261 |  4 ++--
 tests/xfs/303 | 14 +++++++-------
 tests/xfs/304 |  6 +++---
 tests/xfs/305 |  2 +-
 8 files changed, 22 insertions(+), 22 deletions(-)
tests/xfs/007 +2 -2
index d1946524..66f1f101 100755
@@ -40,11 +40,11 @@ do_test()
 
 	_qmount
 	echo "*** turn off $off_opts quotas"
-	xfs_quota -x -c "off -$off_opts" $SCRATCH_MNT
+	$XFS_QUOTA_PROG -x -c "off -$off_opts" $SCRATCH_MNT
 	_scratch_unmount
 	_qmount_option ""
 	_scratch_mount
-	xfs_quota -x -c "remove -$off_opts" $SCRATCH_MNT
+	$XFS_QUOTA_PROG -x -c "remove -$off_opts" $SCRATCH_MNT
 	echo "*** umount"
 	_scratch_unmount
 
tests/xfs/052 +2 -2
index 010f9ad6..75761022 100755
@@ -63,13 +63,13 @@ bsoft=1001
 bhard=1001
 isoft=10
 ihard=10
-xfs_quota -x \
+$XFS_QUOTA_PROG -x \
 	-c "limit -$type bsoft=${bsoft}k bhard=${bhard}k $id" \
 	-c "limit -$type isoft=$isoft ihard=$ihard $id" \
 	$SCRATCH_DEV
 
 # cross check blks, softblks, hardblks <-> quota, xfs_db
-xfs_quota -c "quota -$type -birnN $id" $SCRATCH_DEV |
+$XFS_QUOTA_PROG -c "quota -$type -birnN $id" $SCRATCH_DEV |
 			tr -d '\n' | tr -s '[:space:]' | tee -a $seqres.full |
 	perl -ne 'if (m[^\s*'$SCRATCH_DEV'\s+(\d+)\s+(\d+)\s+(\d+)]) {
 		print "used_blocks=", $1, "\n";
tests/xfs/108 +3 -3
index 0af22443..8a102133 100755
@@ -47,9 +47,9 @@ test_accounting()
 	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
-	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_quota
-	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_quota
-	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hnb -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hni -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hnr -$type $id" $QARGS | _filter_quota
 }
 
 export MOUNT_OPTIONS="-opquota"
tests/xfs/220 +2 -2
index c847a0dc..241a7abd 100755
@@ -41,7 +41,7 @@ _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount -o uquota
 
 # turn off quota
-xfs_quota -x -c off $SCRATCH_DEV
+$XFS_QUOTA_PROG -x -c off $SCRATCH_DEV
 
 # and unmount (this used to crash)
 _scratch_unmount
@@ -58,7 +58,7 @@ _scratch_mount -o uquota
 # The sed expression below replaces a notrun to cater for kernels that have
 # removed the ability to disable quota accounting at runtime.  On those
 # kernel this test is rather useless, and in a few years we can drop it.
-xfs_quota -x -c off -c remove $SCRATCH_DEV 2>&1 | \
+$XFS_QUOTA_PROG -x -c off -c remove $SCRATCH_DEV 2>&1 | \
 	sed -e '/XFS_QUOTARM: Invalid argument/d'
 
 # and unmount again
tests/xfs/261 +2 -2
index 3b58db8d..eb8a72cd 100755
@@ -71,13 +71,13 @@ _check() {
 	# Set up a private mount table file, then try out a simple quota
 	# command to show mounts
 	_setup_my_mtab
-	echo print | xfs_quota	-t "${my_mtab}" > /dev/null || exit
+	echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
 
 	# Do the same simple quota command after adding a bogus entry to the
 	# mount table.  Old code will bail on this because it has trouble
 	# with the bogus entry.
 	_perturb_my_mtab
-	echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
+	echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
 }
 
 #########
tests/xfs/303 +7 -7
index b2e5668c..6aafae85 100755
@@ -24,13 +24,13 @@ echo "Silence is golden"
 # An non-existent xfs mount point
 INVALID_PATH="/INVALID_XFS_MOUNT_POINT"
 
-xfs_quota -x -c 'report -a' $INVALID_PATH	2>/dev/null
-xfs_quota -x -c 'state -a' $INVALID_PATH	2>/dev/null
-xfs_quota -x -c 'free -h' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'quot -v' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'remove' $INALID_PATH		2>/dev/null
-xfs_quota -x -c 'disable' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'enable' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'report -a' $INVALID_PATH	2>/dev/null
+$XFS_QUOTA_PROG -x -c 'state -a' $INVALID_PATH	2>/dev/null
+$XFS_QUOTA_PROG -x -c 'free -h' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'quot -v' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'remove' $INALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'disable' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'enable' $INVALID_PATH		2>/dev/null
 
 # success, all done
 status=0
tests/xfs/304 +3 -3
index 91fa5d97..3c38e613 100755
@@ -31,7 +31,7 @@ QUOTA_DIR=$SCRATCH_MNT/quota_dir
 
 mkdir -p $QUOTA_DIR
 echo "*** turn off group quotas"
-xfs_quota -x -c 'disable -g' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -g' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -39,7 +39,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off project quotas"
-xfs_quota -x -c 'disable -p' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -p' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -47,7 +47,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off group/project quotas"
-xfs_quota -x -c 'disable -gp' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -gp' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
tests/xfs/305 +1 -1
index 0b89499a..41c7b7f8 100755
@@ -38,7 +38,7 @@ _exercise()
 
 	$FSSTRESS_PROG -d $QUOTA_DIR -n 1000000 -p 100 $FSSTRESS_AVOID >/dev/null 2>&1 &
 	sleep 10
-	xfs_quota -x -c "disable -$type" $SCRATCH_DEV
+	$XFS_QUOTA_PROG -x -c "disable -$type" $SCRATCH_DEV
 	sleep 5
 	$KILLALL_PROG -q $FSSTRESS_PROG
 	wait
Signature · 1 line
2.30.2
Reviewed-by on v1 7/7
#10 lore raw

Re: [PATCH 7/7] xfs: use $XFS_QUOTA_PROG instead of hardcoding xfs_quota

Quoted 1 line · Christoph Hellwig

Nice!!

--D

Quoted 180 lines
---
 tests/xfs/007 |  4 ++--
 tests/xfs/052 |  4 ++--
 tests/xfs/108 |  6 +++---
 tests/xfs/220 |  4 ++--
 tests/xfs/261 |  4 ++--
 tests/xfs/303 | 14 +++++++-------
 tests/xfs/304 |  6 +++---
 tests/xfs/305 |  2 +-
 8 files changed, 22 insertions(+), 22 deletions(-)
tests/xfs/007 +2 -2
index d1946524..66f1f101 100755
@@ -40,11 +40,11 @@ do_test()
 
 	_qmount
 	echo "*** turn off $off_opts quotas"
-	xfs_quota -x -c "off -$off_opts" $SCRATCH_MNT
+	$XFS_QUOTA_PROG -x -c "off -$off_opts" $SCRATCH_MNT
 	_scratch_unmount
 	_qmount_option ""
 	_scratch_mount
-	xfs_quota -x -c "remove -$off_opts" $SCRATCH_MNT
+	$XFS_QUOTA_PROG -x -c "remove -$off_opts" $SCRATCH_MNT
 	echo "*** umount"
 	_scratch_unmount
 
tests/xfs/052 +2 -2
index 010f9ad6..75761022 100755
@@ -63,13 +63,13 @@ bsoft=1001
 bhard=1001
 isoft=10
 ihard=10
-xfs_quota -x \
+$XFS_QUOTA_PROG -x \
 	-c "limit -$type bsoft=${bsoft}k bhard=${bhard}k $id" \
 	-c "limit -$type isoft=$isoft ihard=$ihard $id" \
 	$SCRATCH_DEV
 
 # cross check blks, softblks, hardblks <-> quota, xfs_db
-xfs_quota -c "quota -$type -birnN $id" $SCRATCH_DEV |
+$XFS_QUOTA_PROG -c "quota -$type -birnN $id" $SCRATCH_DEV |
 			tr -d '\n' | tr -s '[:space:]' | tee -a $seqres.full |
 	perl -ne 'if (m[^\s*'$SCRATCH_DEV'\s+(\d+)\s+(\d+)\s+(\d+)]) {
 		print "used_blocks=", $1, "\n";
tests/xfs/108 +3 -3
index 0af22443..8a102133 100755
@@ -47,9 +47,9 @@ test_accounting()
 	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
-	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_quota
-	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_quota
-	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hnb -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hni -$type $id" $QARGS | _filter_quota
+	$XFS_QUOTA_PROG -c "quota -hnr -$type $id" $QARGS | _filter_quota
 }
 
 export MOUNT_OPTIONS="-opquota"
tests/xfs/220 +2 -2
index c847a0dc..241a7abd 100755
@@ -41,7 +41,7 @@ _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount -o uquota
 
 # turn off quota
-xfs_quota -x -c off $SCRATCH_DEV
+$XFS_QUOTA_PROG -x -c off $SCRATCH_DEV
 
 # and unmount (this used to crash)
 _scratch_unmount
@@ -58,7 +58,7 @@ _scratch_mount -o uquota
 # The sed expression below replaces a notrun to cater for kernels that have
 # removed the ability to disable quota accounting at runtime.  On those
 # kernel this test is rather useless, and in a few years we can drop it.
-xfs_quota -x -c off -c remove $SCRATCH_DEV 2>&1 | \
+$XFS_QUOTA_PROG -x -c off -c remove $SCRATCH_DEV 2>&1 | \
 	sed -e '/XFS_QUOTARM: Invalid argument/d'
 
 # and unmount again
tests/xfs/261 +2 -2
index 3b58db8d..eb8a72cd 100755
@@ -71,13 +71,13 @@ _check() {
 	# Set up a private mount table file, then try out a simple quota
 	# command to show mounts
 	_setup_my_mtab
-	echo print | xfs_quota	-t "${my_mtab}" > /dev/null || exit
+	echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
 
 	# Do the same simple quota command after adding a bogus entry to the
 	# mount table.  Old code will bail on this because it has trouble
 	# with the bogus entry.
 	_perturb_my_mtab
-	echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
+	echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
 }
 
 #########
tests/xfs/303 +7 -7
index b2e5668c..6aafae85 100755
@@ -24,13 +24,13 @@ echo "Silence is golden"
 # An non-existent xfs mount point
 INVALID_PATH="/INVALID_XFS_MOUNT_POINT"
 
-xfs_quota -x -c 'report -a' $INVALID_PATH	2>/dev/null
-xfs_quota -x -c 'state -a' $INVALID_PATH	2>/dev/null
-xfs_quota -x -c 'free -h' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'quot -v' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'remove' $INALID_PATH		2>/dev/null
-xfs_quota -x -c 'disable' $INVALID_PATH		2>/dev/null
-xfs_quota -x -c 'enable' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'report -a' $INVALID_PATH	2>/dev/null
+$XFS_QUOTA_PROG -x -c 'state -a' $INVALID_PATH	2>/dev/null
+$XFS_QUOTA_PROG -x -c 'free -h' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'quot -v' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'remove' $INALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'disable' $INVALID_PATH		2>/dev/null
+$XFS_QUOTA_PROG -x -c 'enable' $INVALID_PATH		2>/dev/null
 
 # success, all done
 status=0
tests/xfs/304 +3 -3
index 91fa5d97..3c38e613 100755
@@ -31,7 +31,7 @@ QUOTA_DIR=$SCRATCH_MNT/quota_dir
 
 mkdir -p $QUOTA_DIR
 echo "*** turn off group quotas"
-xfs_quota -x -c 'disable -g' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -g' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -39,7 +39,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off project quotas"
-xfs_quota -x -c 'disable -p' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -p' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
@@ -47,7 +47,7 @@ _scratch_unmount
 _qmount
 mkdir -p $QUOTA_DIR
 echo "*** turn off group/project quotas"
-xfs_quota -x -c 'disable -gp' $SCRATCH_MNT
+$XFS_QUOTA_PROG -x -c 'disable -gp' $SCRATCH_MNT
 rmdir $QUOTA_DIR
 echo "*** umount"
 _scratch_unmount
tests/xfs/305 +1 -1
index 0b89499a..41c7b7f8 100755
@@ -38,7 +38,7 @@ _exercise()
 
 	$FSSTRESS_PROG -d $QUOTA_DIR -n 1000000 -p 100 $FSSTRESS_AVOID >/dev/null 2>&1 &
 	sleep 10
-	xfs_quota -x -c "disable -$type" $SCRATCH_DEV
+	$XFS_QUOTA_PROG -x -c "disable -$type" $SCRATCH_DEV
 	sleep 5
 	$KILLALL_PROG -q $FSSTRESS_PROG
 	wait
Signature · 1 line
2.30.2
#11 lore raw

Re: [PATCH 7/7] xfs: use $XFS_QUOTA_PROG instead of hardcoding xfs_quota

Quoted 5 lines · Darrick J. Wong
Quoted 1 line · Christoph Hellwig

Nice!!

OFC now that I applied it I noticed that you forgot xfs/107.

--D

tests/xfs/107 +9 -9
index ce131a77..da052290 100755
@@ -85,17 +85,17 @@ $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
 
 echo "### initial report"
-xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give warnings"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### recursively setup the project"
-xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give no warnings now"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### deny a hard link - wrong project ID"
 rm -f $SCRATCH_MNT/outer $target/inner
@@ -107,7 +107,7 @@ if [ $? -eq 0 ]; then
 else
 	echo hard link failed
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### allow a hard link - right project ID"
 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
@@ -118,12 +118,12 @@ else
 	echo hard link failed
 	ls -ld $SCRATCH_MNT/outer $target/inner
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### recursively clear the project"
-xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 #no output...
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 status=0
 exit
#12 lore raw

Re: [PATCH 7/7] xfs: use $XFS_QUOTA_PROG instead of hardcoding xfs_quota

Quoted 8 lines · Darrick J. Wong
Quoted 5 lines · Darrick J. Wong
Quoted 1 line · Christoph Hellwig

Nice!!

OFC now that I applied it I noticed that you forgot xfs/107.

I updated xfs/107 and folded it into this patch. Thanks for all the reviews!

Eryu

Quoted 55 lines

--D

tests/xfs/107 +9 -9
index ce131a77..da052290 100755
@@ -85,17 +85,17 @@ $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
 
 echo "### initial report"
-xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give warnings"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### recursively setup the project"
-xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### check the project, should give no warnings now"
-xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 
 echo "### deny a hard link - wrong project ID"
 rm -f $SCRATCH_MNT/outer $target/inner
@@ -107,7 +107,7 @@ if [ $? -eq 0 ]; then
 else
 	echo hard link failed
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### allow a hard link - right project ID"
 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
@@ -118,12 +118,12 @@ else
 	echo hard link failed
 	ls -ld $SCRATCH_MNT/outer $target/inner
 fi
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 echo "### recursively clear the project"
-xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
 #no output...
-xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
+$XFS_QUOTA_PROG -c 'quota -ip 6' $QARGS | filter_xfs_quota
 
 status=0
 exit
#13 lore raw

[PATCH 8/7] xfs/152: avoid failure when quotaoff is not supported

In reply to Christoph Hellwig

From: Darrick J. Wong <[email protected]>

Switch the test that removes the quota files to just disable enforcement and then unmount the file system as disabling quota accounting is about to go away.

---
 tests/xfs/152     |   20 +++++++++++++-------
 tests/xfs/152.out |    4 ----
 2 files changed, 13 insertions(+), 11 deletions(-)
tests/xfs/152 +13 -7
index de85f48c..129d9c06 100755
@@ -195,8 +195,9 @@ test_enable()
 test_off()
 {
 	echo "checking off command (type=$type)"
-	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-			-c "off -$type -v" $SCRATCH_MNT | _filter_scratch
+	_scratch_unmount
+	_qmount_option ""
+	_qmount
 }
 
 test_remove()
@@ -257,6 +258,8 @@ qmount_idmapped()
 
 test_xfs_quota()
 {
+	local quota_options="$1"
+
 	# init quota
 	echo "init quota limit and timer, and dump it"
 	if [ "$idmapped" -eq 1 ]; then
@@ -310,7 +313,10 @@ test_xfs_quota()
 	echo ; test_state
 	echo ; test_remove
 	echo ; test_report -N
-	echo "quota remount"; qmount_idmapped
+	echo "quota remount"
+	_qmount_option "$quota_options"
+	_qmount
+	qmount_idmapped
 	echo ; test_report -N
 
 	# restore test
@@ -329,7 +335,7 @@ id=$uqid
 id2=$uqid2
 idmapped=0
 qmount_idmapped
-test_xfs_quota
+test_xfs_quota "uquota,sync"
 
 echo "----------------------- uquota,sync,idmapped ---------------------------"
 wipe_scratch
@@ -339,7 +345,7 @@ id=$uqid
 id2=$uqid2
 idmapped=1
 qmount_idmapped
-test_xfs_quota
+test_xfs_quota "uquota,sync"
 
 echo "----------------------- gquota,sync,unmapped ---------------------------"
 wipe_scratch
@@ -349,7 +355,7 @@ id=$gqid
 id2=$gqid2
 idmapped=0
 qmount_idmapped
-test_xfs_quota
+test_xfs_quota "gquota,sync"
 
 echo "----------------------- gquota,sync,idmapped ---------------------------"
 wipe_scratch
@@ -359,7 +365,7 @@ id=$gqid
 id2=$gqid2
 idmapped=1
 qmount_idmapped
-test_xfs_quota
+test_xfs_quota "gquota,sync"
 
 wipe_mounts
 
tests/xfs/152.out +0 -4
index 1fc71fb9..b663b096 100644
@@ -132,7 +132,6 @@ checking quota command (type=u)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
 checking off command (type=u)
-User quota are not enabled on SCRATCH_DEV
 
 checking state command (type=u)
 
@@ -296,7 +295,6 @@ checking quota command (type=u)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
 checking off command (type=u)
-User quota are not enabled on SCRATCH_DEV
 
 checking state command (type=u)
 
@@ -460,7 +458,6 @@ checking quota command (type=g)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
 checking off command (type=g)
-Group quota are not enabled on SCRATCH_DEV
 
 checking state command (type=g)
 
@@ -624,7 +621,6 @@ checking quota command (type=g)
 SCRATCH_DEV 1024 102400 102400 00 [--------] 15 100 100 00 [--------] SCRATCH_MNT
 
 checking off command (type=g)
-Group quota are not enabled on SCRATCH_DEV
 
 checking state command (type=g)
 
author Reviewed-by
#14 lore raw

Re: [PATCH 8/7] xfs/152: avoid failure when quotaoff is not supported

Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Switch the test that removes the quota files to just disable enforcement and then unmount the file system as disabling quota accounting is about to go away.

Looks like mostly copy of xfs/106 for the idmapped mount case. Somehow that did not run on my test setups.

Looks good and sorry for missing this one: