FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] f2fs/009: fix race condition in orphan inode test
@ 2026-08-17  9:11 Chao Yu
  2026-09-05  4:34 ` Zorro Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2026-08-17  9:11 UTC (permalink / raw)
  To: Zorro Lang, fstests; +Cc: jaegeuk, linux-f2fs-devel, Chao Yu

f2fs/009     81s ... [failed, exit status 1]- output mismatch (see /share/git/fstests/results//f2fs/009.out.bad)
    --- tests/f2fs/009.out      2026-06-12 08:46:32.819432390 +0800
    +++ /share/git/fstests/results//f2fs/009.out.bad    2026-08-17 13:09:35.000000000 +0800
    @@ -1,2 +1,3 @@
     QA output created by 009
    -Silence is golden
    +can't find corruption
    +(see /share/git/fstests/results//f2fs/009.full for details)
    ...
    (Run 'diff -u /share/git/fstests/tests/f2fs/009.out /share/git/fstests/results//f2fs/009.out.bad'  to see the entire diff)

HINT: You _MAY_ be missing f2fs-tools fix:
      958cd6e fsck.f2fs: support to repair corrupted i_links

f2fs_io write ... atomic_commit ... 5000 runs in the background and has
an initial delay before invoking F2FS_IOC_START_ATOMIC_WRITE. Without a
sleep in the test script, rm and _scratch_shutdown -f run immediately
before f2fs_io enters atomic mode, causing f2fs_io to fail and
preventing the orphan inode from being committed to the on-disk
checkpoint.

Add a 2-second sleep to let f2fs_io enter atomic mode, record its PID,
then shutdown -f to ensure the orphan inode is written to the checkpoint,
and clean up the background process properly.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 tests/f2fs/009 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/f2fs/009 b/tests/f2fs/009
index afb3bc98f..df8bef96c 100755
--- a/tests/f2fs/009
+++ b/tests/f2fs/009
@@ -106,10 +106,14 @@ check_links 0 0
 touch $filename
 ino=`stat -c '%i' $filename`
 $F2FS_IO_PROG write 1 0 1 zero atomic_commit $filename 5000 >> $seqres.full 2>&1 &
+pid=$!
+sleep 2
 stat $filename >> $seqres.full
 rm $filename
 _scratch_shutdown -f
-sleep 6
+sleep 4
+kill $pid &> /dev/null
+wait $pid &> /dev/null
 check_links 1 0 $ino
 
 # hardlink
-- 
2.49.0


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

* Re: [PATCH] f2fs/009: fix race condition in orphan inode test
  2026-08-17  9:11 [PATCH] f2fs/009: fix race condition in orphan inode test Chao Yu
@ 2026-09-05  4:34 ` Zorro Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Zorro Lang @ 2026-09-05  4:34 UTC (permalink / raw)
  To: Chao Yu; +Cc: fstests, jaegeuk, linux-f2fs-devel

On Mon, Aug 17, 2026 at 09:11:37AM +0000, Chao Yu wrote:
> f2fs/009     81s ... [failed, exit status 1]- output mismatch (see /share/git/fstests/results//f2fs/009.out.bad)
>     --- tests/f2fs/009.out      2026-06-12 08:46:32.819432390 +0800
>     +++ /share/git/fstests/results//f2fs/009.out.bad    2026-08-17 13:09:35.000000000 +0800
>     @@ -1,2 +1,3 @@
>      QA output created by 009
>     -Silence is golden
>     +can't find corruption
>     +(see /share/git/fstests/results//f2fs/009.full for details)
>     ...
>     (Run 'diff -u /share/git/fstests/tests/f2fs/009.out /share/git/fstests/results//f2fs/009.out.bad'  to see the entire diff)
> 
> HINT: You _MAY_ be missing f2fs-tools fix:
>       958cd6e fsck.f2fs: support to repair corrupted i_links
> 
> f2fs_io write ... atomic_commit ... 5000 runs in the background and has
> an initial delay before invoking F2FS_IOC_START_ATOMIC_WRITE. Without a
> sleep in the test script, rm and _scratch_shutdown -f run immediately
> before f2fs_io enters atomic mode, causing f2fs_io to fail and
> preventing the orphan inode from being committed to the on-disk
> checkpoint.
> 
> Add a 2-second sleep to let f2fs_io enter atomic mode, record its PID,
> then shutdown -f to ensure the orphan inode is written to the checkpoint,
> and clean up the background process properly.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---

Make sense to me,

Reviewed-by: Zorro Lang <zlang@kernel.org>

>  tests/f2fs/009 | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/f2fs/009 b/tests/f2fs/009
> index afb3bc98f..df8bef96c 100755
> --- a/tests/f2fs/009
> +++ b/tests/f2fs/009
> @@ -106,10 +106,14 @@ check_links 0 0
>  touch $filename
>  ino=`stat -c '%i' $filename`
>  $F2FS_IO_PROG write 1 0 1 zero atomic_commit $filename 5000 >> $seqres.full 2>&1 &
> +pid=$!
> +sleep 2
>  stat $filename >> $seqres.full
>  rm $filename
>  _scratch_shutdown -f
> -sleep 6
> +sleep 4
> +kill $pid &> /dev/null
> +wait $pid &> /dev/null
>  check_links 1 0 $ino
>  
>  # hardlink
> -- 
> 2.49.0
> 

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

end of thread, other threads:[~2026-09-05  4:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17  9:11 [PATCH] f2fs/009: fix race condition in orphan inode test Chao Yu
2026-09-05  4:34 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox