From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, hreitz@redhat.com, qemu-block@nongnu.org,
qemu-trivial@nongnu.org
Subject: Re: [PATCH 1/2] blockdev: Fix block_resize error reporting for op blockers
Date: Wed, 6 Mar 2024 17:23:21 +0100 [thread overview]
Message-ID: <4cccc4c2-fe3b-4af7-aedb-69d96dadf56f@linaro.org> (raw)
In-Reply-To: <20240306131055.2460378-2-armbru@redhat.com>
On 6/3/24 14:10, Markus Armbruster wrote:
> When block_resize() runs into an op blocker, it creates an error like
> this:
>
> error_setg(errp, "Device '%s' is in use", device);
>
> Trouble is @device can be null. My system formats null as "(null)",
> but other systems might crash. Reproducer:
>
> 1. Create two block devices
>
> -> {"execute": "blockdev-add", "arguments": {"driver": "file", "node-name": "blk0", "filename": "64k.img"}}
> <- {"return": {}}
> -> {"execute": "blockdev-add", "arguments": {"driver": "file", "node-name": "blk1", "filename": "m.img"}}
> <- {"return": {}}
>
> 2. Put a blocker on one them
>
> -> {"execute": "blockdev-mirror", "arguments": {"job-id": "job0", "device": "blk0", "target": "blk1", "sync": "full"}}
> {"return": {}}
> -> {"execute": "job-pause", "arguments": {"id": "job0"}}
> {"return": {}}
> -> {"execute": "job-complete", "arguments": {"id": "job0"}}
> {"return": {}}
>
> Note: job events elided for brevity.
>
> 3. Attempt to resize
>
> -> {"execute": "block_resize", "arguments": {"node-name": "blk1", "size":32768}}
> <- {"error": {"class": "GenericError", "desc": "Device '(null)' is in use"}}
>
> Broken when commit 3b1dbd11a60 made @device optional. Fixed in commit
> ed3d2ec98a3 (block: Add errp to b{lk,drv}_truncate()), except for this
> one instance.
>
> Fix it by using the error message provided by the op blocker instead,
> so it fails like this:
>
> <- {"error": {"class": "GenericError", "desc": "Node 'blk1' is busy: block device is in use by block job: mirror"}}
>
> Fixes: 3b1dbd11a60d (qmp: Allow block_resize to manipulate bs graph nodes.)
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> blockdev.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2024-03-06 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 13:10 [PATCH 0/2] blockdev: Fix block_resize error reporting for op blockers Markus Armbruster
2024-03-06 13:10 ` [PATCH 1/2] " Markus Armbruster
2024-03-06 16:23 ` Philippe Mathieu-Daudé [this message]
2024-03-06 13:10 ` [PATCH 2/2] qerror: QERR_DEVICE_IN_USE is no longer used, drop Markus Armbruster
2024-03-06 16:23 ` Philippe Mathieu-Daudé
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=4cccc4c2-fe3b-4af7-aedb-69d96dadf56f@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).