* [PULL 0/1] Block layer patches
@ 2021-08-03 14:41 Kevin Wolf
2021-08-04 10:39 ` Peter Maydell
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2021-08-03 14:41 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel
The following changes since commit 7f1cab9c628a798ae2607940993771e6300e9e00:
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-08-02 17:21:50 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 87ab88025247b893aad5071fd38301b67be76d1a:
block: Fix in_flight leak in request padding error path (2021-08-03 15:43:30 +0200)
----------------------------------------------------------------
Block layer patches
- Fix hang after request padding error (Windows + 512-on-4k emulation)
----------------------------------------------------------------
Kevin Wolf (1):
block: Fix in_flight leak in request padding error path
block/io.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PULL 0/1] Block layer patches
2021-08-03 14:41 Kevin Wolf
@ 2021-08-04 10:39 ` Peter Maydell
0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2021-08-04 10:39 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block
On Tue, 3 Aug 2021 at 15:41, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit 7f1cab9c628a798ae2607940993771e6300e9e00:
>
> Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-08-02 17:21:50 +0100)
>
> are available in the Git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 87ab88025247b893aad5071fd38301b67be76d1a:
>
> block: Fix in_flight leak in request padding error path (2021-08-03 15:43:30 +0200)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - Fix hang after request padding error (Windows + 512-on-4k emulation)
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PULL 0/1] Block layer patches
@ 2022-08-23 14:04 Kevin Wolf
2022-08-23 19:16 ` Richard Henderson
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2022-08-23 14:04 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel
The following changes since commit ba58ccbef60338d0b7334c714589a6423a3e7f91:
Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging (2022-08-19 09:35:29 -0700)
are available in the Git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 51e15194b0a091e5c40aab2eb234a1d36c5c58ee:
scsi-generic: Fix emulated block limits VPD page (2022-08-23 16:01:13 +0200)
----------------------------------------------------------------
Block layer patches
- scsi-generic: Fix I/O errors due to wrong block limits
----------------------------------------------------------------
Kevin Wolf (1):
scsi-generic: Fix emulated block limits VPD page
hw/scsi/scsi-generic.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PULL 0/1] Block layer patches
2022-08-23 14:04 Kevin Wolf
@ 2022-08-23 19:16 ` Richard Henderson
0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2022-08-23 19:16 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: qemu-devel
On 8/23/22 07:04, Kevin Wolf wrote:
> The following changes since commit ba58ccbef60338d0b7334c714589a6423a3e7f91:
>
> Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging (2022-08-19 09:35:29 -0700)
>
> are available in the Git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 51e15194b0a091e5c40aab2eb234a1d36c5c58ee:
>
> scsi-generic: Fix emulated block limits VPD page (2022-08-23 16:01:13 +0200)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - scsi-generic: Fix I/O errors due to wrong block limits
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PULL 0/1] Block layer patches
@ 2025-12-02 16:26 Kevin Wolf
2025-12-02 16:26 ` [PULL 1/1] file-posix: Handle suspended dm-multipath better for SG_IO Kevin Wolf
2025-12-05 13:26 ` [PULL 0/1] Block layer patches Richard Henderson
0 siblings, 2 replies; 7+ messages in thread
From: Kevin Wolf @ 2025-12-02 16:26 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel
The following changes since commit 66ec38b6fa593afcc26a2dfb5d1f9871dd15f527:
Merge tag 'pull-target-arm-20251201' of https://gitlab.com/pm215/qemu into staging (2025-12-01 12:08:52 -0800)
are available in the Git repository at:
https://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to d94ea1a10bdfb99c5822e64a5b6ee3e352719326:
file-posix: Handle suspended dm-multipath better for SG_IO (2025-12-02 16:51:47 +0100)
----------------------------------------------------------------
Block layer patches
- SCSI passthrough: Fix errors on temporarily suspended dm-multipath
----------------------------------------------------------------
Kevin Wolf (1):
file-posix: Handle suspended dm-multipath better for SG_IO
block/file-posix.c | 56 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 22 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PULL 1/1] file-posix: Handle suspended dm-multipath better for SG_IO
2025-12-02 16:26 [PULL 0/1] Block layer patches Kevin Wolf
@ 2025-12-02 16:26 ` Kevin Wolf
2025-12-05 13:26 ` [PULL 0/1] Block layer patches Richard Henderson
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2025-12-02 16:26 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel
When introducing DM_MPATH_PROBE_PATHS, we already anticipated that
dm-multipath devices might be suspended for a short time when the DM
tables are reloaded and that they return -EAGAIN in this case. The
behaviour promised in the comment wasn't actually implemented, though:
We don't get SG_IO_MAX_RETRIES in practice, because after the first
1ms sleep, DM_MPATH_PROBE_PATHS is called and if that still fails with
-EAGAIN, we error out immediately without any retry.
However, meanwhile it has also turned out that libmpathpersist (which is
used by qemu-pr-helper) may need to perform more complex recovery
operations to get reservations back to expected state if a path failure
happened in the middle of a PR operation. In this case, the device is
suspended for a longer time compared to the case we originally expected.
This patch changes hdev_co_ioctl() to treat -EAGAIN separately so that
it doesn't result in an immediate failure if the device is suspended for
more than 1ms, and moves to incremental backoff to cover both quick and
slow cases without excessive delays.
Buglink: https://issues.redhat.com/browse/RHEL-121543
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20251128221440.89125-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/file-posix.c | 56 ++++++++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index c9e367a222..6265d2e248 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -4288,25 +4288,8 @@ hdev_open_Mac_error:
static bool coroutine_fn sgio_path_error(int ret, sg_io_hdr_t *io_hdr)
{
if (ret < 0) {
- switch (ret) {
- case -ENODEV:
- return true;
- case -EAGAIN:
- /*
- * The device is probably suspended. This happens while the dm table
- * is reloaded, e.g. because a path is added or removed. This is an
- * operation that should complete within 1ms, so just wait a bit and
- * retry.
- *
- * If the device was suspended for another reason, we'll wait and
- * retry SG_IO_MAX_RETRIES times. This is a tolerable delay before
- * we return an error and potentially stop the VM.
- */
- qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
- return true;
- default:
- return false;
- }
+ /* Path errors sometimes result in -ENODEV */
+ return ret == -ENODEV;
}
if (io_hdr->host_status != SCSI_HOST_OK) {
@@ -4375,6 +4358,7 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
{
BDRVRawState *s = bs->opaque;
RawPosixAIOData acb;
+ uint64_t eagain_sleep_ns = 1 * SCALE_MS;
int retries = SG_IO_MAX_RETRIES;
int ret;
@@ -4403,9 +4387,37 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
},
};
- do {
- ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
- } while (req == SG_IO && retries-- && hdev_co_ioctl_sgio_retry(&acb, ret));
+retry:
+ ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
+ if (req == SG_IO && s->use_mpath) {
+ if (ret == -EAGAIN && eagain_sleep_ns < NANOSECONDS_PER_SECOND) {
+ /*
+ * If this is a multipath device, it is probably suspended.
+ *
+ * This can happen while the dm table is reloaded, e.g. because a
+ * path is added or removed. This is an operation that should
+ * complete within 1ms, so just wait a bit and retry.
+ *
+ * There are also some cases in which libmpathpersist must recover
+ * from path failure during its operation, which can leave the
+ * device suspended for a bit longer while the library brings back
+ * reservations into the expected state.
+ *
+ * Use increasing delays to cover both cases without waiting
+ * excessively, and stop after a bit more than a second (1023 ms).
+ * This is a tolerable delay before we return an error and
+ * potentially stop the VM.
+ */
+ qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, eagain_sleep_ns);
+ eagain_sleep_ns *= 2;
+ goto retry;
+ }
+
+ /* Even for ret == 0, the SG_IO header can contain an error */
+ if (retries-- && hdev_co_ioctl_sgio_retry(&acb, ret)) {
+ goto retry;
+ }
+ }
return ret;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PULL 0/1] Block layer patches
2025-12-02 16:26 [PULL 0/1] Block layer patches Kevin Wolf
2025-12-02 16:26 ` [PULL 1/1] file-posix: Handle suspended dm-multipath better for SG_IO Kevin Wolf
@ 2025-12-05 13:26 ` Richard Henderson
1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2025-12-05 13:26 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: qemu-devel
On 12/2/25 10:26, Kevin Wolf wrote:
> The following changes since commit 66ec38b6fa593afcc26a2dfb5d1f9871dd15f527:
>
> Merge tag 'pull-target-arm-20251201' ofhttps://gitlab.com/pm215/qemu into staging (2025-12-01 12:08:52 -0800)
>
> are available in the Git repository at:
>
> https://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to d94ea1a10bdfb99c5822e64a5b6ee3e352719326:
>
> file-posix: Handle suspended dm-multipath better for SG_IO (2025-12-02 16:51:47 +0100)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - SCSI passthrough: Fix errors on temporarily suspended dm-multipath
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-05 13:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 16:26 [PULL 0/1] Block layer patches Kevin Wolf
2025-12-02 16:26 ` [PULL 1/1] file-posix: Handle suspended dm-multipath better for SG_IO Kevin Wolf
2025-12-05 13:26 ` [PULL 0/1] Block layer patches Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2022-08-23 14:04 Kevin Wolf
2022-08-23 19:16 ` Richard Henderson
2021-08-03 14:41 Kevin Wolf
2021-08-04 10:39 ` Peter Maydell
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).