All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] two regression tests for ext4
@ 2022-07-08 11:21 Sun Ke
  2022-07-08 11:21 ` [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke
  2022-07-08 11:21 ` [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke
  0 siblings, 2 replies; 7+ messages in thread
From: Sun Ke @ 2022-07-08 11:21 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 |  2 ++
 tests/ext4/058     | 33 +++++++++++++++++++++++++++++++++
 tests/ext4/058.out |  2 ++
 4 files changed, 81 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] 7+ messages in thread

* [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck
  2022-07-08 11:21 [PATCH v2 0/2] two regression tests for ext4 Sun Ke
@ 2022-07-08 11:21 ` Sun Ke
  2022-07-08 16:16   ` Zorro Lang
  2022-07-08 11:21 ` [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke
  1 sibling, 1 reply; 7+ messages in thread
From: Sun Ke @ 2022-07-08 11:21 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 |  2 ++
 2 files changed, 46 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..125f841a
--- /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 >$seqres.full 2>&1
+
+_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..185023c7
--- /dev/null
+++ b/tests/ext4/057.out
@@ -0,0 +1,2 @@
+QA output created by 057
+Silence is golden
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure
  2022-07-08 11:21 [PATCH v2 0/2] two regression tests for ext4 Sun Ke
  2022-07-08 11:21 ` [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke
@ 2022-07-08 11:21 ` Sun Ke
  2022-07-08 15:20   ` Zorro Lang
  1 sibling, 1 reply; 7+ messages in thread
From: Sun Ke @ 2022-07-08 11:21 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..b718c1ac
--- /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
+
+# 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
+
+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] 7+ messages in thread

* Re: [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure
  2022-07-08 11:21 ` [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke
@ 2022-07-08 15:20   ` Zorro Lang
  2022-07-11  7:20     ` Sun Ke
  0 siblings, 1 reply; 7+ messages in thread
From: Zorro Lang @ 2022-07-08 15:20 UTC (permalink / raw)
  To: Sun Ke; +Cc: fstests, linux-ext4

On Fri, Jul 08, 2022 at 07:21:55PM +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>
> ---
>  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..b718c1ac
> --- /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

Use "2>&1", if you'd like to avoid some fsstress error output break golden image.

BTW, just for make, are you sure this can reproduce that bug? Due to that fix
commit said:
...
    we can easily reproduce this problem with the following commands:
            `fallocate -l100M disk`
            `mkfs.ext4 -b 1024 -g 256 disk`
            `mount disk /mnt`
            `fsstress -d /mnt -l 0 -n 1000 -p 1`
...

It uses "-l 0" to loop run fsstress until hit the bug. You removed the '-l 0',
so are you sure one round `fsstress -n 1000` is enough to reproduce this bug
stably?

Thanks,
Zorro

> +
> +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] 7+ messages in thread

* Re: [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck
  2022-07-08 11:21 ` [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke
@ 2022-07-08 16:16   ` Zorro Lang
  2022-07-11  7:32     ` Sun Ke
  0 siblings, 1 reply; 7+ messages in thread
From: Zorro Lang @ 2022-07-08 16:16 UTC (permalink / raw)
  To: Sun Ke; +Cc: fstests, linux-ext4

On Fri, Jul 08, 2022 at 07:21:54PM +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 |  2 ++
>  2 files changed, 46 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..125f841a
> --- /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 >$seqres.full 2>&1

Please use appending write ">>$seqres.full", to avoid seqres.full be
overwritten.

I think we don't need to filter out the error output, we don't expect
there's an error, so if it fails, how about output errors to break
golden image (remind the testers).

> +
> +_scratch_mount
> +
> +# resize fs will trigger NULL pointer in ext4_flex_group_add
> +$RESIZE2FS_PROG $SCRATCH_DEV 1G >$seqres.full 2>&1

Appending write too...

I'm not sure what's the necessary condition to reproduce the bug. Do you
need to resize fs will trigger the bug, but after:

  # tune2fs -O ^resize_inode /dev/sda3

Then resize2fs always get:

  # resize2fs /dev/sda3 3g
  resize2fs 1.45.6 (20-Mar-2020)
  Please run 'e2fsck -f /dev/sda3' first.

Looks like the resizing isn't run actually, is it what you really want?
I've tried to review this patch from fstests side, better to get some
review points from ext4 devel, to help to make sure that.

Thanks,
Zorro

> +
> +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..185023c7
> --- /dev/null
> +++ b/tests/ext4/057.out
> @@ -0,0 +1,2 @@
> +QA output created by 057
> +Silence is golden
> -- 
> 2.13.6
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure
  2022-07-08 15:20   ` Zorro Lang
@ 2022-07-11  7:20     ` Sun Ke
  0 siblings, 0 replies; 7+ messages in thread
From: Sun Ke @ 2022-07-11  7:20 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests, linux-ext4



在 2022/7/8 23:20, Zorro Lang 写道:
> On Fri, Jul 08, 2022 at 07:21:55PM +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>
>> ---
>>   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..b718c1ac
>> --- /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
> 
> Use "2>&1", if you'd like to avoid some fsstress error output break golden image.
> 
> BTW, just for make, are you sure this can reproduce that bug? Due to that fix
> commit said:
> ...
>      we can easily reproduce this problem with the following commands:
>              `fallocate -l100M disk`
>              `mkfs.ext4 -b 1024 -g 256 disk`
>              `mount disk /mnt`
>              `fsstress -d /mnt -l 0 -n 1000 -p 1`
> ...
> 
> It uses "-l 0" to loop run fsstress until hit the bug. You removed the '-l 0',
> so are you sure one round `fsstress -n 1000` is enough to reproduce this bug
> stably?
> 
> Thanks,
> Zorro
It is enough ro reproduce this bug, it takes about 1 second:

[  120.723374] run fstests ext4/058 at 2022-07-11 11:42:51
[^[[0;32m  OK  ^[[0m] Started /usr/bin/bash -c test -w /p…_score_adj; exec 
./tests/ext4/058.
[  121.841680] ------------[ cut here ]------------
[  121.847476] kernel BUG at fs/ext4/mballoc.c:3786!
[  121.848522] invalid opcode: 0000 [#1] PREEMPT SMP
[  121.849520] CPU: 1 PID: 995 Comm: fsstress Not tainted 
5.18.0-rc3-00087-g98d40e76652e #3
[  121.851182] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS 1.10.2-1ubuntu1 04/01/2014
[  121.853023] RIP: 0010:ext4_mb_mark_diskspace_used+0x3d6/0x750
[  121.854222] Code: 05 3e b3 26 0c 01 b8 fb ff ff ff e9 e7 fc ff ff 48 
83 05 dc b2 26 0c 01 0f 0b 48 83 05 da b2 26 0c 01 48 83 05 da b2 26 0c 
01 <0f> 0b 48 83 05 e0 b2 26 0c 01 48 83 05 e8 b2 26 0c 01 e9 db fc ff
[  121.858035] RSP: 0018:ffffc90001857978 EFLAGS: 00010202
[  121.859119] RAX: 00000000ffffffcd RBX: ffff88810f247000 RCX: 
ffffc90001857abc
[  121.860584] RDX: 0000000000000016 RSI: ffff88810f2460a8 RDI: 
ffff88810f247000
[  121.862056] RBP: ffffc90001857ae0 R08: ffff88810f24daf8 R09: 
00000000ffffffcd
[  121.863522] R10: 0000000000000000 R11: 0000000000000001 R12: 
ffffc90001857be8
[  121.864994] R13: 0000000000000016 R14: ffff8881024a5800 R15: 
ffff88810f247000
[  121.866461] FS:  00007fdc292d4700(0000) GS:ffff88813bc80000(0000) 
knlGS:0000000000000000
[  121.868118] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  121.869309] CR2: 00007fdc292eb000 CR3: 000000010a161000 CR4: 
00000000000006e0
[  121.870776] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[  121.872241] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[  121.873711] Call Trace:
[  121.874247]  <TASK>
[  121.874707]  ext4_mb_new_blocks+0x74a/0x1f20
[  121.875599]  ? ext4_find_extent+0x61d/0x900
[  121.876472]  ext4_ext_map_blocks+0xbea/0x1d80
[  121.877386]  ext4_map_blocks+0x15d/0xa20
[  121.878204]  ext4_iomap_begin+0x18c/0x3d0
[  121.879041]  iomap_iter+0x1c7/0x5b0
[  121.879777]  __iomap_dio_rw+0x293/0xb40
[  121.880583]  iomap_dio_rw+0x12/0x70
[  121.881320]  ext4_file_write_iter+0x86b/0xcd0
[  121.882228]  new_sync_write+0x140/0x1e0
[  121.883034]  vfs_write+0x312/0x4c0
[  121.883751]  ksys_write+0x73/0x160
[  121.884465]  __x64_sys_write+0x1e/0x30
[  121.885257]  do_syscall_64+0x35/0x80
[  121.886014]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  121.887066] RIP: 0033:0x7fdc28811280

Thanks,
Sun Ke

> 
>> +
>> +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] 7+ messages in thread

* Re: [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck
  2022-07-08 16:16   ` Zorro Lang
@ 2022-07-11  7:32     ` Sun Ke
  0 siblings, 0 replies; 7+ messages in thread
From: Sun Ke @ 2022-07-11  7:32 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests, linux-ext4



在 2022/7/9 0:16, Zorro Lang 写道:
> On Fri, Jul 08, 2022 at 07:21:54PM +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 |  2 ++
>>   2 files changed, 46 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..125f841a
>> --- /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 >$seqres.full 2>&1
> 
> Please use appending write ">>$seqres.full", to avoid seqres.full be
> overwritten.
> 
> I think we don't need to filter out the error output, we don't expect
> there's an error, so if it fails, how about output errors to break
> golden image (remind the testers).
> 
>> +
>> +_scratch_mount
>> +
>> +# resize fs will trigger NULL pointer in ext4_flex_group_add
>> +$RESIZE2FS_PROG $SCRATCH_DEV 1G >$seqres.full 2>&1
> 
> Appending write too...
> 
> I'm not sure what's the necessary condition to reproduce the bug. Do you
> need to resize fs will trigger the bug, but after:
> 
>    # tune2fs -O ^resize_inode /dev/sda3
> 
> Then resize2fs always get:
> 
>    # resize2fs /dev/sda3 3g
>    resize2fs 1.45.6 (20-Mar-2020)
>    Please run 'e2fsck -f /dev/sda3' first.
> 
> Looks like the resizing isn't run actually, is it what you really want?
> I've tried to review this patch from fstests side, better to get some
> review points from ext4 devel, to help to make sure that.
> 
> Thanks,
> Zorro
If comment out the resizefs line, the test will pass.
But if not, it will panic, also takes about 1 second.
So I think resizefs is necessary.

[  113.378201] run fstests ext4/057 at 2022-07-11 11:39:19
[^[[0;32m  OK  ^[[0m] Started /usr/bin/bash -c test -w /p…_score_adj; 
exec ./tests/ext4/057.^M
[  113.747013] EXT4-fs (sdb): warning: mounting unchecked fs, running 
e2fsck is recommended
[  113.779534] BUG: kernel NULL pointer dereference, address: 
0000000000000028
[  113.781657] #PF: supervisor read access in kernel mode
[  113.783250] #PF: error_code(0x0000) - not-present page
[  113.784747] PGD 10d22b067 P4D 10d22b067 PUD 10c2e8067 PMD 0
[  113.786360] Oops: 0000 [#1] PREEMPT SMP
[  113.787514] CPU: 2 PID: 3359 Comm: resize2fs Not tainted 
5.18.0-rc3-00087-g98d40e76652e #3
[  113.789980] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS 1.10.2-1ubuntu1 04/01/2014
[  113.792566] RIP: 0010:ext4_flex_group_add+0xe06/0x2530
[  113.794106] Code: 83 05 e5 2d 25 0c 01 48 85 c0 0f 84 16 fd ff ff 48 
8b 44 24 28 be 40 0c 00 00 48 83 05 d2 2d 25 0c 01 48 83 05 6a 2b 25 0c 
01 <48> 8b 68 28 48 83 05 0e 20 25 0c 01 48 8b 95 78 03 00 00 48 8b 42
[  113.799408] RSP: 0018:ffffc900047a7c48 EFLAGS: 00010202
[  113.800857] RAX: 0000000000000000 RBX: ffff88810633e3a8 RCX: 
0000000055555557
[  113.802753] RDX: ffff88810b144400 RSI: 0000000000000c40 RDI: 
00000000aaaaaaab
[  113.804627] RBP: 000000000000003f R08: 0000000000000001 R09: 
0000000000000001
[  113.806518] R10: 0000000000000000 R11: 00000000fffd2755 R12: 
0000000000000005
[  113.808071] R13: ffff88810d279800 R14: 0000000000000000 R15: 
0000000000000005
[  113.809540] FS:  00007f6aca9d2bc0(0000) GS:ffff88813bd00000(0000) 
knlGS:0000000000000000
[  113.811216] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  113.812404] CR2: 0000000000000028 CR3: 0000000106afc000 CR4: 
00000000000006e0
[  113.814078] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[  113.815707] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[  113.817212] Call Trace:
[  113.817744]  <TASK>
[  113.818221]  ? __kmalloc+0x21e/0x5c0[  113.818955] 
ext4_resize_fs+0xbe4/0x1640
[  113.819778]  __ext4_ioctl+0x1e75/0x26a0
[  113.820597]  ? putname+0x75/0xa0
[  113.821284]  ? kmem_cache_free+0x1a7/0x690
[  113.822139]  ? putname+0x75/0xa0
[  113.822801]  ? do_sys_openat2+0x2a8/0x4f0
[  113.823644]  ext4_ioctl+0x12/0x20
[  113.824352]  __x64_sys_ioctl+0xa3/0x110
[  113.825171]  do_syscall_64+0x35/0x80
[  113.825919]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  113.826969] RIP: 0033:0x7f6ac9b06577

I will continue to improve based on your suggestions on v3.

Thanks,
Sun Ke
> 
>> +
>> +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..185023c7
>> --- /dev/null
>> +++ b/tests/ext4/057.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 057
>> +Silence is golden
>> -- 
>> 2.13.6
>>
> .
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-11  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 11:21 [PATCH v2 0/2] two regression tests for ext4 Sun Ke
2022-07-08 11:21 ` [PATCH v2 1/2] ext4: resize fs after resize_inode without e2fsck Sun Ke
2022-07-08 16:16   ` Zorro Lang
2022-07-11  7:32     ` Sun Ke
2022-07-08 11:21 ` [PATCH v2 2/2] ext4: set 256 blocks in a block group then apply io pressure Sun Ke
2022-07-08 15:20   ` Zorro Lang
2022-07-11  7:20     ` Sun Ke

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.