xfs: test xfs_growfs with too-small size expansion
PATCH 1/1 xfs: test xfs_growfs with too-small size expansion
This's a regression test of 84712492e6da ("xfs: short circuit xfs_growfs_data_private() if delta is zero").
If try to do growfs with "too-small" size expansion, might lead to a delta of "0" in xfs_growfs_data_private(), then end up in the shrink case and emit the EXPERIMENTAL warning even if we're not changing anything at all.
--- tests/xfs/999 | 53 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/999.out | 2 ++ 2 files changed, 55 insertions(+) create mode 100755 tests/xfs/999 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +53 -0
@@ -0,0 +1,53 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 999 +# +# Test xfs_growfs with "too-small" size expansion, which lead to a delta of "0" +# in xfs_growfs_data_private. This's a regression test of 84712492e6da ("xfs: +# short circuit xfs_growfs_data_private() if delta is zero"). +# +. ./common/preamble +_begin_fstest auto quick growfs + +_cleanup() +{ + local dev + $UMOUNT_PROG $LOOP_MNT 2>/dev/null + dev=$(losetup -j testfile | cut -d: -f1) + losetup -d $dev 2>/dev/null + rm -rf $LOOP_IMG $LOOP_MNT + cd / + rm -f $tmp.* +} + +# real QA test starts here +_supported_fs xfs +_fixed_by_kernel_commit 84712492e6da \ + "xfs: short circuit xfs_growfs_data_private() if delta is zero" +_require_test +_require_loop +_require_xfs_io_command "truncate" + +LOOP_IMG=$TEST_DIR/$seq.dev +LOOP_MNT=$TEST_DIR/$seq.mnt +rm -rf $LOOP_IMG $LOOP_MNT +mkdir -p $LOOP_MNT +# 1G image +$XFS_IO_PROG -f -c "truncate 1073741824" $LOOP_IMG +$MKFS_XFS_PROG -f $LOOP_IMG >$seqres.full +# extend by just 8K +$XFS_IO_PROG -f -c "truncate 1073750016" $LOOP_IMG +_mount -oloop $LOOP_IMG $LOOP_MNT +# A known bug shows "XFS_IOC_FSGROWFSDATA xfsctl failed: No space left on +# device" at here, refer to _fixed_by_kernel_commit above +$XFS_GROWFS_PROG $LOOP_MNT >$seqres.full +if [ $? -ne 0 ];then + echo "xfs_growfs fails!" +fi + +echo "Silence is golden" +# success, all done +status=0 +exit
tests/xfs/999.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 999 +Silence is golden
Signature · 1 line
2.43.0
Looks fine.
A couple of minor comments below...
Quoted 22 lines · Zorro Lang
This's a regression test of
84712492e6da("xfs: short circuitxfs_growfs_data_private()if delta is zero").If try to do growfs with "too-small" size expansion, might lead to a delta of "0" in
xfs_growfs_data_private(), then end up in the shrink case and emit the EXPERIMENTAL warning even if we're not changing anything at all.Signed-off-by Zorro Lang <[email protected]>--- tests/xfs/999 | 53 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/999.out | 2 ++ 2 files changed, 55 insertions(+) create mode 100755 tests/xfs/999 create mode 100644 tests/xfs/999.outtests/xfs/999 new file +0
-0
tests/xfs/999 line 5
Quoted 5 lines
tests/xfs/999 new file +5
-0@@ -0,0 +1,53 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 999
I'll assume 999 is just a placeholder...
Quoted 7 lines
tests/xfs/999 new file +7
-0+# +# Test xfs_growfs with "too-small" size expansion, which lead to a delta of "0" +# in xfs_growfs_data_private. This's a regression test of 84712492e6da ("xfs: +# short circuit xfs_growfs_data_private() if delta is zero"). +# +. ./common/preamble +_begin_fstest auto quick growfs
tests/xfs/999 line 22
Quoted 10 lines
tests/xfs/999 new file +10
-0+ +_cleanup() +{ + local dev + $UMOUNT_PROG $LOOP_MNT 2>/dev/null + dev=$(losetup -j testfile | cut -d: -f1) + losetup -d $dev 2>/dev/null + rm -rf $LOOP_IMG $LOOP_MNT + cd / + rm -f $tmp.*
nit: tabs and spaces mixed above
tests/xfs/999 line 31
Quoted 9 lines
tests/xfs/999 new file +9
-0+} + +# real QA test starts here +_supported_fs xfs +_fixed_by_kernel_commit 84712492e6da \ + "xfs: short circuit xfs_growfs_data_private() if delta is zero" +_require_test +_require_loop +_require_xfs_io_command "truncate"
nit: it doesn't seem common for growfs, but you might want to add a:
_require_command "$XFS_GROWFS_PROG" xfs_growfs
Quoted 2 lines · David Disseldorp
Looks fine.
Reviewed-by David Disseldorp <[email protected]>
Thanks for reviewing :)
Quoted 21 lines
A couple of minor comments below...
Quoted 16 lines · Zorro Lang
This's a regression test of
84712492e6da("xfs: short circuitxfs_growfs_data_private()if delta is zero").If try to do growfs with "too-small" size expansion, might lead to a delta of "0" in
xfs_growfs_data_private(), then end up in the shrink case and emit the EXPERIMENTAL warning even if we're not changing anything at all.Signed-off-by Zorro Lang <[email protected]>--- tests/xfs/999 | 53 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/999.out | 2 ++ 2 files changed, 55 insertions(+) create mode 100755 tests/xfs/999 create mode 100644 tests/xfs/999.out
Quoted 13 lines
tests/xfs/999 line 5
Quoted 11 lines
tests/xfs/999 new file +5
-0@@ -0,0 +1,53 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 999I'll assume 999 is just a placeholder...
Yeah, I'll replace it when I merge it.
Quoted 12 lines
Quoted 12 lines
tests/xfs/999 new file +11
-0+# +# Test xfs_growfs with "too-small" size expansion, which lead to a delta of "0" +# in xfs_growfs_data_private. This's a regression test of 84712492e6da ("xfs: +# short circuit xfs_growfs_data_private() if delta is zero"). +# +. ./common/preamble +_begin_fstest auto quick growfs + +_cleanup() +{ + local dev
Quoted 8 lines
tests/xfs/999 line 22
Quoted 6 lines
tests/xfs/999 new file +6
-0+ $UMOUNT_PROG $LOOP_MNT 2>/dev/null + dev=$(losetup -j testfile | cut -d: -f1) + losetup -d $dev 2>/dev/null + rm -rf $LOOP_IMG $LOOP_MNT + cd / + rm -f $tmp.*nit: tabs and spaces mixed above
Oh, mistake, I'll change all of them to tabs.
Quoted 13 lines
tests/xfs/999 line 31
Quoted 10 lines
tests/xfs/999 new file +9
-0+} + +# real QA test starts here +_supported_fs xfs +_fixed_by_kernel_commit 84712492e6da \ + "xfs: short circuit xfs_growfs_data_private() if delta is zero" +_require_test +_require_loop +_require_xfs_io_command "truncate"nit: it doesn't seem common for growfs, but you might want to add a:
_require_command"$XFS_GROWFS_PROG"xfs_growfs
Sure, will do it. If you don't need to check V2, I'll merge this patch directly with above changes, as you've given a RVB :)
Thanks,
Zorro