[Qemu-devel] [PATCH 0/3] block: fix blk_aio_*() segfault when blk->root == NULL

Stefan Hajnoczi posted 3 patches 6 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180208171807.24267-1-stefanha@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppc passed
Test ppcbe passed
Test s390x passed
There is a newer version of this series
tests/Makefile.include     |  2 ++
block.c                    |  2 +-
block/block-backend.c      | 59 +++++++++++++++++++++++++++++----
hw/ide/core.c              | 10 +-----
tests/test-block-backend.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 138 insertions(+), 17 deletions(-)
create mode 100644 tests/test-block-backend.c
[Qemu-devel] [PATCH 0/3] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Stefan Hajnoczi 6 years, 2 months ago
Using bdrv_inc_in_flight(blk_bs(blk)) doesn't work since BlockBackend->root may
be NULL.

This patch series solves the issue by adding an BlockBackend->in_flight counter
so requests can be tracked even when there is no BlockDriverState.

This should fix the IDE and virtio-blk segfaults that have been encountered
when there is no BlockDriverState.

The patch is based on work by Kevin Wolf.

Kevin Wolf (1):
  block: test blk_aio_flush() with blk->root == NULL

Stefan Hajnoczi (2):
  block: add BlockBackend->in_flight counter
  Revert "IDE: Do not flush empty CDROM drives"

 tests/Makefile.include     |  2 ++
 block.c                    |  2 +-
 block/block-backend.c      | 59 +++++++++++++++++++++++++++++----
 hw/ide/core.c              | 10 +-----
 tests/test-block-backend.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 138 insertions(+), 17 deletions(-)
 create mode 100644 tests/test-block-backend.c

-- 
2.14.3


Re: [Qemu-devel] [PATCH 0/3] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Eric Blake 6 years, 2 months ago
On 02/08/2018 11:18 AM, Stefan Hajnoczi wrote:
> Using bdrv_inc_in_flight(blk_bs(blk)) doesn't work since BlockBackend->root may
> be NULL.
> 
> This patch series solves the issue by adding an BlockBackend->in_flight counter
> so requests can be tracked even when there is no BlockDriverState.
> 
> This should fix the IDE and virtio-blk segfaults that have been encountered
> when there is no BlockDriverState.
> 
> The patch is based on work by Kevin Wolf.
> 
> Kevin Wolf (1):
>    block: test blk_aio_flush() with blk->root == NULL
> 
> Stefan Hajnoczi (2):
>    block: add BlockBackend->in_flight counter
>    Revert "IDE: Do not flush empty CDROM drives"

Tested by applying the series out of order (2, 3, 1) - the new test 
fails after 2 (so even our workaround was not robust), fails after 3 
(expected there, because we revert the workaround), then finally passes 
after 1 (the correct fix with no workaround needed).  So for the series, 
you can add:
Tested-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org