All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-11.1?] qemu-iotest 161: fix race
@ 2026-07-28 16:39 Michael Tokarev
  2026-07-28 17:43 ` Stefan Hajnoczi
  2026-07-28 17:53 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Tokarev @ 2026-07-28 16:39 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: Michael Tokarev

qemu-iotest 161 fails intermittedly due to a race condition:

qemu:block / io-qcow2-161             ERROR            2.08s   exit status 1
――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
stderr:
--- tests/qemu-iotests/161.out
+++ scratch/qcow2-file-161/161.out.bad
@@ -34,6 +34,8 @@
 *** Commit and then change an option on the backing file

 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
+qemu-img: TEST_DIR/t.IMGFMT.base: Failed to get "write" lock
+Is another process using the image [TEST_DIR/t.IMGFMT.base]?
 Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT
 { 'execute': 'qmp_capabilities' }

This test is run right after a previous test, where we've
killed qemu process which holds the test image open.
It looks like when the next test is started (with creating
the image files), old qemu is still running, so we're racing
with that qemu, and qemu-img is unable to lock the image file
properly.

We can add some `sleep $little-amount` here, but it is simpler
and more reliable to just remove the image files, so that new
ones are created.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2867
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
index f25effab936..0b8ba0b19e2 100755
--- a/tests/qemu-iotests/161
+++ b/tests/qemu-iotests/161
@@ -106,6 +106,7 @@ echo
 echo "*** Commit and then change an option on the backing file"
 echo
 # Create the images again
+rm -f -- "$TEST_IMG.base" "$TEST_IMG.int"
 TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
 TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT
 _make_test_img -b "$TEST_IMG.int" -F $IMGFMT


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

* Re: [PATCH for-11.1?] qemu-iotest 161: fix race
  2026-07-28 16:39 [PATCH for-11.1?] qemu-iotest 161: fix race Michael Tokarev
@ 2026-07-28 17:43 ` Stefan Hajnoczi
  2026-07-28 17:53 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2026-07-28 17:43 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel, qemu-block, Kevin Wolf

On Tue, Jul 28, 2026 at 12:40 PM Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> qemu-iotest 161 fails intermittedly due to a race condition:
>
> qemu:block / io-qcow2-161             ERROR            2.08s   exit status 1
> ――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
> stderr:
> --- tests/qemu-iotests/161.out
> +++ scratch/qcow2-file-161/161.out.bad
> @@ -34,6 +34,8 @@
>  *** Commit and then change an option on the backing file
>
>  Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
> +qemu-img: TEST_DIR/t.IMGFMT.base: Failed to get "write" lock
> +Is another process using the image [TEST_DIR/t.IMGFMT.base]?
>  Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT
>  { 'execute': 'qmp_capabilities' }
>
> This test is run right after a previous test, where we've
> killed qemu process which holds the test image open.
> It looks like when the next test is started (with creating
> the image files), old qemu is still running, so we're racing
> with that qemu, and qemu-img is unable to lock the image file
> properly.
>
> We can add some `sleep $little-amount` here, but it is simpler
> and more reliable to just remove the image files, so that new
> ones are created.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2867
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>


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

* Re: [PATCH for-11.1?] qemu-iotest 161: fix race
  2026-07-28 16:39 [PATCH for-11.1?] qemu-iotest 161: fix race Michael Tokarev
  2026-07-28 17:43 ` Stefan Hajnoczi
@ 2026-07-28 17:53 ` Kevin Wolf
  2026-07-28 20:36   ` Michael Tokarev
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2026-07-28 17:53 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel, qemu-block

Am 28.07.2026 um 18:39 hat Michael Tokarev geschrieben:
> qemu-iotest 161 fails intermittedly due to a race condition:
> 
> qemu:block / io-qcow2-161             ERROR            2.08s   exit status 1
> ――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
> stderr:
> --- tests/qemu-iotests/161.out
> +++ scratch/qcow2-file-161/161.out.bad
> @@ -34,6 +34,8 @@
>  *** Commit and then change an option on the backing file
> 
>  Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
> +qemu-img: TEST_DIR/t.IMGFMT.base: Failed to get "write" lock
> +Is another process using the image [TEST_DIR/t.IMGFMT.base]?
>  Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
>  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT
>  { 'execute': 'qmp_capabilities' }
> 
> This test is run right after a previous test, where we've
> killed qemu process which holds the test image open.
> It looks like when the next test is started (with creating
> the image files), old qemu is still running, so we're racing
> with that qemu, and qemu-img is unable to lock the image file
> properly.
> 
> We can add some `sleep $little-amount` here, but it is simpler
> and more reliable to just remove the image files, so that new
> ones are created.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2867
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
> index f25effab936..0b8ba0b19e2 100755
> --- a/tests/qemu-iotests/161
> +++ b/tests/qemu-iotests/161
> @@ -106,6 +106,7 @@ echo
>  echo "*** Commit and then change an option on the backing file"
>  echo
>  # Create the images again
> +rm -f -- "$TEST_IMG.base" "$TEST_IMG.int"
>  TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
>  TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT
>  _make_test_img -b "$TEST_IMG.int" -F $IMGFMT

This can only work for the file protocol, but the test also supports
fuse, which is now broken.

Kevin


161   fail       [19:51:58] [19:52:03]   5.3s                 output mismatch (see /home/kwolf/source/qemu/build-clang/scratch/qcow2-fuse-161/161.out.bad)
--- /home/kwolf/source/qemu/tests/qemu-iotests/161.out
+++ /home/kwolf/source/qemu/build-clang/scratch/qcow2-fuse-161/161.out.bad
@@ -33,6 +33,8 @@

 *** Commit and then change an option on the backing file

+rm: cannot remove '/tmp/qemu-iotests-9_5xqdbm/qcow2-fuse-161/fuse-t.qcow2.base': Device or resource busy
+rm: cannot remove '/tmp/qemu-iotests-9_5xqdbm/qcow2-fuse-161/fuse-t.qcow2.int': Device or resource busy
 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
 Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT
Failures: 161
Failed 1 of 1 iotests



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

* Re: [PATCH for-11.1?] qemu-iotest 161: fix race
  2026-07-28 17:53 ` Kevin Wolf
@ 2026-07-28 20:36   ` Michael Tokarev
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2026-07-28 20:36 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On 7/28/26 20:53, Kevin Wolf wrote:

>> diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161
>> index f25effab936..0b8ba0b19e2 100755
>> --- a/tests/qemu-iotests/161
>> +++ b/tests/qemu-iotests/161
>> @@ -106,6 +106,7 @@ echo
>>   echo "*** Commit and then change an option on the backing file"
>>   echo
>>   # Create the images again
>> +rm -f -- "$TEST_IMG.base" "$TEST_IMG.int"
>>   TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
>>   TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT
>>   _make_test_img -b "$TEST_IMG.int" -F $IMGFMT
> 
> This can only work for the file protocol, but the test also supports
> fuse, which is now broken.

I haven't noticed _rm_test_img function.  I wonder maybe we can add
this rm into _make_test_img directly, and fix this for all tests?

_make_test_img already calls _rm_test_img - for fuse protocol exactly.
It can call _rm_test_img unconditionally, I guess.

I'll give it a try tomorrow.

Thanks,

/mjt


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

end of thread, other threads:[~2026-07-28 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 16:39 [PATCH for-11.1?] qemu-iotest 161: fix race Michael Tokarev
2026-07-28 17:43 ` Stefan Hajnoczi
2026-07-28 17:53 ` Kevin Wolf
2026-07-28 20:36   ` Michael Tokarev

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.