* [PATCH v3 0/2] two regression tests for ext4 @ 2022-07-13 9:28 Sun Ke 2022-07-13 9:28 ` [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke 2022-07-13 9:28 ` [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke 0 siblings, 2 replies; 12+ messages in thread From: Sun Ke @ 2022-07-13 9:28 UTC (permalink / raw) To: fstests; +Cc: zlang, linux-ext4, sunke32 two regression tests for ext4 Sun Ke (2): ext4: resize fs after resize_inode without e2fsck ext4: set 256 blocks in a block group then apply io pressure tests/ext4/057 | 44 ++++++++++++++++++++++++++++++++++++++++++++ tests/ext4/057.out | 3 +++ tests/ext4/058 | 33 +++++++++++++++++++++++++++++++++ tests/ext4/058.out | 2 ++ 4 files changed, 82 insertions(+) create mode 100755 tests/ext4/057 create mode 100644 tests/ext4/057.out create mode 100755 tests/ext4/058 create mode 100644 tests/ext4/058.out -- 2.13.6 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-13 9:28 [PATCH v3 0/2] two regression tests for ext4 Sun Ke @ 2022-07-13 9:28 ` Sun Ke 2022-07-14 15:46 ` Zorro Lang 2022-07-13 9:28 ` [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke 1 sibling, 1 reply; 12+ messages in thread From: Sun Ke @ 2022-07-13 9:28 UTC (permalink / raw) To: fstests; +Cc: zlang, linux-ext4, sunke32 Forget to run requested e2fsck after resize_inode, then resize fs, it will trigger off null pointer. Regression test for commit b55c3cd102a6 ext4: add reserved GDT blocks check. Signed-off-by: Sun Ke <sunke32@huawei.com> --- tests/ext4/057 | 44 ++++++++++++++++++++++++++++++++++++++++++++ tests/ext4/057.out | 3 +++ 2 files changed, 47 insertions(+) create mode 100755 tests/ext4/057 create mode 100644 tests/ext4/057.out diff --git a/tests/ext4/057 b/tests/ext4/057 new file mode 100755 index 00000000..44dae76c --- /dev/null +++ b/tests/ext4/057 @@ -0,0 +1,44 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 HUAWEI. All Rights Reserved. +# +# FS QA Test 057 +# +# Forget to run requested e2fsck after resize_inode, then resize fs, +# it will trigger off null pointer. +# +# Regression test for commit +# b55c3cd102a6 ext4: add reserved GDT blocks check +# +. ./common/preamble +_begin_fstest auto resize quick + +# real QA test starts here + +# Modify as appropriate. +_supported_fs ext4 +_fixed_by_kernel_commit b55c3cd102a6 \ + "ext4: add reserved GDT blocks check" + +_require_scratch +_require_command "$TUNE2FS_PROG" tune2fs +_require_command "$RESIZE2FS_PROG" resize2fs +_require_scratch_size $((1024 * 1024)) #kB + +# set fs size 512M +dev_size=$((512 * 1024 * 1024)) +_scratch_mkfs_sized $dev_size >> $seqres.full 2>&1 + +# forget to run requested e2fsck after resize_inode +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" + +_scratch_mount + +# resize fs will trigger NULL pointer in ext4_flex_group_add +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 + +echo "Silence is golden" + +# success, all done +status=0 +exit diff --git a/tests/ext4/057.out b/tests/ext4/057.out new file mode 100644 index 00000000..4784ad7e --- /dev/null +++ b/tests/ext4/057.out @@ -0,0 +1,3 @@ +QA output created by 057 +Please run e2fsck -f on the filesystem. +Silence is golden -- 2.13.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-13 9:28 ` [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke @ 2022-07-14 15:46 ` Zorro Lang 2022-07-14 22:00 ` Theodore Ts'o 0 siblings, 1 reply; 12+ messages in thread From: Zorro Lang @ 2022-07-14 15:46 UTC (permalink / raw) To: Sun Ke; +Cc: fstests, linux-ext4 On Wed, Jul 13, 2022 at 05:28:58PM +0800, Sun Ke wrote: > Forget to run requested e2fsck after resize_inode, then resize fs, it > will trigger off null pointer. > > Regression test for commit b55c3cd102a6 ext4: add reserved GDT blocks > check. > > Signed-off-by: Sun Ke <sunke32@huawei.com> > --- > tests/ext4/057 | 44 ++++++++++++++++++++++++++++++++++++++++++++ > tests/ext4/057.out | 3 +++ > 2 files changed, 47 insertions(+) > create mode 100755 tests/ext4/057 > create mode 100644 tests/ext4/057.out > > diff --git a/tests/ext4/057 b/tests/ext4/057 > new file mode 100755 > index 00000000..44dae76c > --- /dev/null > +++ b/tests/ext4/057 > @@ -0,0 +1,44 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2022 HUAWEI. All Rights Reserved. > +# > +# FS QA Test 057 > +# > +# Forget to run requested e2fsck after resize_inode, then resize fs, > +# it will trigger off null pointer. > +# > +# Regression test for commit > +# b55c3cd102a6 ext4: add reserved GDT blocks check > +# > +. ./common/preamble > +_begin_fstest auto resize quick > + > +# real QA test starts here > + > +# Modify as appropriate. > +_supported_fs ext4 > +_fixed_by_kernel_commit b55c3cd102a6 \ > + "ext4: add reserved GDT blocks check" > + > +_require_scratch > +_require_command "$TUNE2FS_PROG" tune2fs > +_require_command "$RESIZE2FS_PROG" resize2fs > +_require_scratch_size $((1024 * 1024)) #kB > + > +# set fs size 512M > +dev_size=$((512 * 1024 * 1024)) > +_scratch_mkfs_sized $dev_size >> $seqres.full 2>&1 > + > +# forget to run requested e2fsck after resize_inode > +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" > + > +_scratch_mount > + > +# resize fs will trigger NULL pointer in ext4_flex_group_add > +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 > + > +echo "Silence is golden" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/ext4/057.out b/tests/ext4/057.out > new file mode 100644 > index 00000000..4784ad7e > --- /dev/null > +++ b/tests/ext4/057.out > @@ -0,0 +1,3 @@ > +QA output created by 057 > +Please run e2fsck -f on the filesystem. If you hope to match this line, means this case isn't "Silence is golden". I don't know why you'd to have this line, it looks not suit to be golden image. If you'd like to make sure current ext4 supports "resize_inode" feature, you can use: _require_scratch_ext4_feature resize_inode Thanks, Zorro > +Silence is golden > -- > 2.13.6 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-14 15:46 ` Zorro Lang @ 2022-07-14 22:00 ` Theodore Ts'o 2022-07-15 18:08 ` Zorro Lang 0 siblings, 1 reply; 12+ messages in thread From: Theodore Ts'o @ 2022-07-14 22:00 UTC (permalink / raw) To: Zorro Lang; +Cc: Sun Ke, fstests, linux-ext4 On Thu, Jul 14, 2022 at 11:46:07PM +0800, Zorro Lang wrote: > On Wed, Jul 13, 2022 at 05:28:58PM +0800, Sun Ke wrote: > > + > > +# forget to run requested e2fsck after resize_inode > > +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" > > + > > +_scratch_mount > > + > > +# resize fs will trigger NULL pointer in ext4_flex_group_add > > +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 > > + > > +echo "Silence is golden" ... > > diff --git a/tests/ext4/057.out b/tests/ext4/057.out > > new file mode 100644 > > index 00000000..4784ad7e > > --- /dev/null > > +++ b/tests/ext4/057.out > > @@ -0,0 +1,3 @@ > > +QA output created by 057 > > +Please run e2fsck -f on the filesystem. > > If you hope to match this line, means this case isn't "Silence is golden". > > I don't know why you'd to have this line, it looks not suit to be golden > image. If you'd like to make sure current ext4 supports "resize_inode" > feature, you can use: > _require_scratch_ext4_feature resize_inode That's not the problem. The "tune2fs -O ^resize_inode" command is printing that message as a reminder that it would be a Really Good idea to run e2fsck on the file system, because tune2fs doesn't completely remove the resize inode after turning off that feature. The commit which this test is trying to verify is that the kernel won't oops if the system adminsitrator ignores the rather explicit request: Please run e2fsck -f on the filesystem. ... and blithely mounts the file system without running fsck -f on the file system first. While it could be argued that a system administrator which fails to follow instructions deserves everything they get, we decided the as a quality of implementation issue, it would be better if the kernel didn't dereference a NULL pointer in that case. :-) The one thing I'll note is that it is possible that at some point in the future, tune2fs could be improved so that it cleanly removes the resize_inode when the resize inode feature is removed, so that running "fsck.ext4 -f" is no longer necessary. So if you want to future-proof the test so it doesn't fail once tune2fs is made more idiot-proof, it might be better if the test did something like this: mke2fs -t ext4 -O ^resize_inode /dev/vdc 512m debugfs -w -R "set_super_value s_reserved_gdt_blocks 100" /dev/vdc mount -t ext4 /dev/vdc /vdc resize2fs /dev/vdc 1G Translating the above from commands suitable for manual trial using "kvm-xfstests shell" to a proper xfstests script is left as an exercise for the reader. :-) - Ted ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-14 22:00 ` Theodore Ts'o @ 2022-07-15 18:08 ` Zorro Lang 2022-07-21 3:24 ` Sun Ke 2022-07-22 8:16 ` Sun Ke 0 siblings, 2 replies; 12+ messages in thread From: Zorro Lang @ 2022-07-15 18:08 UTC (permalink / raw) To: Theodore Ts'o, Sun Ke; +Cc: fstests, linux-ext4 On Thu, Jul 14, 2022 at 06:00:34PM -0400, Theodore Ts'o wrote: > On Thu, Jul 14, 2022 at 11:46:07PM +0800, Zorro Lang wrote: > > On Wed, Jul 13, 2022 at 05:28:58PM +0800, Sun Ke wrote: > > > + > > > +# forget to run requested e2fsck after resize_inode > > > +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" > > > + > > > +_scratch_mount > > > + > > > +# resize fs will trigger NULL pointer in ext4_flex_group_add > > > +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 > > > + > > > +echo "Silence is golden" > ... > > > diff --git a/tests/ext4/057.out b/tests/ext4/057.out > > > new file mode 100644 > > > index 00000000..4784ad7e > > > --- /dev/null > > > +++ b/tests/ext4/057.out > > > @@ -0,0 +1,3 @@ > > > +QA output created by 057 > > > +Please run e2fsck -f on the filesystem. > > > > If you hope to match this line, means this case isn't "Silence is golden". > > > > I don't know why you'd to have this line, it looks not suit to be golden > > image. If you'd like to make sure current ext4 supports "resize_inode" > > feature, you can use: > > _require_scratch_ext4_feature resize_inode > > That's not the problem. > > The "tune2fs -O ^resize_inode" command is printing that message as a > reminder that it would be a Really Good idea to run e2fsck on the file > system, because tune2fs doesn't completely remove the resize inode > after turning off that feature. > > The commit which this test is trying to verify is that the kernel > won't oops if the system adminsitrator ignores the rather explicit > request: > > Please run e2fsck -f on the filesystem. > > ... and blithely mounts the file system without running fsck -f on the > file system first. While it could be argued that a system > administrator which fails to follow instructions deserves everything > they get, we decided the as a quality of implementation issue, it > would be better if the kernel didn't dereference a NULL pointer in > that case. :-) > > The one thing I'll note is that it is possible that at some point in > the future, tune2fs could be improved so that it cleanly removes the > resize_inode when the resize inode feature is removed, so that running > "fsck.ext4 -f" is no longer necessary. So if you want to future-proof Good to know :) > the test so it doesn't fail once tune2fs is made more idiot-proof, it > might be better if the test did something like this: > > mke2fs -t ext4 -O ^resize_inode /dev/vdc 512m > debugfs -w -R "set_super_value s_reserved_gdt_blocks 100" /dev/vdc So make sure there're reserved GDT blocks, even if disable resize_inode feature. > mount -t ext4 /dev/vdc /vdc > resize2fs /dev/vdc 1G Thanks Ted! That's really helpful to get review points from ext4 expert. Hi Ke, would you mind re-sending this case refer to above review points? You can refer to below code, but I didn't test it, so please test and make sure it works and can reproduce the bug. Feel free to improve it if something wrong. _require_command "$DEBUGFS_PROG" debugfs ... MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ >>$seqres.full 2>&1 || _fail "mkfs failed" $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ >>$seqres.full 2>&1 $DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ grep "Reserved GDT blocks" _scratch_mount $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 Thanks, Zorro > > Translating the above from commands suitable for manual trial using > "kvm-xfstests shell" to a proper xfstests script is left as an > exercise for the reader. :-) > > - Ted > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-15 18:08 ` Zorro Lang @ 2022-07-21 3:24 ` Sun Ke 2022-07-22 8:16 ` Sun Ke 1 sibling, 0 replies; 12+ messages in thread From: Sun Ke @ 2022-07-21 3:24 UTC (permalink / raw) To: Zorro Lang, Theodore Ts'o; +Cc: fstests, linux-ext4 在 2022/7/16 2:08, Zorro Lang 写道: > On Thu, Jul 14, 2022 at 06:00:34PM -0400, Theodore Ts'o wrote: >> On Thu, Jul 14, 2022 at 11:46:07PM +0800, Zorro Lang wrote: >>> On Wed, Jul 13, 2022 at 05:28:58PM +0800, Sun Ke wrote: >>>> + >>>> +# forget to run requested e2fsck after resize_inode >>>> +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" >>>> + >>>> +_scratch_mount >>>> + >>>> +# resize fs will trigger NULL pointer in ext4_flex_group_add >>>> +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 >>>> + >>>> +echo "Silence is golden" >> ... >>>> diff --git a/tests/ext4/057.out b/tests/ext4/057.out >>>> new file mode 100644 >>>> index 00000000..4784ad7e >>>> --- /dev/null >>>> +++ b/tests/ext4/057.out >>>> @@ -0,0 +1,3 @@ >>>> +QA output created by 057 >>>> +Please run e2fsck -f on the filesystem. >>> >>> If you hope to match this line, means this case isn't "Silence is golden". >>> >>> I don't know why you'd to have this line, it looks not suit to be golden >>> image. If you'd like to make sure current ext4 supports "resize_inode" >>> feature, you can use: >>> _require_scratch_ext4_feature resize_inode >> >> That's not the problem. >> >> The "tune2fs -O ^resize_inode" command is printing that message as a >> reminder that it would be a Really Good idea to run e2fsck on the file >> system, because tune2fs doesn't completely remove the resize inode >> after turning off that feature. >> >> The commit which this test is trying to verify is that the kernel >> won't oops if the system adminsitrator ignores the rather explicit >> request: >> >> Please run e2fsck -f on the filesystem. >> >> ... and blithely mounts the file system without running fsck -f on the >> file system first. While it could be argued that a system >> administrator which fails to follow instructions deserves everything >> they get, we decided the as a quality of implementation issue, it >> would be better if the kernel didn't dereference a NULL pointer in >> that case. :-) >> >> The one thing I'll note is that it is possible that at some point in >> the future, tune2fs could be improved so that it cleanly removes the >> resize_inode when the resize inode feature is removed, so that running >> "fsck.ext4 -f" is no longer necessary. So if you want to future-proof > > Good to know :) > >> the test so it doesn't fail once tune2fs is made more idiot-proof, it >> might be better if the test did something like this: >> >> mke2fs -t ext4 -O ^resize_inode /dev/vdc 512m >> debugfs -w -R "set_super_value s_reserved_gdt_blocks 100" /dev/vdc > > So make sure there're reserved GDT blocks, even if disable resize_inode > feature. > >> mount -t ext4 /dev/vdc /vdc >> resize2fs /dev/vdc 1G > > Thanks Ted! That's really helpful to get review points from ext4 expert. > > Hi Ke, would you mind re-sending this case refer to above review points? > You can refer to below code, but I didn't test it, so please test and make > sure it works and can reproduce the bug. Feel free to improve it if something > wrong. Glad to do that, it can reproduce the bug. Thanks, Sun Ke > > _require_command "$DEBUGFS_PROG" debugfs > ... > > MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ > >>$seqres.full 2>&1 || _fail "mkfs failed" > $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ > >>$seqres.full 2>&1 > $DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ > grep "Reserved GDT blocks" > _scratch_mount > $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 > > > Thanks, > Zorro > > >> >> Translating the above from commands suitable for manual trial using >> "kvm-xfstests shell" to a proper xfstests script is left as an >> exercise for the reader. :-) >> >> - Ted >> > > . > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-15 18:08 ` Zorro Lang 2022-07-21 3:24 ` Sun Ke @ 2022-07-22 8:16 ` Sun Ke 2022-07-22 11:51 ` Theodore Ts'o 1 sibling, 1 reply; 12+ messages in thread From: Sun Ke @ 2022-07-22 8:16 UTC (permalink / raw) To: Zorro Lang, Theodore Ts'o; +Cc: fstests, linux-ext4 在 2022/7/16 2:08, Zorro Lang 写道: > On Thu, Jul 14, 2022 at 06:00:34PM -0400, Theodore Ts'o wrote: >> On Thu, Jul 14, 2022 at 11:46:07PM +0800, Zorro Lang wrote: >>> On Wed, Jul 13, 2022 at 05:28:58PM +0800, Sun Ke wrote: >>>> + >>>> +# forget to run requested e2fsck after resize_inode >>>> +$TUNE2FS_PROG -O ^resize_inode $SCRATCH_DEV | grep -w "e2fsck" >>>> + >>>> +_scratch_mount >>>> + >>>> +# resize fs will trigger NULL pointer in ext4_flex_group_add >>>> +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 >>>> + >>>> +echo "Silence is golden" >> ... >>>> diff --git a/tests/ext4/057.out b/tests/ext4/057.out >>>> new file mode 100644 >>>> index 00000000..4784ad7e >>>> --- /dev/null >>>> +++ b/tests/ext4/057.out >>>> @@ -0,0 +1,3 @@ >>>> +QA output created by 057 >>>> +Please run e2fsck -f on the filesystem. >>> >>> If you hope to match this line, means this case isn't "Silence is golden". >>> >>> I don't know why you'd to have this line, it looks not suit to be golden >>> image. If you'd like to make sure current ext4 supports "resize_inode" >>> feature, you can use: >>> _require_scratch_ext4_feature resize_inode >> >> That's not the problem. >> >> The "tune2fs -O ^resize_inode" command is printing that message as a >> reminder that it would be a Really Good idea to run e2fsck on the file >> system, because tune2fs doesn't completely remove the resize inode >> after turning off that feature. >> >> The commit which this test is trying to verify is that the kernel >> won't oops if the system adminsitrator ignores the rather explicit >> request: >> >> Please run e2fsck -f on the filesystem. >> >> ... and blithely mounts the file system without running fsck -f on the >> file system first. While it could be argued that a system >> administrator which fails to follow instructions deserves everything >> they get, we decided the as a quality of implementation issue, it >> would be better if the kernel didn't dereference a NULL pointer in >> that case. :-) >> >> The one thing I'll note is that it is possible that at some point in >> the future, tune2fs could be improved so that it cleanly removes the >> resize_inode when the resize inode feature is removed, so that running >> "fsck.ext4 -f" is no longer necessary. So if you want to future-proof > > Good to know :) > >> the test so it doesn't fail once tune2fs is made more idiot-proof, it >> might be better if the test did something like this: >> >> mke2fs -t ext4 -O ^resize_inode /dev/vdc 512m >> debugfs -w -R "set_super_value s_reserved_gdt_blocks 100" /dev/vdc > > So make sure there're reserved GDT blocks, even if disable resize_inode > feature. > >> mount -t ext4 /dev/vdc /vdc >> resize2fs /dev/vdc 1G > > Thanks Ted! That's really helpful to get review points from ext4 expert. > > Hi Ke, would you mind re-sending this case refer to above review points? > You can refer to below code, but I didn't test it, so please test and make > sure it works and can reproduce the bug. Feel free to improve it if something > wrong. > > _require_command "$DEBUGFS_PROG" debugfs > ... > > MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ > >>$seqres.full 2>&1 || _fail "mkfs failed" > $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ > >>$seqres.full 2>&1 > $DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ > grep "Reserved GDT blocks" > _scratch_mount > $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 > > > Thanks, > Zorro two questions. 1. The test run fsck automatically, and complain inconsistent,I think it need not run fsck. 2. It warn missing kernel fix, but the commit had merged. ##test log## [root@testvm xfstests-dev]# ./check tests/ext4/057 FSTYP -- ext4 PLATFORM -- Linux/x86_64 testvm 5.10.0-00009-g08870cf6d88a #35 SMP Fri Jul 22 15:50:00 CST 2022 MKFS_OPTIONS -- /dev/sdb MOUNT_OPTIONS -- -o acl,user_xattr /dev/sdb /mnt/scratch ext4/057 5s ... _check_generic_filesystem: filesystem on /dev/sdb is inconsistent (see /root/xfstests-dev/results//ext4/057.full for details) HINT: You _MAY_ be missing kernel fix: b55c3cd102a6 ext4: add reserved GDT blocks check Ran: ext4/057 Failures: ext4/057 Failed 1 of 1 tests ##test## # Modify as appropriate. _supported_fs ext4 _fixed_by_kernel_commit b55c3cd102a6 \ "ext4: add reserved GDT blocks check" _require_scratch _require_command "$TUNE2FS_PROG" tune2fs _require_command "$RESIZE2FS_PROG" resize2fs _require_command "$DEBUGFS_PROG" debugfs _require_scratch_size $((1024 * 1024)) #kB # set fs size 512M dev_size=$((512 * 1024 * 1024)) MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ >>$seqres.full 2>&1 || _fail "mkfs failed" $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ >>$seqres.full 2>&1 $DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ grep "Reserved GDT blocks" _scratch_mount # resize fs will trigger NULL pointer in ext4_flex_group_add $RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 > > >> >> Translating the above from commands suitable for manual trial using >> "kvm-xfstests shell" to a proper xfstests script is left as an >> exercise for the reader. :-) >> >> - Ted >> > > . > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-22 8:16 ` Sun Ke @ 2022-07-22 11:51 ` Theodore Ts'o 2022-07-22 15:11 ` Zorro Lang 0 siblings, 1 reply; 12+ messages in thread From: Theodore Ts'o @ 2022-07-22 11:51 UTC (permalink / raw) To: Sun Ke; +Cc: Zorro Lang, fstests, linux-ext4 On Fri, Jul 22, 2022 at 04:16:26PM +0800, Sun Ke wrote: > > 1. The test run fsck automatically, and complain inconsistent,I think it > need not run fsck. The check script always run fscks after the test. In order to suppress the fsck complaint, we'll need to add this after the resize2fs invocation: _scratch_unmount $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 0" $SCRATCH_DEV \ >>$seqres.full 2>&1 This resets the s_reserved_gdt_blocks field back to zero, so the fsck doesn't fail. Which is fine, because the point of the test is to see whether the kernel dereferences a NULL pointer or not. > 2. It warn missing kernel fix, but the commit had merged. The way _fixed_by_kernel_commit works is if the test fails (for any reason), it prints that you MAY be missing the bugfix commit: > HINT: You _MAY_ be missing kernel fix: > b55c3cd102a6 ext4: add reserved GDT blocks check - Ted ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-22 11:51 ` Theodore Ts'o @ 2022-07-22 15:11 ` Zorro Lang 2022-07-22 16:36 ` Theodore Ts'o 0 siblings, 1 reply; 12+ messages in thread From: Zorro Lang @ 2022-07-22 15:11 UTC (permalink / raw) To: Sun Ke; +Cc: Theodore Ts'o, fstests, linux-ext4 On Fri, Jul 22, 2022 at 07:51:57AM -0400, Theodore Ts'o wrote: > On Fri, Jul 22, 2022 at 04:16:26PM +0800, Sun Ke wrote: > > > > 1. The test run fsck automatically, and complain inconsistent,I think it > > need not run fsck. > > The check script always run fscks after the test. In order to > suppress the fsck complaint, we'll need to add this after the > resize2fs invocation: > > _scratch_unmount > $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 0" $SCRATCH_DEV \ > >>$seqres.full 2>&1 > > This resets the s_reserved_gdt_blocks field back to zero, so the fsck > doesn't fail. Which is fine, because the point of the test is to see > whether the kernel dereferences a NULL pointer or not. Or maybe just replace _reuqire_scratch with _require_scratch_nocheck, if we corrupt the fs on SCRATCH_DEV intentionally? Thanks, Zorro > > > 2. It warn missing kernel fix, but the commit had merged. > > The way _fixed_by_kernel_commit works is if the test fails (for any > reason), it prints that you MAY be missing the bugfix commit: > > > HINT: You _MAY_ be missing kernel fix: > > b55c3cd102a6 ext4: add reserved GDT blocks check > > - Ted > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck 2022-07-22 15:11 ` Zorro Lang @ 2022-07-22 16:36 ` Theodore Ts'o 0 siblings, 0 replies; 12+ messages in thread From: Theodore Ts'o @ 2022-07-22 16:36 UTC (permalink / raw) To: Zorro Lang; +Cc: Sun Ke, fstests, linux-ext4 On Fri, Jul 22, 2022 at 11:11:14PM +0800, Zorro Lang wrote: > > This resets the s_reserved_gdt_blocks field back to zero, so the fsck > > doesn't fail. Which is fine, because the point of the test is to see > > whether the kernel dereferences a NULL pointer or not. > > Or maybe just replace _reuqire_scratch with _require_scratch_nocheck, if we > corrupt the fs on SCRATCH_DEV intentionally? Agreed, that would be a better solution. - Ted ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure 2022-07-13 9:28 [PATCH v3 0/2] two regression tests for ext4 Sun Ke 2022-07-13 9:28 ` [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke @ 2022-07-13 9:28 ` Sun Ke 2022-07-14 16:02 ` Zorro Lang 1 sibling, 1 reply; 12+ messages in thread From: Sun Ke @ 2022-07-13 9:28 UTC (permalink / raw) To: fstests; +Cc: zlang, linux-ext4, sunke32 Set 256 blocks in a block group, then inject I/O pressure, it will trigger off kernel BUG in ext4_mb_mark_diskspace_used. Regression test for commit a08f789d2ab5 ext4: fix bug_on ext4_mb_use_inode_pa. Signed-off-by: Sun Ke <sunke32@huawei.com> --- tests/ext4/058 | 33 +++++++++++++++++++++++++++++++++ tests/ext4/058.out | 2 ++ 2 files changed, 35 insertions(+) create mode 100755 tests/ext4/058 create mode 100644 tests/ext4/058.out diff --git a/tests/ext4/058 b/tests/ext4/058 new file mode 100755 index 00000000..ddc96f30 --- /dev/null +++ b/tests/ext4/058 @@ -0,0 +1,33 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 HUAWEI. All Rights Reserved. +# +# FS QA Test 058 +# +# Set 256 blocks in a block group, then inject I/O pressure, +# it will trigger off kernel BUG in ext4_mb_mark_diskspace_used +# +# Regression test for commit +# a08f789d2ab5 ext4: fix bug_on ext4_mb_use_inode_pa +# +. ./common/preamble +_begin_fstest auto quick + +# real QA test starts here + +_supported_fs ext4 +_fixed_by_kernel_commit a08f789d2ab5 \ + "ext4: fix bug_on ext4_mb_use_inode_pa" +_require_scratch + +# set 256 blocks in a block group +_scratch_mkfs -g 256 >> $seqres.full 2>&1 || _fail "mkfs failed" +_scratch_mount + +$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full 2>&1 + +echo "Silence is golden" + +# success, all done +status=0 +exit diff --git a/tests/ext4/058.out b/tests/ext4/058.out new file mode 100644 index 00000000..fb5ca60b --- /dev/null +++ b/tests/ext4/058.out @@ -0,0 +1,2 @@ +QA output created by 058 +Silence is golden -- 2.13.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure 2022-07-13 9:28 ` [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke @ 2022-07-14 16:02 ` Zorro Lang 0 siblings, 0 replies; 12+ messages in thread From: Zorro Lang @ 2022-07-14 16:02 UTC (permalink / raw) To: Sun Ke; +Cc: fstests, linux-ext4 On Wed, Jul 13, 2022 at 05:28:59PM +0800, Sun Ke wrote: > Set 256 blocks in a block group, then inject I/O pressure, it will > trigger off kernel BUG in ext4_mb_mark_diskspace_used. > > Regression test for commit a08f789d2ab5 ext4: fix bug_on > ext4_mb_use_inode_pa. > > Signed-off-by: Sun Ke <sunke32@huawei.com> > --- This version looks good to me. I'll merge it if there's not objection from ext4 folks. Reviewed-by: Zorro Lang <zlang@kernel.org> > tests/ext4/058 | 33 +++++++++++++++++++++++++++++++++ > tests/ext4/058.out | 2 ++ > 2 files changed, 35 insertions(+) > create mode 100755 tests/ext4/058 > create mode 100644 tests/ext4/058.out > > diff --git a/tests/ext4/058 b/tests/ext4/058 > new file mode 100755 > index 00000000..ddc96f30 > --- /dev/null > +++ b/tests/ext4/058 > @@ -0,0 +1,33 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2022 HUAWEI. All Rights Reserved. > +# > +# FS QA Test 058 > +# > +# Set 256 blocks in a block group, then inject I/O pressure, > +# it will trigger off kernel BUG in ext4_mb_mark_diskspace_used > +# > +# Regression test for commit > +# a08f789d2ab5 ext4: fix bug_on ext4_mb_use_inode_pa > +# > +. ./common/preamble > +_begin_fstest auto quick > + > +# real QA test starts here > + > +_supported_fs ext4 > +_fixed_by_kernel_commit a08f789d2ab5 \ > + "ext4: fix bug_on ext4_mb_use_inode_pa" > +_require_scratch > + > +# set 256 blocks in a block group > +_scratch_mkfs -g 256 >> $seqres.full 2>&1 || _fail "mkfs failed" > +_scratch_mount > + > +$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full 2>&1 > + > +echo "Silence is golden" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/ext4/058.out b/tests/ext4/058.out > new file mode 100644 > index 00000000..fb5ca60b > --- /dev/null > +++ b/tests/ext4/058.out > @@ -0,0 +1,2 @@ > +QA output created by 058 > +Silence is golden > -- > 2.13.6 > ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-07-22 16:37 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-13 9:28 [PATCH v3 0/2] two regression tests for ext4 Sun Ke 2022-07-13 9:28 ` [PATCH v3 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke 2022-07-14 15:46 ` Zorro Lang 2022-07-14 22:00 ` Theodore Ts'o 2022-07-15 18:08 ` Zorro Lang 2022-07-21 3:24 ` Sun Ke 2022-07-22 8:16 ` Sun Ke 2022-07-22 11:51 ` Theodore Ts'o 2022-07-22 15:11 ` Zorro Lang 2022-07-22 16:36 ` Theodore Ts'o 2022-07-13 9:28 ` [PATCH v3 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke 2022-07-14 16:02 ` Zorro Lang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.