tests/filesystem: use native quota support for ext4
PATCH 1/1 tests/filesystem: use native quota support for ext4
Use of external quota files is now deprecated for ext4 in favor of native quota support, which can be enabled by passing -O quota to mkfs.ext4 when creating the filesystem.
To accommodate to that, modify the [fs_]filesystem tests such that the native quota support is used on kernels that support it (3.6+ according to kernel's git history).
The EXT4 native quota support is similar to the XFS one in that it doesn't require calling quotacheck(8) and the quota support is turned on implicitly when the filesystem is mounted. However, contrary to XFS it doesn't use special quota commands. This means that a new helper program is needed to test the quota operations (neither quotas_test nor xfs_quotas_test can be reused).
Fixes issue #83.
--- tests/filesystem/.gitignore | 1 + tests/filesystem/Filesystem.pm | 4 +- tests/filesystem/Makefile | 2 +- tests/filesystem/native_quotas_test.c | 94 +++++++++++++++++++++++++++ tests/filesystem/test | 86 ++++++++++++++++-------- tests/fs_filesystem/test | 88 +++++++++++++++++-------- 6 files changed, 217 insertions(+), 58 deletions(-) create mode 100644 tests/filesystem/native_quotas_test.c
tests/filesystem/.gitignore +1 -0
@@ -10,3 +10,4 @@ check_mount_context create_file grim_reaper xfs_quotas_test +native_quotas_test
tests/filesystem/Filesystem.pm +2 -2
@@ -121,7 +121,7 @@ sub attach_dev { } sub make_fs { - my ( $mk_type, $mk_dev, $mk_dir ) = @_; + my ( $mk_type, $mk_dev, $mk_dir, $mk_opts ) = @_; my $mk_size = 16; if ( $mk_type eq "xfs" ) { $mk_size = 300;
@@ -137,7 +137,7 @@ sub make_fs { attach_dev( $mk_dev, $mk_dir ); print "Make $mk_type filesystem on $mk_dev\n"; - $result = system("yes | mkfs.$mk_type $mk_dev > /dev/null 2>&1"); + $result = system("yes | mkfs.$mk_type $mk_opts $mk_dev > /dev/null 2>&1"); if ( $result != 0 ) { system("losetup -d $mk_dev 2>/dev/null"); print "mkfs.$mk_type failed to create filesystem on $mk_dev\n";
tests/filesystem/Makefile +1 -1
@@ -3,7 +3,7 @@ TARGETS = mount umount quotas_test statfs_test create_file_change_context \ fs_relabel check_file_context grim_reaper check_mount_context create_file \ -xfs_quotas_test +xfs_quotas_test native_quotas_test LDLIBS += -lselinux
tests/filesystem/native_quotas_test.c new file +94 -0
94 lines not on this page · raw message
tests/filesystem/test +59 -27
255 lines not on this page · raw message
tests/fs_filesystem/test +60 -28
263 lines not on this page · raw message
Signature · 1 line
2.39.0
Ondrej Mosnacek
AppliedQuoted 18 lines · Ondrej Mosnacek
Use of external quota files is now deprecated for ext4 in favor of native quota support, which can be enabled by passing -O quota to mkfs.ext4 when creating the filesystem.
To accommodate to that, modify the [fs_]filesystem tests such that the native quota support is used on kernels that support it (3.6+ according to kernel's git history).
The EXT4 native quota support is similar to the XFS one in that it doesn't require calling quotacheck(8) and the quota support is turned on implicitly when the filesystem is mounted. However, contrary to XFS it doesn't use special quota commands. This means that a new helper program is needed to test the quota operations (neither
quotas_testnorxfs_quotas_testcan be reused).Fixes issue #83.
Signed-off-by Ondrej Mosnacek <[email protected]>
Quoted 9 lines
--- tests/filesystem/.gitignore | 1 + tests/filesystem/Filesystem.pm | 4 +- tests/filesystem/Makefile | 2 +- tests/filesystem/native_quotas_test.c | 94 +++++++++++++++++++++++++++ tests/filesystem/test | 86 ++++++++++++++++-------- tests/fs_filesystem/test | 88 +++++++++++++++++-------- 6 files changed, 217 insertions(+), 58 deletions(-) create mode 100644 tests/filesystem/native_quotas_test.c
Applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/bbab270f66c3fc33b4fdc7cec8beb0003afbb4ee
Signature · 3 lines
Ondrej Mosnacek Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.