qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 9222ef: qcow2: set bdi->is_dirty


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 9222ef: qcow2: set bdi->is_dirty
Date: Sun, 16 May 2021 11:55:44 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 9222efa9d6c5399d630e353db413e2f3c41312eb
      
https://github.com/qemu/qemu/commit/9222efa9d6c5399d630e353db413e2f3c41312eb
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: set bdi->is_dirty

Set bdi->is_dirty, so that qemu-img info could show dirty flag.

After this commit the following check will show '"dirty-flag": true':

./build/qemu-img create -f qcow2 -o lazy_refcounts=on x 1M
./build/qemu-io x
qemu-io> write 0 1M

 After "write" command success, kill the qemu-io process:

kill -9 <qemu-io pid>

./build/qemu-img info --output=json x

This will show '"dirty-flag": true' among other things. (before this
commit it shows '"dirty-flag": false')

Note, that qcow2's dirty-bit is not a "dirty bit for the image". It
only protects qcow2 lazy refcounts feature. So, there are a lot of
conditions when qcow2 session may be not closed correctly, but bit is
0. Still, when bit is set, the last session is definitely not finished
correctly and it's better to report it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210504160656.462836-1-vsementsov@virtuozzo.com>
Tested-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 48d8b059f8536b99ec8631f046b539c4c64500c3
      
https://github.com/qemu/qemu/commit/48d8b059f8536b99ec8631f046b539c4c64500c3
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Fix Transaction leak in bdrv_root_attach_child()

The error path needs to call tran_finalize(), too.

Fixes: CID 1452773
Fixes: 548a74c0dbc858edd1a7ee3045b5f2fe710bd8b1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210503110555.24001-2-kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 1fc2bc1c90b97ed08e8aadfd2ea258eeb8242faf
      
https://github.com/qemu/qemu/commit/1fc2bc1c90b97ed08e8aadfd2ea258eeb8242faf
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Fix Transaction leak in bdrv_reopen_multiple()

Like other error paths, this one needs to call tran_finalize() and clean
up the BlockReopenQueue, too.

Fixes: CID 1452772
Fixes: 72373e40fbc7e4218061a8211384db362d3e7348
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210503110555.24001-3-kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: fa90c2b01aec94cdd34ac2cfdfb4c93da4e92026
      
https://github.com/qemu/qemu/commit/fa90c2b01aec94cdd34ac2cfdfb4c93da4e92026
  Author: Michael Tokarev <mjt@tls.msk.ru>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M qapi/qom.json

  Log Message:
  -----------
  qapi: spelling fix (addtional)

Fixes: 3d0d3c30ae3a259bff176f85a3efa2d0816695af
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Message-Id: <20210508093315.393274-1-mjt@msgid.tls.msk.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 08f70a4a851bf75b403c813edf0982383bde7960
      
https://github.com/qemu/qemu/commit/08f70a4a851bf75b403c813edf0982383bde7960
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M block/export/vhost-user-blk-server.c

  Log Message:
  -----------
  block/export: improve vu_blk_sect_range_ok()

The checks in vu_blk_sect_range_ok() assume VIRTIO_BLK_SECTOR_SIZE is
equal to BDRV_SECTOR_SIZE. This is true, but let's add a
QEMU_BUILD_BUG_ON() to make it explicit.

We might as well check that the request buffer size is a multiple of
VIRTIO_BLK_SECTOR_SIZE while we're at it.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210331142727.391465-1-stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 40d0d421546848b03dbe1cbed6d1580730458550
      
https://github.com/qemu/qemu/commit/40d0d421546848b03dbe1cbed6d1580730458550
  Author: Coiby Xu <coiby.xu@gmail.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M MAINTAINERS
    M tests/qtest/libqos/meson.build
    A tests/qtest/libqos/vhost-user-blk.c
    A tests/qtest/libqos/vhost-user-blk.h
    M tests/qtest/meson.build
    A tests/qtest/vhost-user-blk-test.c

  Log Message:
  -----------
  test: new qTest case to test the vhost-user-blk-server

This test case has the same tests as tests/virtio-blk-test.c except for
tests have block_resize. Since the vhost-user-blk export only serves one
client one time, two exports are started by qemu-storage-daemon for the
hotplug test.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210309094106.196911-3-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210322092327.150720-2-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 1940bfb919bb0cf41d603e2fc814c41af9f7d52f
      
https://github.com/qemu/qemu/commit/1940bfb919bb0cf41d603e2fc814c41af9f7d52f
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M tests/qtest/vhost-user-blk-test.c

  Log Message:
  -----------
  tests/qtest: add multi-queue test case to vhost-user-blk-test

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210309094106.196911-4-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210322092327.150720-3-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 63f63ce68f67b863b1f79e0f1178e9a872d0f623
      
https://github.com/qemu/qemu/commit/63f63ce68f67b863b1f79e0f1178e9a872d0f623
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M tests/qtest/vhost-user-blk-test.c

  Log Message:
  -----------
  vhost-user-blk-test: test discard/write zeroes invalid inputs

Exercise input validation code paths in
block/export/vhost-user-blk-server.c.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210309094106.196911-5-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210322092327.150720-4-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: b6a818bfd7fd1e1a761f456502bb6e65dd84bead
      
https://github.com/qemu/qemu/commit/b6a818bfd7fd1e1a761f456502bb6e65dd84bead
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/block/vhost-user-blk.c

  Log Message:
  -----------
  vhost-user-blk: Make sure to set Error on realize failure

We have to set errp before jumping to virtio_err, otherwise the caller
(virtio_device_realize()) will take this as success and crash when it
later tries to access things that we've already freed in the error path.

Fixes: 77542d431491788d1e8e79d93ce10172ef207775
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210429171316.162022-2-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: ff24a2fc4eee9a520640578cfc8951a562257c46
      
https://github.com/qemu/qemu/commit/ff24a2fc4eee9a520640578cfc8951a562257c46
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/block/vhost-user-blk.c

  Log Message:
  -----------
  vhost-user-blk: Don't reconnect during initialisation

This is a partial revert of commits 77542d43149 and bc79c87bcde.

Usually, an error during initialisation means that the configuration was
wrong. Reconnecting won't make the error go away, but just turn the
error condition into an endless loop. Avoid this and return errors
again.

Additionally, calling vhost_user_blk_disconnect() from the chardev event
handler could result in use-after-free because none of the
initialisation code expects that the device could just go away in the
middle. So removing the call fixes crashes in several places.

For example, using a num-queues setting that is incompatible with the
backend would result in a crash like this (dereferencing dev->opaque,
which is already NULL):

 #0  0x0000555555d0a4bd in vhost_user_read_cb (source=0x5555568f4690, 
condition=(G_IO_IN | G_IO_HUP), opaque=0x7fffffffcbf0) at 
../hw/virtio/vhost-user.c:313
 #1  0x0000555555d950d3 in qio_channel_fd_source_dispatch 
(source=0x555557c3f750, callback=0x555555d0a478 <vhost_user_read_cb>, 
user_data=0x7fffffffcbf0) at ../io/channel-watch.c:84
 #2  0x00007ffff7b32a9f in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
 #3  0x00007ffff7b84a98 in g_main_context_iterate.constprop () at 
/lib64/libglib-2.0.so.0
 #4  0x00007ffff7b32163 in g_main_loop_run () at /lib64/libglib-2.0.so.0
 #5  0x0000555555d0a724 in vhost_user_read (dev=0x555557bc62f8, 
msg=0x7fffffffcc50) at ../hw/virtio/vhost-user.c:402
 #6  0x0000555555d0ee6b in vhost_user_get_config (dev=0x555557bc62f8, 
config=0x555557bc62ac "", config_len=60) at ../hw/virtio/vhost-user.c:2133
 #7  0x0000555555d56d46 in vhost_dev_get_config (hdev=0x555557bc62f8, 
config=0x555557bc62ac "", config_len=60) at ../hw/virtio/vhost.c:1566
 #8  0x0000555555cdd150 in vhost_user_blk_device_realize (dev=0x555557bc60b0, 
errp=0x7fffffffcf90) at ../hw/block/vhost-user-blk.c:510
 #9  0x0000555555d08f6d in virtio_device_realize (dev=0x555557bc60b0, 
errp=0x7fffffffcff0) at ../hw/virtio/virtio.c:3660

Note that this removes the ability to reconnect during initialisation
(but not during operation) when there is no permanent error, but the
backend restarts, as the implementation was buggy. This feature can be
added back in a follow-up series after changing error paths to
distinguish cases where retrying could help from cases with permanent
errors.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210429171316.162022-3-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: d32d7d5bf631d5cd66361fe16fd5fb800977b1c2
      
https://github.com/qemu/qemu/commit/d32d7d5bf631d5cd66361fe16fd5fb800977b1c2
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/block/vhost-user-blk.c

  Log Message:
  -----------
  vhost-user-blk: Improve error reporting in realize

Now that vhost_user_blk_connect() is not called from an event handler
any more, but directly from vhost_user_blk_device_realize(), we can
actually make use of Error again instead of calling error_report() in
the inner function and setting a more generic and therefore less useful
error message in realize() itself.

With Error, the callers are responsible for adding context if necessary
(such as the "-device" option the error refers to). Additional prefixes
are redundant and better omitted.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20210429171316.162022-4-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 4991957b63f41969583fae27651f569dd180a1e8
      
https://github.com/qemu/qemu/commit/4991957b63f41969583fae27651f569dd180a1e8
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/block/vhost-user-blk.c

  Log Message:
  -----------
  vhost-user-blk: Get more feature flags from vhost device

VIRTIO_F_RING_PACKED and VIRTIO_F_IOMMU_PLATFORM need to be supported by
the vhost device, otherwise advertising it to the guest doesn't result
in a working configuration. They are currently not supported by the
vhost-user-blk export in QEMU.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935020
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20210429171316.162022-5-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 7befb91b7b44c0757667ad3f1f33ac302b000560
      
https://github.com/qemu/qemu/commit/7befb91b7b44c0757667ad3f1f33ac302b000560
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/virtio/virtio-bus.c

  Log Message:
  -----------
  virtio: Fail if iommu_platform is requested, but unsupported

Commit 2943b53f6 (' virtio: force VIRTIO_F_IOMMU_PLATFORM') made sure
that vhost can't just reject VIRTIO_F_IOMMU_PLATFORM when it was
requested. However, just adding it back to the negotiated flags isn't
right either because it promises support to the guest that the device
actually doesn't support. One example of a vhost-user device that
doesn't have support for the flag is the vhost-user-blk export of QEMU.

Instead of successfully creating a device that doesn't work, just fail
to plug the device when it doesn't support the feature, but it was
requested. This results in much clearer error messages.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935019
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20210429171316.162022-6-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: b773c9fb68ceff9a9692409d7afbc5d6865983c6
      
https://github.com/qemu/qemu/commit/b773c9fb68ceff9a9692409d7afbc5d6865983c6
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-14 (Fri, 14 May 2021)

  Changed paths:
    M hw/block/vhost-user-blk.c
    M hw/virtio/vhost-user.c
    M include/hw/virtio/vhost.h

  Log Message:
  -----------
  vhost-user-blk: Check that num-queues is supported by backend

Creating a device with a number of queues that isn't supported by the
backend is pointless, the device won't work properly and the error
messages are rather confusing.

Just fail to create the device if num-queues is higher than what the
backend supports.

Since the relationship between num-queues and the number of virtqueues
depends on the specific device, this is an additional value that needs
to be initialised by the device. For convenience, allow leaving it 0 if
the check should be skipped. This makes sense for vhost-user-net where
separate vhost devices are used for the queues and custom initialisation
code is needed to perform the check.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935031
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20210429171316.162022-7-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: d9cbd7f7422daf19fe5de0c474ff5c450a950386
      
https://github.com/qemu/qemu/commit/d9cbd7f7422daf19fe5de0c474ff5c450a950386
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-16 (Sun, 16 May 2021)

  Changed paths:
    M MAINTAINERS
    M block.c
    M block/export/vhost-user-blk-server.c
    M block/qcow2.c
    M hw/block/vhost-user-blk.c
    M hw/virtio/vhost-user.c
    M hw/virtio/virtio-bus.c
    M include/hw/virtio/vhost.h
    M qapi/qom.json
    M tests/qtest/libqos/meson.build
    A tests/qtest/libqos/vhost-user-blk.c
    A tests/qtest/libqos/vhost-user-blk.h
    M tests/qtest/meson.build
    A tests/qtest/vhost-user-blk-test.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

- vhost-user-blk: Fix error handling during initialisation
- Add test cases for the vhost-user-blk export
- Fix leaked Transaction objects
- qcow2: Expose dirty bit in 'qemu-img info'

# gpg: Signature made Fri 14 May 2021 17:29:53 BST
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  vhost-user-blk: Check that num-queues is supported by backend
  virtio: Fail if iommu_platform is requested, but unsupported
  vhost-user-blk: Get more feature flags from vhost device
  vhost-user-blk: Improve error reporting in realize
  vhost-user-blk: Don't reconnect during initialisation
  vhost-user-blk: Make sure to set Error on realize failure
  vhost-user-blk-test: test discard/write zeroes invalid inputs
  tests/qtest: add multi-queue test case to vhost-user-blk-test
  test: new qTest case to test the vhost-user-blk-server
  block/export: improve vu_blk_sect_range_ok()
  qapi: spelling fix (addtional)
  block: Fix Transaction leak in bdrv_reopen_multiple()
  block: Fix Transaction leak in bdrv_root_attach_child()
  qcow2: set bdi->is_dirty

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/6005ee07c380...d9cbd7f7422d



reply via email to

[Prev in Thread] Current Thread [Next in Thread]