From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH for-11.1?] qemu-iotest 161: fix race
Date: Wed, 29 Jul 2026 12:04:25 +0100 [thread overview]
Message-ID: <amneOTq8dVIw-YIZ@redhat.com> (raw)
In-Reply-To: <20260728163919.369020-1-mjt@tls.msk.ru>
On Tue, Jul 28, 2026 at 07:39:16PM +0300, Michael Tokarev 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.
When you say "previous test" can you clarify the scenario you're
hitting. The tests run with TEST_DIR set to a name that is unique
to the test name + format. eg
qemu.git/build/scratch/raw-file-101
so...
> 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.
...iiuc this can only happen if the exact same test + format is
re-run ?
Is that what you're doing ?
If so, rather than deleting the image we should do two
things
* Make sure tests clean up after themselves if we find one that
is buggy and leaves stuff running
* Make TEST_DIR more unique by adding the current test hardness
PID to is, so re-runs can never clash
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index dbe2dddc32..9c7f9d733e 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -259,7 +259,7 @@ def do_run_test(self, test: str) -> TestResult:
for d in ['TEST_DIR', 'SOCK_DIR']:
env[d] = os.path.join(
env[d],
- f"{self.env.imgfmt}-{self.env.imgproto}-{f_test.name}")
+ f"{self.env.imgfmt}-{self.env.imgproto}-{f_test.name}-{os.getpid()}")
Path(env[d]).mkdir(parents=True, exist_ok=True)
test_dir = env['TEST_DIR']
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-07-29 11:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-07-29 9:17 ` Kevin Wolf
2026-07-29 10:46 ` Michael Tokarev
2026-07-29 11:04 ` Daniel P. Berrangé [this message]
2026-07-29 11:18 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amneOTq8dVIw-YIZ@redhat.com \
--to=berrange@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.