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

Stefan Hajnoczi posted 5 patches 6 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180216165015.30715-1-stefanha@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x failed
tests/Makefile.include     |   2 +
util/Makefile.objs         |   2 +-
include/block/aio-wait.h   | 116 +++++++++++++++++++++++++++++++++++++++++++++
include/block/aio.h        |   7 ++-
include/block/block.h      |  40 +++-------------
include/block/block_int.h  |   7 ++-
block.c                    |   7 ++-
block/block-backend.c      |  60 ++++++++++++++++++++---
block/io.c                 |  10 +---
hw/ide/core.c              |  10 +---
tests/test-block-backend.c |  82 ++++++++++++++++++++++++++++++++
util/aio-wait.c            |  40 ++++++++++++++++
12 files changed, 318 insertions(+), 65 deletions(-)
create mode 100644 include/block/aio-wait.h
create mode 100644 tests/test-block-backend.c
create mode 100644 util/aio-wait.c
[Qemu-devel] [PATCH v3 0/5] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Stefan Hajnoczi 6 years, 2 months ago
v3:
 * Add Patch 1 to rename aio_context_in_iothread() to
   in_aio_context_home_thread() [Eric]
v2:
 * Introduce AIO_WAIT_WHILE() since aio_poll(ctx, true) is not allowed [Paolo]

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 (4):
  aio: rename aio_context_in_iothread() to in_aio_context_home_thread()
  block: extract AIO_WAIT_WHILE() from BlockDriverState
  block: add BlockBackend->in_flight counter
  Revert "IDE: Do not flush empty CDROM drives"

 tests/Makefile.include     |   2 +
 util/Makefile.objs         |   2 +-
 include/block/aio-wait.h   | 116 +++++++++++++++++++++++++++++++++++++++++++++
 include/block/aio.h        |   7 ++-
 include/block/block.h      |  40 +++-------------
 include/block/block_int.h  |   7 ++-
 block.c                    |   7 ++-
 block/block-backend.c      |  60 ++++++++++++++++++++---
 block/io.c                 |  10 +---
 hw/ide/core.c              |  10 +---
 tests/test-block-backend.c |  82 ++++++++++++++++++++++++++++++++
 util/aio-wait.c            |  40 ++++++++++++++++
 12 files changed, 318 insertions(+), 65 deletions(-)
 create mode 100644 include/block/aio-wait.h
 create mode 100644 tests/test-block-backend.c
 create mode 100644 util/aio-wait.c

-- 
2.14.3


Re: [Qemu-devel] [PATCH v3 0/5] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Kevin Wolf 6 years, 2 months ago
Am 16.02.2018 um 17:50 hat Stefan Hajnoczi geschrieben:
> v3:
>  * Add Patch 1 to rename aio_context_in_iothread() to
>    in_aio_context_home_thread() [Eric]
> v2:
>  * Introduce AIO_WAIT_WHILE() since aio_poll(ctx, true) is not allowed [Paolo]
> 
> 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.

Thanks, applied to the block branch.

Kevin

Re: [Qemu-devel] [PATCH v3 0/5] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Stefan Hajnoczi 6 years, 2 months ago
On Fri, Feb 16, 2018 at 04:50:10PM +0000, Stefan Hajnoczi wrote:
> v3:
>  * Add Patch 1 to rename aio_context_in_iothread() to
>    in_aio_context_home_thread() [Eric]
> v2:
>  * Introduce AIO_WAIT_WHILE() since aio_poll(ctx, true) is not allowed [Paolo]
> 
> 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 (4):
>   aio: rename aio_context_in_iothread() to in_aio_context_home_thread()
>   block: extract AIO_WAIT_WHILE() from BlockDriverState
>   block: add BlockBackend->in_flight counter
>   Revert "IDE: Do not flush empty CDROM drives"
> 
>  tests/Makefile.include     |   2 +
>  util/Makefile.objs         |   2 +-
>  include/block/aio-wait.h   | 116 +++++++++++++++++++++++++++++++++++++++++++++
>  include/block/aio.h        |   7 ++-
>  include/block/block.h      |  40 +++-------------
>  include/block/block_int.h  |   7 ++-
>  block.c                    |   7 ++-
>  block/block-backend.c      |  60 ++++++++++++++++++++---
>  block/io.c                 |  10 +---
>  hw/ide/core.c              |  10 +---
>  tests/test-block-backend.c |  82 ++++++++++++++++++++++++++++++++
>  util/aio-wait.c            |  40 ++++++++++++++++
>  12 files changed, 318 insertions(+), 65 deletions(-)
>  create mode 100644 include/block/aio-wait.h
>  create mode 100644 tests/test-block-backend.c
>  create mode 100644 util/aio-wait.c

Any more comments?
Re: [Qemu-devel] [PATCH v3 0/5] block: fix blk_aio_*() segfault when blk->root == NULL
Posted by Paolo Bonzini 6 years, 2 months ago
On 28/02/2018 16:48, Stefan Hajnoczi wrote:
> On Fri, Feb 16, 2018 at 04:50:10PM +0000, Stefan Hajnoczi wrote:
>> v3:
>>  * Add Patch 1 to rename aio_context_in_iothread() to
>>    in_aio_context_home_thread() [Eric]
>> v2:
>>  * Introduce AIO_WAIT_WHILE() since aio_poll(ctx, true) is not allowed [Paolo]
>>
>> 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 (4):
>>   aio: rename aio_context_in_iothread() to in_aio_context_home_thread()
>>   block: extract AIO_WAIT_WHILE() from BlockDriverState
>>   block: add BlockBackend->in_flight counter
>>   Revert "IDE: Do not flush empty CDROM drives"
>>
>>  tests/Makefile.include     |   2 +
>>  util/Makefile.objs         |   2 +-
>>  include/block/aio-wait.h   | 116 +++++++++++++++++++++++++++++++++++++++++++++
>>  include/block/aio.h        |   7 ++-
>>  include/block/block.h      |  40 +++-------------
>>  include/block/block_int.h  |   7 ++-
>>  block.c                    |   7 ++-
>>  block/block-backend.c      |  60 ++++++++++++++++++++---
>>  block/io.c                 |  10 +---
>>  hw/ide/core.c              |  10 +---
>>  tests/test-block-backend.c |  82 ++++++++++++++++++++++++++++++++
>>  util/aio-wait.c            |  40 ++++++++++++++++
>>  12 files changed, 318 insertions(+), 65 deletions(-)
>>  create mode 100644 include/block/aio-wait.h
>>  create mode 100644 tests/test-block-backend.c
>>  create mode 100644 util/aio-wait.c
> 
> Any more comments?
> 

Not from me. :)

Paolo