public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PULL 0/4] Block layer patches
@ 2019-09-20 16:20 Kevin Wolf
  2019-09-23  9:49 ` Peter Maydell
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Wolf @ 2019-09-20 16:20 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit 521db80318d6c749a6f6c5a65a68397af9e3ef16:

  Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2019-09-16' into staging (2019-09-16 15:25:55 +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 d2c8c09fca9210d0f2399c8d570086a4a66bd22e:

  iotests: Remove Python 2 compatibility code (2019-09-20 17:58:51 +0200)

----------------------------------------------------------------
Block layer patches:

- Fix internal snapshots with typical -blockdev setups
- iotests: Require Python 3.6 or later

----------------------------------------------------------------
Kevin Wolf (4):
      block/snapshot: Restrict set of snapshot nodes
      iotests: Test internal snapshots with -blockdev
      iotests: Require Python 3.6 or later
      iotests: Remove Python 2 compatibility code

 block/snapshot.c                         |  26 +++--
 tests/qemu-iotests/044                   |   3 -
 tests/qemu-iotests/163                   |   3 -
 tests/qemu-iotests/267                   | 168 ++++++++++++++++++++++++++++
 tests/qemu-iotests/267.out               | 182 +++++++++++++++++++++++++++++++
 tests/qemu-iotests/check                 |  13 ++-
 tests/qemu-iotests/common.filter         |   5 +-
 tests/qemu-iotests/group                 |   1 +
 tests/qemu-iotests/iotests.py            |  13 +--
 tests/qemu-iotests/nbd-fault-injector.py |   7 +-
 10 files changed, 389 insertions(+), 32 deletions(-)
 create mode 100755 tests/qemu-iotests/267
 create mode 100644 tests/qemu-iotests/267.out


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

* Re: [PULL 0/4] Block layer patches
  2019-09-20 16:20 Kevin Wolf
@ 2019-09-23  9:49 ` Peter Maydell
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2019-09-23  9:49 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block

On Fri, 20 Sep 2019 at 17:21, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit 521db80318d6c749a6f6c5a65a68397af9e3ef16:
>
>   Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2019-09-16' into staging (2019-09-16 15:25:55 +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 d2c8c09fca9210d0f2399c8d570086a4a66bd22e:
>
>   iotests: Remove Python 2 compatibility code (2019-09-20 17:58:51 +0200)
>
> ----------------------------------------------------------------
> Block layer patches:
>
> - Fix internal snapshots with typical -blockdev setups
> - iotests: Require Python 3.6 or later
>
> ----------------------------------------------------------------
> Kevin Wolf (4):
>       block/snapshot: Restrict set of snapshot nodes
>       iotests: Test internal snapshots with -blockdev
>       iotests: Require Python 3.6 or later
>       iotests: Remove Python 2 compatibility code

Hi. This fails 'make check' on all the non-x86 Linux hosts:
iotests 267 fails on aarch32, ppc64, s390x, aarch64.
Sample output from the aarch32 run; others are similar
but the listed snapshot size differs.

  TEST    iotest-qcow2: 267 [fail]
QEMU          --
"/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/../../aarch64-softmmu/qemu-system-aarch64"
-nodefaults -display none
-machine virt,accel=qtest
QEMU_IMG      --
"/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/../../qemu-img"
QEMU_IO       --
"/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/../../qemu-io"
 --cache writeback -f qcow2
QEMU_NBD      --
"/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/../../qemu-nbd"
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/aarch64 mustang-maydell 4.15.0-51-generic
TEST_DIR      --
/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/scratch
SOCKET_SCM_HELPER --
/home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/socket_scm_helper

--- /home/peter.maydell/qemu/tests/qemu-iotests/267.out 2019-09-20
17:54:40.127012142 +0000
+++ /home/peter.maydell/qemu/build/all-a32/tests/qemu-iotests/267.out.bad
      2019-09-20 18:02:11.756586745 +0000
@@ -34,7 +34,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -45,7 +45,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               636 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               684 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -70,7 +70,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               636 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               684 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -95,7 +95,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -106,7 +106,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -120,7 +120,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -135,7 +135,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -146,14 +146,14 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

 Internal snapshots on overlay:
 Snapshot list:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
-1         snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+1         snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 Internal snapshots on backing file:

 === -blockdev with NBD server on the backing file ===
@@ -167,7 +167,7 @@
 (qemu) info snapshots
 List of snapshots present on all disks:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
---        snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+--        snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 (qemu) loadvm snap0
 (qemu) quit

@@ -178,5 +178,5 @@
 Internal snapshots on backing file:
 Snapshot list:
 ID        TAG                 VM SIZE                DATE       VM CLOCK
-1         snap0               591 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
+1         snap0               640 KiB yyyy-mm-dd hh:mm:ss   00:00:00.000
 *** done
Not run: 172 186 192 220
Failures: 267
Failed 1 of 104 iotests


thanks
-- PMM


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

* [PULL 0/4] Block layer patches
@ 2023-03-28 12:35 Kevin Wolf
  2023-03-28 19:42 ` Peter Maydell
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Wolf @ 2023-03-28 12:35 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit e3debd5e7d0ce031356024878a0a18b9d109354a:

  Merge tag 'pull-request-2023-03-24' of https://gitlab.com/thuth/qemu into staging (2023-03-24 16:08:46 +0000)

are available in the Git repository at:

  https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to d8fbf9aa85aed64450907580a1d70583f097e9df:

  block/export: Fix graph locking in blk_get_geometry() call (2023-03-27 15:16:05 +0200)

----------------------------------------------------------------
Block layer patches

- aio-posix: Fix race during epoll upgrade
- vhost-user-blk/VDUSE export: Fix a potential deadlock and an assertion
  failure when the export runs in an iothread
- NBD server: Push pending frames after sending reply to fix performance
  especially when used with TLS

----------------------------------------------------------------
Florian Westphal (1):
      nbd/server: push pending frames after sending reply

Kevin Wolf (1):
      block/export: Fix graph locking in blk_get_geometry() call

Stefan Hajnoczi (2):
      block/export: only acquire AioContext once for vhost_user_server_stop()
      aio-posix: fix race between epoll upgrade and aio_set_fd_handler()

 include/block/block-io.h          |  4 +++-
 include/sysemu/block-backend-io.h |  5 ++++-
 block.c                           |  5 +++--
 block/block-backend.c             |  7 +++++--
 block/export/virtio-blk-handler.c |  7 ++++---
 nbd/server.c                      |  3 +++
 util/fdmon-epoll.c                | 25 ++++++++++++++++++-------
 util/vhost-user-server.c          |  5 +----
 8 files changed, 41 insertions(+), 20 deletions(-)



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

* Re: [PULL 0/4] Block layer patches
  2023-03-28 12:35 Kevin Wolf
@ 2023-03-28 19:42 ` Peter Maydell
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2023-03-28 19:42 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, qemu-devel

On Tue, 28 Mar 2023 at 13:35, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit e3debd5e7d0ce031356024878a0a18b9d109354a:
>
>   Merge tag 'pull-request-2023-03-24' of https://gitlab.com/thuth/qemu into staging (2023-03-24 16:08:46 +0000)
>
> are available in the Git repository at:
>
>   https://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to d8fbf9aa85aed64450907580a1d70583f097e9df:
>
>   block/export: Fix graph locking in blk_get_geometry() call (2023-03-27 15:16:05 +0200)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - aio-posix: Fix race during epoll upgrade
> - vhost-user-blk/VDUSE export: Fix a potential deadlock and an assertion
>   failure when the export runs in an iothread
> - NBD server: Push pending frames after sending reply to fix performance
>   especially when used with TLS


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.

-- PMM


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

* [PULL 0/4] Block layer patches
@ 2023-11-28 14:09 Kevin Wolf
  0 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2023-11-28 14:09 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, stefanha, qemu-devel

The following changes since commit e867b01cd6658a64c16052117dbb18093a2f9772:

  Merge tag 'qga-pull-2023-11-25' of https://github.com/kostyanf14/qemu into staging (2023-11-27 08:59:00 -0500)

are available in the Git repository at:

  https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 6e081324facf9aeece9c286774bab5af3b8d6099:

  ide/via: Fix BAR4 value in legacy mode (2023-11-28 14:56:32 +0100)

----------------------------------------------------------------
Block layer patches

- ide/via: Fix BAR4 value in legacy mode
- export/vhost-user-blk: Fix consecutive drains
- vmdk: Don't corrupt desc file in vmdk_write_cid
- iotests: fix default machine type detection

----------------------------------------------------------------
Andrey Drobyshev (1):
      iotests: fix default machine type detection

BALATON Zoltan (1):
      ide/via: Fix BAR4 value in legacy mode

Fam Zheng (1):
      vmdk: Don't corrupt desc file in vmdk_write_cid

Kevin Wolf (1):
      export/vhost-user-blk: Fix consecutive drains

 include/qemu/vhost-user-server.h     |  1 +
 block/export/vhost-user-blk-server.c |  9 +++++++--
 block/vmdk.c                         | 28 ++++++++++++++++++--------
 hw/ide/via.c                         | 17 ++++++++++------
 util/vhost-user-server.c             | 39 ++++++++++++++++++++++++++++--------
 tests/qemu-iotests/testenv.py        |  2 +-
 tests/qemu-iotests/059               |  2 ++
 tests/qemu-iotests/059.out           |  4 ++++
 8 files changed, 77 insertions(+), 25 deletions(-)



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

* [PULL 0/4] Block layer patches
@ 2025-04-08 13:00 Kevin Wolf
  2025-04-09  8:31 ` Stefan Hajnoczi
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Wolf @ 2025-04-08 13:00 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

The following changes since commit dfaecc04c46d298e9ee81bd0ca96d8754f1c27ed:

  Merge tag 'pull-riscv-to-apply-20250407-1' of https://github.com/alistair23/qemu into staging (2025-04-07 09:18:33 -0400)

are available in the Git repository at:

  https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to f8222bfba3409a3ce09c191941127a8cf2c7e623:

  test-bdrv-drain: Fix data races (2025-04-08 15:00:01 +0200)

----------------------------------------------------------------
Block layer patches

- scsi-disk: Apply error policy for host_status errors again
- qcow2: Fix qemu-img info crash with missing crypto header
- qemu-img bench: Fix division by zero for zero-sized images
- test-bdrv-drain: Fix data races

----------------------------------------------------------------
Denis Rastyogin (1):
      qemu-img: fix division by zero in bench_cb() for zero-sized images

Kevin Wolf (2):
      qcow2: Don't crash qemu-img info with missing crypto header
      scsi-disk: Apply error policy for host_status errors again

Vitalii Mordan (1):
      test-bdrv-drain: Fix data races

 include/qemu/job.h                            |  3 ++
 block/qcow2.c                                 |  4 +-
 hw/scsi/scsi-disk.c                           | 39 +++++++++-----
 job.c                                         |  6 +++
 qemu-img.c                                    |  6 ++-
 tests/unit/test-bdrv-drain.c                  | 32 +++++++-----
 tests/qemu-iotests/tests/qcow2-encryption     | 75 +++++++++++++++++++++++++++
 tests/qemu-iotests/tests/qcow2-encryption.out | 32 ++++++++++++
 8 files changed, 167 insertions(+), 30 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/qcow2-encryption
 create mode 100644 tests/qemu-iotests/tests/qcow2-encryption.out



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

* Re: [PULL 0/4] Block layer patches
  2025-04-08 13:00 Kevin Wolf
@ 2025-04-09  8:31 ` Stefan Hajnoczi
  0 siblings, 0 replies; 19+ messages in thread
