Skip to contentSkip to conversation

prepare for removing support to disable quota accounting

PATCH In review Christoph Hellwig 2 participants 14 messages Jul 12, 2021 – Jul 20, 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.

#1 lore raw

PATCH 1/6 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
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] common/quota: allow removing quota options entirely in _qmount_option

Quoted 13 lines · Christoph Hellwig

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 +0 -0
index 883a28a2..7fa1a61a 100644

common/quota _qmount_option() · line 268

Quoted 7 lines
common/quota +3 -1
@@ -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

/me finds it a little weird and gross that repeated calls to _qmount_option lead to a really ugly $MOUNT_OPTIONS, but disentangling /that/ mess is probably best left for another time...

--D

Quoted 6 lines
common/quota +0 -0
 	echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
 }
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 2/6 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
Reviewed-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] xfs/007: unmount after disabling quota

Quoted 5 lines · 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.

--D

Quoted 21 lines
---
 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
#5 lore raw

PATCH 3/6 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     | 45 ++++++++++++++++++-------------------
 tests/xfs/106.out | 57 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 70 insertions(+), 32 deletions(-)
tests/xfs/106 +22 -23
index f1397f94..5f0512d6 100755
@@ -153,13 +153,6 @@ test_enable()
 			-c "enable -$type -v" $SCRATCH_MNT | filter_state
 }
 
-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
-}
-
 test_remove()
 {
 	echo "checking remove command (type=$type)"
@@ -194,6 +187,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 +238,21 @@ 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
+	_scratch_unmount
+	_qmount_option ""
+	_qmount
 	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 +264,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 +48 -9

99 lines not on this page · raw message

Signature · 1 line
2.30.2
#6 lore raw

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

Quoted 48 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.

---
 tests/xfs/106     | 45 ++++++++++++++++++-------------------
 tests/xfs/106.out | 57 +++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 70 insertions(+), 32 deletions(-)
tests/xfs/106 +9 -7
index f1397f94..5f0512d6 100755
@@ -153,13 +153,6 @@ test_enable()
 			-c "enable -$type -v" $SCRATCH_MNT | filter_state
 }
 
-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
-}
-
 test_remove()
 {
 	echo "checking remove command (type=$type)"
@@ -194,6 +187,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 +238,21 @@ test_xfs_quota()
 	echo ; test_report -N
 
 	# off and remove test

tests/xfs/106 test_xfs_quota() · line 248

Quoted 10 lines
tests/xfs/106 +5 -2
-	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
+	_scratch_unmount
+	_qmount_option ""
+	_qmount

Why not make these three lines the method body of test_off() ?

--D

Quoted 157 lines
tests/xfs/106 +8 -14
 	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 +264,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 +48 -9
index e36375d3..2af17bc9 100644
@@ -124,17 +124,30 @@ 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 +301,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 +478,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
#7 lore raw

PATCH 4/6 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
#8 lore raw

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

Quoted 15 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.

---
 tests/xfs/220 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/xfs/220 +0 -0
index 8d955225..c847a0dc 100755

tests/xfs/220 _scratch_mount -o uquota · line 61

Quoted 9 lines
tests/xfs/220 +5 -1
@@ -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 | \

Please replace 'xfs_quota' with '$XFS_QUOTA_PROG' in all these tests you're touching.

tests/xfs/220 _scratch_mount -o uquota · line 62

Quoted 1 line
tests/xfs/220 +1 -0
+	sed -e '/XFS_QUOTARM: Invalid argument/d'

Between 'off' and 'remove', which one returned EINVAL?

--D

Quoted 6 lines
tests/xfs/220 +0 -0
 # and unmount again
 _scratch_unmount
Signature · 1 line
2.30.2
#9 lore raw

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

Quoted 9 lines · Darrick J. Wong

tests/xfs/220 _scratch_mount -o uquota · line 61

Quoted 5 lines
tests/xfs/220 +5 -0
+#
+# 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 | \

Please replace 'xfs_quota' with '$XFS_QUOTA_PROG' in all these tests you're touching.

Quoted 3 lines

tests/xfs/220 _scratch_mount -o uquota · line 62

Quoted 1 line
tests/xfs/220 +1 -0
+	sed -e '/XFS_QUOTARM: Invalid argument/d'

Between 'off' and 'remove', which one returned EINVAL?

remove, as the file system is still using the quota files.

#10 lore raw

PATCH 5/6 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
Reviewed-by on v1 5/6
#11 lore raw

Re: [PATCH 5/6] xfs/304: don't turn quota accounting off

Quoted 5 lines · 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.

--D

Quoted 38 lines
---
 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
#12 lore raw

PATCH 6/6 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
Reviewed-by on v1 6/6
#13 lore raw

Re: [PATCH 6/6] xfs/305: don't turn quota accounting off

Quoted 5 lines · 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.

Looks good to me,

--D

Quoted 20 lines
---
 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