]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
f2fs/004: avoid race condition in test
authorJan Prusakowski <jprusakowski@google.com>
Fri, 30 May 2025 09:23:49 +0000 (09:23 +0000)
committerZorro Lang <zlang@kernel.org>
Fri, 6 Jun 2025 01:55:44 +0000 (09:55 +0800)
In current implementation the atomic write may not start before
the direct write and the test fails.

The patch adds a delay after starting the atomic write process
so it has a chance to actually start wrtiting data and set the
internal state of the file correctly.

Signed-off-by: Jan Prusakowski <jprusakowski@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/f2fs/004

index e08cee11bc389c133b9398f1c3ec042d93fc4302..ac824c4376c64a55f3a6ff5597e4c68d86645e5a 100755 (executable)
@@ -40,6 +40,9 @@ touch $dbfile
 $F2FS_IO_PROG write 1 0 32 zero atomic_commit $dbfile 3000 >> $seqres.full &
 atomic_write_pid=$!
 
+# wait a bit to allow the atomic write to start
+sleep 2
+
 # simulate concurrent direct read/write IO
 $XFS_IO_PROG -d -c "pread 0 128k" $dbfile
 $XFS_IO_PROG -d -c "pwrite 0 128k" $dbfile