From: Stefan Hajnoczi @ 2025-04-09  8:31 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PULL 0/4] Block layer patches
@ 2025-04-25 17:52 Kevin Wolf
  2025-04-28 17:56 ` Stefan Hajnoczi
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Wolf @ 2025-04-25 17:52 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

The following changes since commit 019fbfa4bcd2d3a835c241295e22ab2b5b56129b:

  Merge tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru into staging (2025-04-24 13:44:57 -0400)

are available in the Git repository at:

  https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 2b689db0bedd24eda8b491cb1fcfb015dfec5a31:

  qemu-img: improve queue depth validation in img_bench (2025-04-25 18:09:04 +0200)

----------------------------------------------------------------
Block layer patches

- Discard alignment fixes
- Remove unused callback .bdrv_aio_pdiscard()
- qemu-img bench: Input validation fix

----------------------------------------------------------------
Denis Rastyogin (1):
      qemu-img: improve queue depth validation in img_bench

Stefan Hajnoczi (2):
      file-posix: probe discard alignment on Linux block devices
      block/io: skip head/tail requests on EINVAL

Sunny Zhu (1):
      block: Remove unused callback function *bdrv_aio_pdiscard

 include/block/block_int-common.h |  4 ---
 block/file-posix.c               | 67 +++++++++++++++++++++++++++++++++++++++-
 block/io.c                       | 35 +++++++--------------
 qemu-img.c                       |  2 +-
 4 files changed, 79 insertions(+), 29 deletions(-)



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

* Re: [PULL 0/4] Block layer patches
  2025-04-25 17:52 Kevin Wolf
@ 2025-04-28 17:56 ` Stefan Hajnoczi
  0 siblings, 0 replies; 19+ messages in thread
From: Stefan Hajnoczi @ 2025-04-28 17:56 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PULL 0/4] Block layer patches
@ 2025-11-25 16:16 Kevin Wolf
  2025-11-25 19:29 ` Richard Henderson
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Wolf @ 2025-11-25 16:16 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, richard.henderson, qemu-devel

The following changes since commit de074358e99b8eb5076d3efa267e44c292c90e3e:

  Merge tag 'pull-target-arm-20251124' of https://gitlab.com/pm215/qemu into staging (2025-11-24 09:03:12 -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 59a1cf0cd31597d2f6e2c18dc400a1de8427d47d:

  iotests: add Linux loop device image creation test (2025-11-25 15:26:22 +0100)

----------------------------------------------------------------
Block layer patches

- Image creation: Honour pwrite_zeroes_alignment for zeroing first sector
- block-backend: Fix race (causing a crash) when resuming queued requests

----------------------------------------------------------------
Kevin Wolf (1):
      block-backend: Fix race when resuming queued requests

Stefan Hajnoczi (3):
      file-posix: populate pwrite_zeroes_alignment
      block: use pwrite_zeroes_alignment when writing first sector
      iotests: add Linux loop device image creation test

 include/system/block-backend-io.h             |  1 +
 block.c                                       |  3 +-
 block/block-backend.c                         | 19 +++++++--
 block/file-posix.c                            | 16 ++++++++
 tests/qemu-iotests/tests/loop-create-file     | 59 +++++++++++++++++++++++++++
 tests/qemu-iotests/tests/loop-create-file.out |  8 ++++
 6 files changed, 102 insertions(+), 4 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/loop-create-file
 create mode 100644 tests/qemu-iotests/tests/loop-create-file.out



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

* Re: [PULL 0/4] Block layer patches
  2025-11-25 16:16 Kevin Wolf
@ 2025-11-25 19:29 ` Richard Henderson
  0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2025-11-25 19:29 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel

On 11/25/25 08:16, Kevin Wolf wrote:
> The following changes since commit de074358e99b8eb5076d3efa267e44c292c90e3e:
> 
>    Merge tag 'pull-target-arm-20251124' ofhttps://gitlab.com/pm215/qemu into staging (2025-11-24 09:03:12 -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 59a1cf0cd31597d2f6e2c18dc400a1de8427d47d:
> 
>    iotests: add Linux loop device image creation test (2025-11-25 15:26:22 +0100)
> 
> ----------------------------------------------------------------
> Block layer patches
> 
> - Image creation: Honour pwrite_zeroes_alignment for zeroing first sector
> - block-backend: Fix race (causing a crash) when resuming queued requests

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~


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

* [PULL 0/4] Block layer patches
@ 2026-03-24 18:56 Kevin Wolf
  2026-03-24 18:56 ` [PULL 1/4] block/curl: free s->password in cleanup paths Kevin Wolf
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-24 18:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

The following changes since commit fa4b2e31e649ba6fdb3eb2dd43952aad4a3bd675:

  Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging (2026-03-24 10:41:21 +0000)

are available in the Git repository at:

  https://gitlab.com/kmwolf/qemu.git tags/for-upstream

for you to fetch changes up to cf9cdaea6e24d13dfdf8402f6829d2ca4dca864b:

  io-uring: Resubmit tails of short writes (2026-03-24 19:55:09 +0100)

----------------------------------------------------------------
Block layer patches

- linux-aio/io-uring: Resubmit tails of short reads/writes
- curl: Fix memory leak

----------------------------------------------------------------
GuoHan Zhao (1):
      block/curl: free s->password in cleanup paths

Hanna Czenczek (3):
      linux-aio: Put all parameters into qemu_laiocb
      linux-aio: Resubmit tails of short reads/writes
      io-uring: Resubmit tails of short writes

 block/curl.c       |  2 ++
 block/io_uring.c   | 82 +++++++++++++++++++++++++++-----------------------
 block/linux-aio.c  | 88 +++++++++++++++++++++++++++++++++++++++++++-----------
 block/trace-events |  2 +-
 4 files changed, 119 insertions(+), 55 deletions(-)



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

* [PULL 1/4] block/curl: free s->password in cleanup paths
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
@ 2026-03-24 18:56 ` Kevin Wolf
  2026-03-24 18:56 ` [PULL 2/4] linux-aio: Put all parameters into qemu_laiocb Kevin Wolf
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-24 18:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: GuoHan Zhao <zhaoguohan@kylinos.cn>

When password-secret is used, curl_open() resolves it with
qcrypto_secret_lookup_as_utf8() and stores the returned buffer in
s->password.

Unlike s->proxypassword, s->password is not freed either in the open
failure path or in curl_close(), so the resolved secret leaks once it
has been allocated.

Free s->password in both cleanup paths.

Fixes: 1bff96064290 ('curl: add support for HTTP authentication parameters')
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Message-ID: <20260320063016.262954-1-zhaoguohan_salmon@163.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/curl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/curl.c b/block/curl.c
index 66aecfb20ec..419df78258b 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -903,6 +903,7 @@ out_noclean:
     g_free(s->cookie);
     g_free(s->url);
     g_free(s->username);
+    g_free(s->password);
     g_free(s->proxyusername);
     g_free(s->proxypassword);
     if (s->sockets) {
@@ -1014,6 +1015,7 @@ static void curl_close(BlockDriverState *bs)
     g_free(s->cookie);
     g_free(s->url);
     g_free(s->username);
+    g_free(s->password);
     g_free(s->proxyusername);
     g_free(s->proxypassword);
 }
-- 
2.53.0



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

* [PULL 2/4] linux-aio: Put all parameters into qemu_laiocb
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
  2026-03-24 18:56 ` [PULL 1/4] block/curl: free s->password in cleanup paths Kevin Wolf
@ 2026-03-24 18:56 ` Kevin Wolf
  2026-03-24 18:56 ` [PULL 3/4] linux-aio: Resubmit tails of short reads/writes Kevin Wolf
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-24 18:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Hanna Czenczek <hreitz@redhat.com>

Put all request parameters into the qemu_laiocb struct, which will allow
re-submitting the tail of short reads/writes.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260324084338.37453-2-hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/linux-aio.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index 53c3e9af8ae..3843f45eac8 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -41,9 +41,15 @@ struct qemu_laiocb {
     LinuxAioState *ctx;
     struct iocb iocb;
     ssize_t ret;
+    off_t offset;
     size_t nbytes;
     QEMUIOVector *qiov;
-    bool is_read;
+
+    int fd;
+    int type;
+    BdrvRequestFlags flags;
+
+    uint64_t dev_max_batch;
     QSIMPLEQ_ENTRY(qemu_laiocb) next;
 };
 
@@ -87,7 +93,7 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
             ret = 0;
         } else if (ret >= 0) {
             /* Short reads mean EOF, pad with zeros. */
-            if (laiocb->is_read) {
+            if (laiocb->type == QEMU_AIO_READ) {
                 qemu_iovec_memset(laiocb->qiov, ret, 0,
                     laiocb->qiov->size - ret);
             } else {
@@ -367,23 +373,23 @@ static void laio_deferred_fn(void *opaque)
     }
 }
 
-static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
-                          int type, BdrvRequestFlags flags,
-                          uint64_t dev_max_batch)
+static int laio_do_submit(struct qemu_laiocb *laiocb)
 {
     LinuxAioState *s = laiocb->ctx;
     struct iocb *iocbs = &laiocb->iocb;
     QEMUIOVector *qiov = laiocb->qiov;
+    int fd = laiocb->fd;
+    off_t offset = laiocb->offset;
 
-    switch (type) {
+    switch (laiocb->type) {
     case QEMU_AIO_WRITE:
 #ifdef HAVE_IO_PREP_PWRITEV2
     {
-        int laio_flags = (flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
+        int laio_flags = (laiocb->flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
         io_prep_pwritev2(iocbs, fd, qiov->iov, qiov->niov, offset, laio_flags);
     }
 #else
-        assert(flags == 0);
+        assert(laiocb->flags == 0);
         io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset);
 #endif
         break;
@@ -399,7 +405,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
     /* Currently Linux kernel does not support other operations */
     default:
         fprintf(stderr, "%s: invalid AIO request type 0x%x.\n",
-                        __func__, type);
+                        __func__, laiocb->type);
         return -EIO;
     }
     io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e));
@@ -407,7 +413,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
     QSIMPLEQ_INSERT_TAIL(&s->io_q.pending, laiocb, next);
     s->io_q.in_queue++;
     if (!s->io_q.blocked) {
-        if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch)) {
+        if (s->io_q.in_queue >= laio_max_batch(s, laiocb->dev_max_batch)) {
             ioq_submit(s);
         } else {
             defer_call(laio_deferred_fn, s);
@@ -425,14 +431,18 @@ int coroutine_fn laio_co_submit(int fd, uint64_t offset, QEMUIOVector *qiov,
     AioContext *ctx = qemu_get_current_aio_context();
     struct qemu_laiocb laiocb = {
         .co         = qemu_coroutine_self(),
+        .offset     = offset,
         .nbytes     = qiov ? qiov->size : 0,
         .ctx        = aio_get_linux_aio(ctx),
         .ret        = -EINPROGRESS,
-        .is_read    = (type == QEMU_AIO_READ),
         .qiov       = qiov,
+        .fd         = fd,
+        .type       = type,
+        .flags      = flags,
+        .dev_max_batch = dev_max_batch,
     };
 
-    ret = laio_do_submit(fd, &laiocb, offset, type, flags, dev_max_batch);
+    ret = laio_do_submit(&laiocb);
     if (ret < 0) {
         return ret;
     }
-- 
2.53.0



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

* [PULL 3/4] linux-aio: Resubmit tails of short reads/writes
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
  2026-03-24 18:56 ` [PULL 1/4] block/curl: free s->password in cleanup paths Kevin Wolf
  2026-03-24 18:56 ` [PULL 2/4] linux-aio: Put all parameters into qemu_laiocb Kevin Wolf
@ 2026-03-24 18:56 ` Kevin Wolf
  2026-03-24 18:56 ` [PULL 4/4] io-uring: Resubmit tails of short writes Kevin Wolf
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-24 18:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Hanna Czenczek <hreitz@redhat.com>

Short reads/writes can happen.  One way to reproduce them is via our
FUSE export, with the following diff applied (%s/escaped // to apply --
if you put plain diffs in commit messages, git-am will apply them, and I
would rather avoid breaking FUSE accidentally via this patch):

escaped diff --git a/block/export/fuse.c b/block/export/fuse.c
escaped index a2a478d293..67dc50a412 100644
escaped --- a/block/export/fuse.c
escaped +++ b/block/export/fuse.c
@@ -828,7 +828,7 @@ static ssize_t coroutine_fn GRAPH_RDLOCK
 fuse_co_init(FuseExport *exp, struct fuse_init_out *out,
              const struct fuse_init_in_compat *in)
 {
-    const uint32_t supported_flags = FUSE_ASYNC_READ | FUSE_ASYNC_DIO;
+    const uint32_t supported_flags = FUSE_ASYNC_READ;

     if (in->major != 7) {
         error_report("FUSE major version mismatch: We have 7, but kernel has %"
@@ -1060,6 +1060,8 @@ fuse_co_read(FuseExport *exp, void **bufptr, uint64_t offset, uint32_t size)
     void *buf;
     int ret;

+    size = MIN(size, 4096);
+
     /* Limited by max_read, should not happen */
     if (size > FUSE_MAX_READ_BYTES) {
         return -EINVAL;
@@ -1110,6 +1112,8 @@ fuse_co_write(FuseExport *exp, struct fuse_write_out *out,
     int64_t blk_len;
     int ret;

+    size = MIN(size, 4096);
+
     QEMU_BUILD_BUG_ON(FUSE_MAX_WRITE_BYTES > BDRV_REQUEST_MAX_BYTES);
     /* Limited by max_write, should not happen */
     if (size > FUSE_MAX_WRITE_BYTES) {

Then:
$ ./qemu-img create -f raw test.raw 8k
Formatting 'test.raw', fmt=raw size=8192
$ ./qemu-io -f raw -c 'write -P 42 0 8k' test.raw
wrote 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (64.804 MiB/sec and 8294.9003 ops/sec)
$ hexdump -C test.raw
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00002000

With aio=threads, short I/O works:
$ storage-daemon/qemu-storage-daemon \
    --blockdev file,node-name=test,filename=test.raw \
    --export fuse,id=exp,node-name=test,mountpoint=test.raw,writable=true

Other shell:
$ ./qemu-io --image-opts -c 'read -P 42 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=threads
read 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (36.563 MiB/sec and 4680.0923 ops/sec)
$ ./qemu-io --image-opts -c 'write -P 23 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=threads
wrote 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (35.995 MiB/sec and 4607.2970 ops/sec)
$ hexdump -C test.raw
00000000  17 17 17 17 17 17 17 17  17 17 17 17 17 17 17 17  |................|
*
00002000

But with aio=native, it does not:
$ ./qemu-io --image-opts -c 'read -P 23 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=native
Pattern verification failed at offset 0, 8192 bytes
read 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (86.155 MiB/sec and 11027.7900 ops/sec)
$ ./qemu-io --image-opts -c 'write -P 42 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=native
write failed: No space left on device
$ hexdump -C test.raw
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00001000  17 17 17 17 17 17 17 17  17 17 17 17 17 17 17 17  |................|
*
00002000

This patch fixes that.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260324084338.37453-3-hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/linux-aio.c | 56 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 6 deletions(-)

diff --git a/block/linux-aio.c b/block/linux-aio.c
index 3843f45eac8..0a7424fbb33 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -45,6 +45,10 @@ struct qemu_laiocb {
     size_t nbytes;
     QEMUIOVector *qiov;
 
+    /* For handling short reads/writes */
+    size_t total_done;
+    QEMUIOVector resubmit_qiov;
+
     int fd;
     int type;
     BdrvRequestFlags flags;
@@ -74,28 +78,61 @@ struct LinuxAioState {
 };
 
 static void ioq_submit(LinuxAioState *s);
+static int laio_do_submit(struct qemu_laiocb *laiocb);
 
 static inline ssize_t io_event_ret(struct io_event *ev)
 {
     return (ssize_t)(((uint64_t)ev->res2 << 32) | ev->res);
 }
 
+/**
+ * Retry tail of short requests.
+ */
+static int laio_resubmit_short_io(struct qemu_laiocb *laiocb, size_t done)
+{
+    QEMUIOVector *resubmit_qiov = &laiocb->resubmit_qiov;
+
+    laiocb->total_done += done;
+
+    if (!resubmit_qiov->iov) {
+        qemu_iovec_init(resubmit_qiov, laiocb->qiov->niov);
+    } else {
+        qemu_iovec_reset(resubmit_qiov);
+    }
+    qemu_iovec_concat(resubmit_qiov, laiocb->qiov,
+                      laiocb->total_done, laiocb->nbytes - laiocb->total_done);
+
+    return laio_do_submit(laiocb);
+}
+
 /*
  * Completes an AIO request.
  */
 static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
 {
-    int ret;
+    ssize_t ret;
 
     ret = laiocb->ret;
     if (ret != -ECANCELED) {
-        if (ret == laiocb->nbytes) {
+        if (ret == laiocb->nbytes - laiocb->total_done) {
             ret = 0;
+        } else if (ret > 0 && (laiocb->type == QEMU_AIO_READ ||
+                               laiocb->type == QEMU_AIO_WRITE)) {
+            ret = laio_resubmit_short_io(laiocb, ret);
+            if (!ret) {
+                return;
+            }
         } else if (ret >= 0) {
-            /* Short reads mean EOF, pad with zeros. */
+            /*
+             * For normal reads and writes, we only get here if ret == 0, which
+             * means EOF for reads and ENOSPC for writes.
+             * For zone-append, we get here with any ret >= 0, which we just
+             * treat as ENOSPC, too (safer than resubmitting, probably, but not
+             * 100 % clear).
+             */
             if (laiocb->type == QEMU_AIO_READ) {
-                qemu_iovec_memset(laiocb->qiov, ret, 0,
-                    laiocb->qiov->size - ret);
+                qemu_iovec_memset(laiocb->qiov, laiocb->total_done, 0,
+                                  laiocb->qiov->size - laiocb->total_done);
             } else {
                 ret = -ENOSPC;
             }
@@ -103,6 +140,9 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
     }
 
     laiocb->ret = ret;
+    if (laiocb->resubmit_qiov.iov) {
+        qemu_iovec_destroy(&laiocb->resubmit_qiov);
+    }
 
     /*
      * If the coroutine is already entered it must be in ioq_submit() and
@@ -379,7 +419,11 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)
     struct iocb *iocbs = &laiocb->iocb;
     QEMUIOVector *qiov = laiocb->qiov;
     int fd = laiocb->fd;
-    off_t offset = laiocb->offset;
+    off_t offset = laiocb->offset + laiocb->total_done;
+
+    if (laiocb->resubmit_qiov.iov) {
+        qiov = &laiocb->resubmit_qiov;
+    }
 
     switch (laiocb->type) {
     case QEMU_AIO_WRITE:
-- 
2.53.0



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

* [PULL 4/4] io-uring: Resubmit tails of short writes
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2026-03-24 18:56 ` [PULL 3/4] linux-aio: Resubmit tails of short reads/writes Kevin Wolf
@ 2026-03-24 18:56 ` Kevin Wolf
  2026-03-25 16:52 ` [PULL 0/4] Block layer patches Peter Maydell
  2026-03-26  5:02 ` Michael Tokarev
  5 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-24 18:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Hanna Czenczek <hreitz@redhat.com>

Short writes can happen, too, not just short reads.  The difference to
aio=native is that the kernel will actually retry the tail of short
requests internally already -- so it is harder to reproduce.  But if the
tail of a short request returns an error to the kernel, we will see it
in userspace still.  To reproduce this, apply the following patch on top
of the one shown in HEAD^ (again %s/escaped // to apply):

escaped diff --git a/block/export/fuse.c b/block/export/fuse.c
escaped index 67dc50a412..2b98489a32 100644
escaped --- a/block/export/fuse.c
escaped +++ b/block/export/fuse.c
@@ -1059,8 +1059,15 @@ fuse_co_read(FuseExport *exp, void **bufptr, uint64_t offset, uint32_t size)
     int64_t blk_len;
     void *buf;
     int ret;
+    static uint32_t error_size;

-    size = MIN(size, 4096);
+    if (error_size == size) {
+        error_size = 0;
+        return -EIO;
+    } else if (size > 4096) {
+        error_size = size - 4096;
+        size = 4096;
+    }

     /* Limited by max_read, should not happen */
     if (size > FUSE_MAX_READ_BYTES) {
@@ -1111,8 +1118,15 @@ fuse_co_write(FuseExport *exp, struct fuse_write_out *out,
 {
     int64_t blk_len;
     int ret;
+    static uint32_t error_size;

-    size = MIN(size, 4096);
+    if (error_size == size) {
+        error_size = 0;
+        return -EIO;
+    } else if (size > 4096) {
+        error_size = size - 4096;
+        size = 4096;
+    }

     QEMU_BUILD_BUG_ON(FUSE_MAX_WRITE_BYTES > BDRV_REQUEST_MAX_BYTES);
     /* Limited by max_write, should not happen */

I know this is a bit artificial because to produce this, there must be
an I/O error somewhere anyway, but if it does happen, qemu will
understand it to mean ENOSPC for short writes, which is incorrect.  So I
believe we need to resubmit the tail to maybe have it succeed now, or at
least get the correct error code.

Reproducer as before:
$ ./qemu-img create -f raw test.raw 8k
Formatting 'test.raw', fmt=raw size=8192
$ ./qemu-io -f raw -c 'write -P 42 0 8k' test.raw
wrote 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (64.804 MiB/sec and 8294.9003 ops/sec)
$ hexdump -C test.raw
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00002000
$ storage-daemon/qemu-storage-daemon \
    --blockdev file,node-name=test,filename=test.raw \
    --export fuse,id=exp,node-name=test,mountpoint=test.raw,writable=true

$ ./qemu-io --image-opts -c 'read -P 23 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=io_uring
read 8192/8192 bytes at offset 0
8 KiB, 1 ops; 00.00 sec (58.481 MiB/sec and 7485.5342 ops/sec)
$ ./qemu-io --image-opts -c 'write -P 23 0 8k' \
    driver=file,filename=test.raw,cache.direct=on,aio=io_uring
write failed: No space left on device
$ hexdump -C test.raw
00000000  17 17 17 17 17 17 17 17  17 17 17 17 17 17 17 17  |................|
*
00001000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00002000

So short reads already work (because there is code for that), but short
writes incorrectly produce ENOSPC.  This patch fixes that by
resubmitting not only the tail of short reads but short writes also.

(And this patch uses the opportunity to make it so qemu_iovec_destroy()
is called only if req->resubmit_qiov.iov is non-NULL.  Functionally a
non-op, but this is how the code generally checks whether the
resubmit_qiov has been set up or not.)

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260324084338.37453-4-hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io_uring.c   | 82 +++++++++++++++++++++++++---------------------
 block/trace-events |  2 +-
 2 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/block/io_uring.c b/block/io_uring.c
index cb131d3b8b5..c48a72d37eb 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -27,10 +27,10 @@ typedef struct {
     BdrvRequestFlags flags;
 
     /*
-     * Buffered reads may require resubmission, see
-     * luring_resubmit_short_read().
+     * Short reads/writes require resubmission, see
+     * luring_resubmit_short_io().
      */
-    int total_read;
+    int total_done;
     QEMUIOVector resubmit_qiov;
 
     CqeHandler cqe_handler;
@@ -40,10 +40,14 @@ static void luring_prep_sqe(struct io_uring_sqe *sqe, void *opaque)
 {
     LuringRequest *req = opaque;
     QEMUIOVector *qiov = req->qiov;
-    uint64_t offset = req->offset;
+    uint64_t offset = req->offset + req->total_done;
     int fd = req->fd;
     BdrvRequestFlags flags = req->flags;
 
+    if (req->resubmit_qiov.iov) {
+        qiov = &req->resubmit_qiov;
+    }
+
     switch (req->type) {
     case QEMU_AIO_WRITE:
     {
@@ -73,17 +77,12 @@ static void luring_prep_sqe(struct io_uring_sqe *sqe, void *opaque)
         break;
     case QEMU_AIO_READ:
     {
-        if (req->resubmit_qiov.iov != NULL) {
-            qiov = &req->resubmit_qiov;
-        }
         if (qiov->niov > 1) {
-            io_uring_prep_readv(sqe, fd, qiov->iov, qiov->niov,
-                                offset + req->total_read);
+            io_uring_prep_readv(sqe, fd, qiov->iov, qiov->niov, offset);
         } else {
             /* The man page says non-vectored is faster than vectored */
             struct iovec *iov = qiov->iov;
-            io_uring_prep_read(sqe, fd, iov->iov_base, iov->iov_len,
-                               offset + req->total_read);
+            io_uring_prep_read(sqe, fd, iov->iov_base, iov->iov_len, offset);
         }
         break;
     }
@@ -98,21 +97,26 @@ static void luring_prep_sqe(struct io_uring_sqe *sqe, void *opaque)
 }
 
 /**
- * luring_resubmit_short_read:
+ * luring_resubmit_short_io:
  *
- * Short reads are rare but may occur. The remaining read request needs to be
- * resubmitted.
+ * Short reads and writes are rare but may occur.  The remaining request needs
+ * to be resubmitted.
+ *
+ * For example, short reads can be reproduced by a FUSE export deliberately
+ * executing short reads.  The tail of short writes is generally resubmitted by
+ * io-uring in the kernel, but if that resubmission encounters an I/O error, the
+ * already submitted portion will be returned as a short write.
  */
-static void luring_resubmit_short_read(LuringRequest *req, int nread)
+static void luring_resubmit_short_io(LuringRequest *req, int ndone)
 {
     QEMUIOVector *resubmit_qiov;
     size_t remaining;
 
-    trace_luring_resubmit_short_read(req, nread);
+    trace_luring_resubmit_short_io(req, ndone);
 
-    /* Update read position */
-    req->total_read += nread;
-    remaining = req->qiov->size - req->total_read;
+    /* Update I/O position */
+    req->total_done += ndone;
+    remaining = req->qiov->size - req->total_done;
 
     /* Shorten qiov */
     resubmit_qiov = &req->resubmit_qiov;
@@ -121,7 +125,7 @@ static void luring_resubmit_short_read(LuringRequest *req, int nread)
     } else {
         qemu_iovec_reset(resubmit_qiov);
     }
-    qemu_iovec_concat(resubmit_qiov, req->qiov, req->total_read, remaining);
+    qemu_iovec_concat(resubmit_qiov, req->qiov, req->total_done, remaining);
 
     aio_add_sqe(luring_prep_sqe, req, &req->cqe_handler);
 }
@@ -153,31 +157,35 @@ static void luring_cqe_handler(CqeHandler *cqe_handler)
             return;
         }
     } else if (req->qiov) {
-        /* total_read is non-zero only for resubmitted read requests */
-        int total_bytes = ret + req->total_read;
+        /* total_done is non-zero only for resubmitted requests */
+        int total_bytes = ret + req->total_done;
 
         if (total_bytes == req->qiov->size) {
             ret = 0;
-        } else {
+        } else if (ret > 0 && (req->type == QEMU_AIO_READ ||
+                               req->type == QEMU_AIO_WRITE)) {
             /* Short Read/Write */
-            if (req->type == QEMU_AIO_READ) {
-                if (ret > 0) {
-                    luring_resubmit_short_read(req, ret);
-                    return;
-                }
-
-                /* Pad with zeroes */
-                qemu_iovec_memset(req->qiov, total_bytes, 0,
-                                  req->qiov->size - total_bytes);
-                ret = 0;
-            } else {
-                ret = -ENOSPC;
-            }
+            luring_resubmit_short_io(req, ret);
+            return;
+        } else if (req->type == QEMU_AIO_READ) {
+            /* Read ret == 0: EOF, pad with zeroes */
+            qemu_iovec_memset(req->qiov, total_bytes, 0,
+                              req->qiov->size - total_bytes);
+            ret = 0;
+        } else {
+            /*
+             * Normal write ret == 0 means ENOSPC.
+             * For zone-append, we treat any 0 <= ret < qiov->size as ENOSPC,
+             * too, because resubmitting the tail seems a little unsafe.
+             */
+            ret = -ENOSPC;
         }
     }
 
     req->ret = ret;
-    qemu_iovec_destroy(&req->resubmit_qiov);
+    if (req->resubmit_qiov.iov) {
+        qemu_iovec_destroy(&req->resubmit_qiov);
+    }
 
     /*
      * If the coroutine is already entered it must be in luring_co_submit() and
diff --git a/block/trace-events b/block/trace-events
index d170fc96f15..950c82d4b80 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -64,7 +64,7 @@ file_paio_submit(void *acb, void *opaque, int64_t offset, int count, int type) "
 # io_uring.c
 luring_cqe_handler(void *req, int ret) "req %p ret %d"
 luring_co_submit(void *bs, void *req, int fd, uint64_t offset, size_t nbytes, int type) "bs %p req %p fd %d offset %" PRId64 " nbytes %zd type %d"
-luring_resubmit_short_read(void *req, int nread) "req %p nread %d"
+luring_resubmit_short_io(void *req, int ndone) "req %p ndone %d"
 
 # qcow2.c
 qcow2_add_task(void *co, void *bs, void *pool, const char *action, int cluster_type, uint64_t host_offset, uint64_t offset, uint64_t bytes, void *qiov, size_t qiov_offset) "co %p bs %p pool %p: %s: cluster_type %d file_cluster_offset %" PRIu64 " offset %" PRIu64 " bytes %" PRIu64 " qiov %p qiov_offset %zu"
-- 
2.53.0



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

* Re: [PULL 0/4] Block layer patches
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2026-03-24 18:56 ` [PULL 4/4] io-uring: Resubmit tails of short writes Kevin Wolf
@ 2026-03-25 16:52 ` Peter Maydell
  2026-03-26  5:02 ` Michael Tokarev
  5 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2026-03-25 16:52 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, qemu-devel

On Tue, 24 Mar 2026 at 18:57, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit fa4b2e31e649ba6fdb3eb2dd43952aad4a3bd675:
>
>   Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging (2026-03-24 10:41:21 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/kmwolf/qemu.git tags/for-upstream
>
> for you to fetch changes up to cf9cdaea6e24d13dfdf8402f6829d2ca4dca864b:
>
>   io-uring: Resubmit tails of short writes (2026-03-24 19:55:09 +0100)
>
> ----------------------------------------------------------------
> Block layer patches
>
> - linux-aio/io-uring: Resubmit tails of short reads/writes
> - curl: Fix memory leak




Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/11.0
for any user-visible changes.

-- PMM


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

* Re: [PULL 0/4] Block layer patches
  2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2026-03-25 16:52 ` [PULL 0/4] Block layer patches Peter Maydell
@ 2026-03-26  5:02 ` Michael Tokarev
  2026-03-26 12:50   ` Kevin Wolf
  5 siblings, 1 reply; 19+ messages in thread
From: Michael Tokarev @ 2026-03-26  5:02 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, qemu-stable, Hanna Czenczek

On 24.03.2026 21:56, Kevin Wolf wrote:

> ----------------------------------------------------------------
> Block layer patches
> 
> - linux-aio/io-uring: Resubmit tails of short reads/writes
> - curl: Fix memory leak
> 
> ----------------------------------------------------------------
> GuoHan Zhao (1):
>        block/curl: free s->password in cleanup paths
> 
> Hanna Czenczek (3):
>        linux-aio: Put all parameters into qemu_laiocb
>        linux-aio: Resubmit tails of short reads/writes
>        io-uring: Resubmit tails of short writes

Shouldn't all of this pull req be picked up for the stable series?

Thanks,

/mjt


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

* Re: [PULL 0/4] Block layer patches
  2026-03-26  5:02 ` Michael Tokarev
@ 2026-03-26 12:50   ` Kevin Wolf
  0 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2026-03-26 12:50 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-block, qemu-devel, qemu-stable, Hanna Czenczek

Am 26.03.2026 um 06:02 hat Michael Tokarev geschrieben:
> On 24.03.2026 21:56, Kevin Wolf wrote:
> 
> > ----------------------------------------------------------------
> > Block layer patches
> > 
> > - linux-aio/io-uring: Resubmit tails of short reads/writes
> > - curl: Fix memory leak
> > 
> > ----------------------------------------------------------------
> > GuoHan Zhao (1):
> >        block/curl: free s->password in cleanup paths
> > 
> > Hanna Czenczek (3):
> >        linux-aio: Put all parameters into qemu_laiocb
> >        linux-aio: Resubmit tails of short reads/writes
> >        io-uring: Resubmit tails of short writes
> 
> Shouldn't all of this pull req be picked up for the stable series?

I don't think any of these are very critical, but they are fixes (as
should be everything merged during freeze) and have existed in previous
releases, so yes, in that sense they are certainly suitable for stable.

Kevin



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

end of thread, other threads:[~2026-03-26 12:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 18:56 [PULL 0/4] Block layer patches Kevin Wolf
2026-03-24 18:56 ` [PULL 1/4] block/curl: free s->password in cleanup paths Kevin Wolf
2026-03-24 18:56 ` [PULL 2/4] linux-aio: Put all parameters into qemu_laiocb Kevin Wolf
2026-03-24 18:56 ` [PULL 3/4] linux-aio: Resubmit tails of short reads/writes Kevin Wolf
2026-03-24 18:56 ` [PULL 4/4] io-uring: Resubmit tails of short writes Kevin Wolf
2026-03-25 16:52 ` [PULL 0/4] Block layer patches Peter Maydell
2026-03-26  5:02 ` Michael Tokarev
2026-03-26 12:50   ` Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2025-11-25 16:16 Kevin Wolf
2025-11-25 19:29 ` Richard Henderson
2025-04-25 17:52 Kevin Wolf
2025-04-28 17:56 ` Stefan Hajnoczi
2025-04-08 13:00 Kevin Wolf
2025-04-09  8:31 ` Stefan Hajnoczi
2023-11-28 14:09 Kevin Wolf
2023-03-28 12:35 Kevin Wolf
2023-03-28 19:42 ` Peter Maydell
2019-09-20 16:20 Kevin Wolf
2019-09-23  9:49 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox