* Re: [PATCH 1/1] common: test statfs reporting with project quota [not found] ` <173992590675.4080455.17713454161928793525.stgit@frogsfrogsfrogs> @ 2025-03-02 16:26 ` Zorro Lang 2025-03-04 18:26 ` Darrick J. Wong 0 siblings, 1 reply; 2+ messages in thread From: Zorro Lang @ 2025-03-02 16:26 UTC (permalink / raw) To: Darrick J. Wong; +Cc: fstests, linux-ext4 On Tue, Feb 18, 2025 at 05:03:39PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@kernel.org> > > Create a test to check that statfs on a directory tree with a project > quota will report the quota limit and available blocks; and that the > available blocks reported doesn't exceed that of the whole filesystem. > > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> > --- > tests/generic/1955 | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ > tests/generic/1955.out | 13 +++++ > 2 files changed, 127 insertions(+) > create mode 100755 tests/generic/1955 > create mode 100644 tests/generic/1955.out > > > diff --git a/tests/generic/1955 b/tests/generic/1955 > new file mode 100755 > index 00000000000000..e431b3c4e3fd5d > --- /dev/null > +++ b/tests/generic/1955 > @@ -0,0 +1,114 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. > +# > +# FS QA Test No. 1955 > +# > +# Make sure that statfs reporting works when project quotas are set on a > +# directory tree. > +# > +. ./common/preamble > +_begin_fstest auto quota > + > +_fixed_by_git_commit kernel XXXXXXXXXXXXXX \ > + "xfs: don't over-report free space or inodes in statvfs" Ext4 fails on this test [1], is it a known issue of ext4 besides xfs? Thanks, Zorro [1] FSTYP -- ext4 PLATFORM -- Linux/aarch64 hpe-apollo-cn99xx-14-vm-28 6.14.0-rc4+ #1 SMP PREEMPT_DYNAMIC Sat Mar 1 16:57:43 EST 2025 MKFS_OPTIONS -- -F /dev/vda3 MOUNT_OPTIONS -- -o acl,user_xattr -o context=system_u:object_r:root_t:s0 /dev/vda3 /mnt/xfstests/scratch generic/762 - output mismatch (see /var/lib/xfstests/results//generic/762.out.bad) --- tests/generic/762.out 2025-03-01 17:23:52.961878242 -0500 +++ /var/lib/xfstests/results//generic/762.out.bad 2025-03-01 19:13:03.026588012 -0500 @@ -6,8 +6,10 @@ root blocks2 is in range dir blocks2 is in range root bavail2 is in range -dir bavail2 is in range +dir bavail2 has value of 1821553 +dir bavail2 is NOT in range 360666.9 .. 367953.1 root blocks3 is in range ... (Run 'diff -u /var/lib/xfstests/tests/generic/762.out /var/lib/xfstests/results//generic/762.out.bad' to see the entire diff) HINT: You _MAY_ be missing kernel fix: XXXXXXXXXXXXXX xfs: don't over-report free space or inodes in statvfs Ran: generic/762 Failures: generic/762 Failed 1 of 1 tests > + > +. ./common/filter > +. ./common/quota > + > +_require_quota > +_require_scratch > +_require_xfs_io_command 'chproj' > +_require_xfs_io_command "falloc" > + > +_scratch_mkfs >$seqres.full 2>&1 > +_scratch_enable_pquota > +_qmount_option "prjquota" > +_qmount > +_force_vfs_quota_testing $SCRATCH_MNT > +_require_prjquota $SCRATCH_DEV > + > +mkdir $SCRATCH_MNT/dir > + > +bsize() { > + $XFS_IO_PROG -c 'statfs' $1 | grep f_bsize | awk '{print $3}' > +} > + > +blocks() { > + $XFS_IO_PROG -c 'statfs' $1 | grep f_blocks | awk '{print $3}' > +} > + > +bavail() { > + $XFS_IO_PROG -c 'statfs' $1 | grep f_bavail | awk '{print $3}' > +} > + > +bsize=$(bsize $SCRATCH_MNT) > +orig_bavail=$(bavail $SCRATCH_MNT) > +orig_blocks=$(blocks $SCRATCH_MNT) > + > +# Set a project quota limit of half the free space, make sure both report the > +# same number of blocks > +pquot_limit=$(( orig_bavail / 2 )) > +setquota -P 55 0 $((pquot_limit * bsize / 1024))K 0 0 $SCRATCH_DEV > +$XFS_IO_PROG -c 'chproj 55' -c 'chattr +P' $SCRATCH_MNT/dir > + > +# check statfs reporting > +fs_blocks=$(blocks $SCRATCH_MNT) > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > + > +_within_tolerance "root blocks1" $fs_blocks $orig_blocks 1% -v > +_within_tolerance "dir blocks1" $dir_blocks $pquot_limit 1% -v > + > +fs_bavail=$(bavail $SCRATCH_MNT) > +expected_dir_bavail=$pquot_limit > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > + > +_within_tolerance "root bavail1" $fs_bavail $orig_bavail 1% -v > +_within_tolerance "dir bavail1" $dir_bavail $expected_dir_bavail 1% -v > + > +# use up most of the free space in the filesystem > +rem_free=$(( orig_bavail / 10 )) # bsize blocks > +fallocate -l $(( (orig_bavail - rem_free) * bsize )) $SCRATCH_MNT/a > + > +if [ $rem_free -gt $pquot_limit ]; then > + echo "rem_free $rem_free greater than pquot_limit $pquot_limit??" > +fi > + > +# check statfs reporting > +fs_blocks=$(blocks $SCRATCH_MNT) > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > + > +_within_tolerance "root blocks2" $fs_blocks $orig_blocks 1% -v > +_within_tolerance "dir blocks2" $dir_blocks $pquot_limit 1% -v > + > +fs_bavail=$(bavail $SCRATCH_MNT) > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > + > +_within_tolerance "root bavail2" $fs_bavail $rem_free 1% -v > +_within_tolerance "dir bavail2" $dir_bavail $rem_free 1% -v > + > +# use up 10 blocks of project quota > +$XFS_IO_PROG -f -c "pwrite -S 0x99 0 $((bsize * 10))" -c fsync $SCRATCH_MNT/dir/a >> $seqres.full > + > +# check statfs reporting > +fs_blocks=$(blocks $SCRATCH_MNT) > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > + > +_within_tolerance "root blocks3" $fs_blocks $orig_blocks 1% -v > +_within_tolerance "dir blocks3" $dir_blocks $pquot_limit 1% -v > + > +fs_bavail=$(bavail $SCRATCH_MNT) > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > + > +_within_tolerance "root bavail3" $fs_bavail $rem_free 1% -v > +_within_tolerance "dir bavail3" $dir_bavail $((rem_free - 10)) 1% -v > + > +# final state diagnostics > +$XFS_IO_PROG -c 'statfs' $SCRATCH_MNT $SCRATCH_MNT/dir | grep statfs >> $seqres.full > +repquota -P $SCRATCH_DEV >> $seqres.full > +df $SCRATCH_MNT >> $seqres.full > +ls -laR $SCRATCH_MNT/ >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/generic/1955.out b/tests/generic/1955.out > new file mode 100644 > index 00000000000000..3601010962193e > --- /dev/null > +++ b/tests/generic/1955.out > @@ -0,0 +1,13 @@ > +QA output created by 1955 > +root blocks1 is in range > +dir blocks1 is in range > +root bavail1 is in range > +dir bavail1 is in range > +root blocks2 is in range > +dir blocks2 is in range > +root bavail2 is in range > +dir bavail2 is in range > +root blocks3 is in range > +dir blocks3 is in range > +root bavail3 is in range > +dir bavail3 is in range > ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] common: test statfs reporting with project quota 2025-03-02 16:26 ` [PATCH 1/1] common: test statfs reporting with project quota Zorro Lang @ 2025-03-04 18:26 ` Darrick J. Wong 0 siblings, 0 replies; 2+ messages in thread From: Darrick J. Wong @ 2025-03-04 18:26 UTC (permalink / raw) To: Zorro Lang; +Cc: fstests, linux-ext4 On Mon, Mar 03, 2025 at 12:26:10AM +0800, Zorro Lang wrote: > On Tue, Feb 18, 2025 at 05:03:39PM -0800, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@kernel.org> > > > > Create a test to check that statfs on a directory tree with a project > > quota will report the quota limit and available blocks; and that the > > available blocks reported doesn't exceed that of the whole filesystem. > > > > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> > > --- > > tests/generic/1955 | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/generic/1955.out | 13 +++++ > > 2 files changed, 127 insertions(+) > > create mode 100755 tests/generic/1955 > > create mode 100644 tests/generic/1955.out > > > > > > diff --git a/tests/generic/1955 b/tests/generic/1955 > > new file mode 100755 > > index 00000000000000..e431b3c4e3fd5d > > --- /dev/null > > +++ b/tests/generic/1955 > > @@ -0,0 +1,114 @@ > > +#! /bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. > > +# > > +# FS QA Test No. 1955 > > +# > > +# Make sure that statfs reporting works when project quotas are set on a > > +# directory tree. > > +# > > +. ./common/preamble > > +_begin_fstest auto quota > > + > > +_fixed_by_git_commit kernel XXXXXXXXXXXXXX \ > > + "xfs: don't over-report free space or inodes in statvfs" > > > Ext4 fails on this test [1], is it a known issue of ext4 besides xfs? Yeah, known issue on ext4 (and probably f2fs too). --D > Thanks, > Zorro > > [1] > FSTYP -- ext4 > PLATFORM -- Linux/aarch64 hpe-apollo-cn99xx-14-vm-28 6.14.0-rc4+ #1 SMP PREEMPT_DYNAMIC Sat Mar 1 16:57:43 EST 2025 > MKFS_OPTIONS -- -F /dev/vda3 > MOUNT_OPTIONS -- -o acl,user_xattr -o context=system_u:object_r:root_t:s0 /dev/vda3 /mnt/xfstests/scratch > > generic/762 - output mismatch (see /var/lib/xfstests/results//generic/762.out.bad) > --- tests/generic/762.out 2025-03-01 17:23:52.961878242 -0500 > +++ /var/lib/xfstests/results//generic/762.out.bad 2025-03-01 19:13:03.026588012 -0500 > @@ -6,8 +6,10 @@ > root blocks2 is in range > dir blocks2 is in range > root bavail2 is in range > -dir bavail2 is in range > +dir bavail2 has value of 1821553 > +dir bavail2 is NOT in range 360666.9 .. 367953.1 > root blocks3 is in range > ... > (Run 'diff -u /var/lib/xfstests/tests/generic/762.out /var/lib/xfstests/results//generic/762.out.bad' to see the entire diff) > > HINT: You _MAY_ be missing kernel fix: > XXXXXXXXXXXXXX xfs: don't over-report free space or inodes in statvfs > > Ran: generic/762 > Failures: generic/762 > Failed 1 of 1 tests > > > + > > +. ./common/filter > > +. ./common/quota > > + > > +_require_quota > > +_require_scratch > > +_require_xfs_io_command 'chproj' > > +_require_xfs_io_command "falloc" > > + > > +_scratch_mkfs >$seqres.full 2>&1 > > +_scratch_enable_pquota > > +_qmount_option "prjquota" > > +_qmount > > +_force_vfs_quota_testing $SCRATCH_MNT > > +_require_prjquota $SCRATCH_DEV > > + > > +mkdir $SCRATCH_MNT/dir > > + > > +bsize() { > > + $XFS_IO_PROG -c 'statfs' $1 | grep f_bsize | awk '{print $3}' > > +} > > + > > +blocks() { > > + $XFS_IO_PROG -c 'statfs' $1 | grep f_blocks | awk '{print $3}' > > +} > > + > > +bavail() { > > + $XFS_IO_PROG -c 'statfs' $1 | grep f_bavail | awk '{print $3}' > > +} > > + > > +bsize=$(bsize $SCRATCH_MNT) > > +orig_bavail=$(bavail $SCRATCH_MNT) > > +orig_blocks=$(blocks $SCRATCH_MNT) > > + > > +# Set a project quota limit of half the free space, make sure both report the > > +# same number of blocks > > +pquot_limit=$(( orig_bavail / 2 )) > > +setquota -P 55 0 $((pquot_limit * bsize / 1024))K 0 0 $SCRATCH_DEV > > +$XFS_IO_PROG -c 'chproj 55' -c 'chattr +P' $SCRATCH_MNT/dir > > + > > +# check statfs reporting > > +fs_blocks=$(blocks $SCRATCH_MNT) > > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root blocks1" $fs_blocks $orig_blocks 1% -v > > +_within_tolerance "dir blocks1" $dir_blocks $pquot_limit 1% -v > > + > > +fs_bavail=$(bavail $SCRATCH_MNT) > > +expected_dir_bavail=$pquot_limit > > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root bavail1" $fs_bavail $orig_bavail 1% -v > > +_within_tolerance "dir bavail1" $dir_bavail $expected_dir_bavail 1% -v > > + > > +# use up most of the free space in the filesystem > > +rem_free=$(( orig_bavail / 10 )) # bsize blocks > > +fallocate -l $(( (orig_bavail - rem_free) * bsize )) $SCRATCH_MNT/a > > + > > +if [ $rem_free -gt $pquot_limit ]; then > > + echo "rem_free $rem_free greater than pquot_limit $pquot_limit??" > > +fi > > + > > +# check statfs reporting > > +fs_blocks=$(blocks $SCRATCH_MNT) > > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root blocks2" $fs_blocks $orig_blocks 1% -v > > +_within_tolerance "dir blocks2" $dir_blocks $pquot_limit 1% -v > > + > > +fs_bavail=$(bavail $SCRATCH_MNT) > > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root bavail2" $fs_bavail $rem_free 1% -v > > +_within_tolerance "dir bavail2" $dir_bavail $rem_free 1% -v > > + > > +# use up 10 blocks of project quota > > +$XFS_IO_PROG -f -c "pwrite -S 0x99 0 $((bsize * 10))" -c fsync $SCRATCH_MNT/dir/a >> $seqres.full > > + > > +# check statfs reporting > > +fs_blocks=$(blocks $SCRATCH_MNT) > > +dir_blocks=$(blocks $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root blocks3" $fs_blocks $orig_blocks 1% -v > > +_within_tolerance "dir blocks3" $dir_blocks $pquot_limit 1% -v > > + > > +fs_bavail=$(bavail $SCRATCH_MNT) > > +dir_bavail=$(bavail $SCRATCH_MNT/dir) > > + > > +_within_tolerance "root bavail3" $fs_bavail $rem_free 1% -v > > +_within_tolerance "dir bavail3" $dir_bavail $((rem_free - 10)) 1% -v > > + > > +# final state diagnostics > > +$XFS_IO_PROG -c 'statfs' $SCRATCH_MNT $SCRATCH_MNT/dir | grep statfs >> $seqres.full > > +repquota -P $SCRATCH_DEV >> $seqres.full > > +df $SCRATCH_MNT >> $seqres.full > > +ls -laR $SCRATCH_MNT/ >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/generic/1955.out b/tests/generic/1955.out > > new file mode 100644 > > index 00000000000000..3601010962193e > > --- /dev/null > > +++ b/tests/generic/1955.out > > @@ -0,0 +1,13 @@ > > +QA output created by 1955 > > +root blocks1 is in range > > +dir blocks1 is in range > > +root bavail1 is in range > > +dir bavail1 is in range > > +root blocks2 is in range > > +dir blocks2 is in range > > +root bavail2 is in range > > +dir bavail2 is in range > > +root blocks3 is in range > > +dir blocks3 is in range > > +root bavail3 is in range > > +dir bavail3 is in range > > > > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-04 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <173992590656.4080455.15086949489894120802.stgit@frogsfrogsfrogs>
[not found] ` <173992590675.4080455.17713454161928793525.stgit@frogsfrogsfrogs>
2025-03-02 16:26 ` [PATCH 1/1] common: test statfs reporting with project quota Zorro Lang
2025-03-04 18:26 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox