Skip to contentSkip to conversation

fstests: test for CONFIG_QFMT_V2 in _require_quota

RFC PATCH Superseded Eric Sandeen 2 participants 2 messages Mar 14, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 fstests: test for CONFIG_QFMT_V2 in _require_quota

When CONFIG_QUOTA is enabled but CONFIG_QFMT_V2 is disabled in the kernel config, many quota tests on ext4 will fail in odd ways, when in fact they should be _notrun. Add a CONFIG_QFMT_V2 test to _require_quota() to catch this for filesystems that require it.

---

Backstory:

I was handed a bunch of ext4 xfstests failures on a system which had (accidentally?) been built with CONFIG_QUOTA enabled, but with CONFIG_QFMT_V2 disabled. This led to lots of tests failing when in fact they should have _notrun due to lack of sufficient quota support, and the reason for the failure was not obvious.

I'm going to just admit that I get lost in the maze of
quota kernel configs, mount options, and on-disk features:
CONFIG_QFMT_V1, CONFIG_QFMT_V2, vfsold, vfsv1, vfsv2, usrjquota, tune2fs -O quota, etc. I think that requiring CONFIG_QFMT_V2 might be a little bit heavy-handed here, but perhaps in the name of simplicity this change is reasonable, and I cc'd Jan in case he sees a better or more fine-grained approach, or if there are certain quota tests which should not require CONFIG_QFMT_V2, or if we should check for CONFIG_QFMT_V1 as well...

(Even on my old RHEL7 hosts, CONFIG_QFMT_V1 is disabled, so I don't think it's worth a separate check.)

There are a couple tests which oddly enough still succeed even with this kernel feature off - generic/234 for example. It does quotacheck and quotaon - the latter of which fails, but is ignored, then a bunch of setquota calls which succeed. I'm not sure what to make of that, I guess userspace can happily write to the quotafile without the kernel needing to understand it, but the kernel cannot do the accounting ...

generic/280 is similar.

So this change would _notrun those tests even though they only exercise setquota, and do not require kernel functionality. I'm not sure it's worth carving out special cases for them, though.

Thanks for listening ;)

common/quota +4 -1
index 3bf7d552..237fc115 100644
@@ -5,7 +5,9 @@
 # Functions useful for quota tests
 
 # checks that the generic quota support in the kernel is enabled
-# and that we have valid quota user tools installed.
+# and that we have valid quota user tools installed, as well as
+# support for the modern on-disk quota format kernel config
+# for filesystems that require it.
 #
 _require_quota()
 {
@@ -16,6 +18,7 @@ _require_quota()
 	if [ ! -d /proc/sys/fs/quota ]; then
 	    _notrun "Installed kernel does not support quotas"
 	fi
+	_require_kernel_config CONFIG_QFMT_V2
 	;;
     gfs2|ocfs2|bcachefs)
 	;;
tests/ext4/053 +0 -1
index 4f20d217..45747317 100755
@@ -46,7 +46,6 @@ _require_loop
 _require_command "$TUNE2FS_PROG" tune2fs
 MKE2FS_PROG=$(type -P mke2fs)
 _require_command "$MKE2FS_PROG" mke2fs
-_require_kernel_config CONFIG_QFMT_V2
 
 LOG=""
 print_log() {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Sandeen

When CONFIG_QUOTA is enabled but CONFIG_QFMT_V2 is disabled in the kernel config, many quota tests on ext4 will fail in odd ways, when in fact they should be _notrun. Add a CONFIG_QFMT_V2 test to _require_quota() to catch this for filesystems that require it.

Yeah, makes sense. Feel free to add:

Honza

Quoted 74 lines

---

Backstory:

I was handed a bunch of ext4 xfstests failures on a system which had (accidentally?) been built with CONFIG_QUOTA enabled, but with CONFIG_QFMT_V2 disabled. This led to lots of tests failing when in fact they should have _notrun due to lack of sufficient quota support, and the reason for the failure was not obvious.

I'm going to just admit that I get lost in the maze of
quota kernel configs, mount options, and on-disk features:
CONFIG_QFMT_V1, CONFIG_QFMT_V2, vfsold, vfsv1, vfsv2, usrjquota, tune2fs -O quota, etc. I think that requiring CONFIG_QFMT_V2 might be a little bit heavy-handed here, but perhaps in the name of simplicity this change is reasonable, and I cc'd Jan in case he sees a better or more fine-grained approach, or if there are certain quota tests which should not require CONFIG_QFMT_V2, or if we should check for CONFIG_QFMT_V1 as well...

(Even on my old RHEL7 hosts, CONFIG_QFMT_V1 is disabled, so I don't think it's worth a separate check.)

There are a couple tests which oddly enough still succeed even with this kernel feature off - generic/234 for example. It does quotacheck and quotaon - the latter of which fails, but is ignored, then a bunch of setquota calls which succeed. I'm not sure what to make of that, I guess userspace can happily write to the quotafile without the kernel needing to understand it, but the kernel cannot do the accounting ...

generic/280 is similar.

So this change would _notrun those tests even though they only exercise setquota, and do not require kernel functionality. I'm not sure it's worth carving out special cases for them, though.

Thanks for listening ;)

common/quota +4 -1
index 3bf7d552..237fc115 100644
@@ -5,7 +5,9 @@
 # Functions useful for quota tests
 
 # checks that the generic quota support in the kernel is enabled
-# and that we have valid quota user tools installed.
+# and that we have valid quota user tools installed, as well as
+# support for the modern on-disk quota format kernel config
+# for filesystems that require it.
 #
 _require_quota()
 {
@@ -16,6 +18,7 @@ _require_quota()
 	if [ ! -d /proc/sys/fs/quota ]; then
 	    _notrun "Installed kernel does not support quotas"
 	fi
+	_require_kernel_config CONFIG_QFMT_V2
 	;;
     gfs2|ocfs2|bcachefs)
 	;;
tests/ext4/053 +0 -1
index 4f20d217..45747317 100755
@@ -46,7 +46,6 @@ _require_loop
 _require_command "$TUNE2FS_PROG" tune2fs
 MKE2FS_PROG=$(type -P mke2fs)
 _require_command "$MKE2FS_PROG" mke2fs
-_require_kernel_config CONFIG_QFMT_V2
 
 LOG=""
 print_log() {
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR