qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 38b440: qcow2: set bdi->is_dirty


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 38b440: qcow2: set bdi->is_dirty
Date: Wed, 19 May 2021 08:11:22 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 38b440964736a5fca2c95606ce3efaa35381fa9d
      
https://github.com/qemu/qemu/commit/38b440964736a5fca2c95606ce3efaa35381fa9d
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-05-18 (Tue, 18 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: e878bb1293d2cd0082550b320c3ccf245d0a69d4
      
https://github.com/qemu/qemu/commit/e878bb1293d2cd0082550b320c3ccf245d0a69d4
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: e3fc91aaaacbdc2a88bbb4109c8a1cded628e36f
      
https://github.com/qemu/qemu/commit/e3fc91aaaacbdc2a88bbb4109c8a1cded628e36f
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 1b0b2e6d06c26185ecc820e868e025c894f979f7
      
https://github.com/qemu/qemu/commit/1b0b2e6d06c26185ecc820e868e025c894f979f7
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 806952026df41939680abe92b329715b9b4e01cc
      
https://github.com/qemu/qemu/commit/806952026df41939680abe92b329715b9b4e01cc
  Author: Coiby Xu <coiby.xu@gmail.com>
  Date:   2021-05-18 (Tue, 18 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: 9c4e99e8794cd4ef1ef5e21fdc6efb6b5f779497
      
https://github.com/qemu/qemu/commit/9c4e99e8794cd4ef1ef5e21fdc6efb6b5f779497
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 7999e3136d5f0ba474bc1b37e3799099e778f9ed
      
https://github.com/qemu/qemu/commit/7999e3136d5f0ba474bc1b37e3799099e778f9ed
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: f26729715ef21325f972f693607580a829ad1cbb
      
https://github.com/qemu/qemu/commit/f26729715ef21325f972f693607580a829ad1cbb
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: dabefdd6abcbc7d858e9413e4734aab2e0b5c8d9
      
https://github.com/qemu/qemu/commit/dabefdd6abcbc7d858e9413e4734aab2e0b5c8d9
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 5b9243d2654adc58ce472d0536a7a177b4fe0f90
      
https://github.com/qemu/qemu/commit/5b9243d2654adc58ce472d0536a7a177b4fe0f90
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 7556a320c98812ca6648b707393f4513387faf73
      
https://github.com/qemu/qemu/commit/7556a320c98812ca6648b707393f4513387faf73
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: 04ceb61a4075fadbf374ef89662c41999da83489
      
https://github.com/qemu/qemu/commit/04ceb61a4075fadbf374ef89662c41999da83489
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: c90bd505a3e8210c23d69fecab9ee6f56ec4a161
      
https://github.com/qemu/qemu/commit/c90bd505a3e8210c23d69fecab9ee6f56ec4a161
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-05-18 (Tue, 18 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: d874bc081600528f0400977460b4f98f21e156a1
      
https://github.com/qemu/qemu/commit/d874bc081600528f0400977460b4f98f21e156a1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-19 (Wed, 19 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 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 Tue 18 May 2021 11:57:46 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()
  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/d9f6839594c3...d874bc081600



reply via email to

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