Skip to contentSkip to conversation

Revert "qed: Implement .bdrv_drain"

PATCH Applied Stefan Hajnoczi 2 participants 3 messages Mar 8, 2016 – Mar 9, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "qed: Implement .bdrv_drain"

This reverts commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01.

Note that commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01 included some unrelated hunks, possibly due to a merge failure or an overlooked squash. This only reverts the qed .bdrv_drain() implementation.

The qed .bdrv_drain() implementation is unsafe and can lead to a double request completion.

Paolo Bonzini reports:
"The problem is that bdrv_qed_drain calls qed_plug_allocating_write_reqs unconditionally, but this is not correct if an allocating write is queued. In this case, qed_unplug_allocating_write_reqs will restart the allocating write and possibly cause it to complete. The aiocb however is still in use for the L2/L1 table writes, and will then be completed again as soon as the table writes are stable."

For QEMU 2.6 we can simply revert this commit. A full solution for the qed need check timer may be added if the bdrv_drain() implementation is extended.

---
 block/qed.c | 13 -------------
 1 file changed, 13 deletions(-)

Passes ./check -qed.

block/qed.c +0 -13
index 404be1e..3da8021 100644
@@ -376,18 +376,6 @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs,
     }
 }
 
-static void bdrv_qed_drain(BlockDriverState *bs)
-{
-    BDRVQEDState *s = bs->opaque;
-
-    /* Cancel timer and start doing I/O that were meant to happen as if it
-     * fired, that way we get bdrv_drain() taking care of the ongoing requests
-     * correctly. */
-    qed_cancel_need_check_timer(s);
-    qed_plug_allocating_write_reqs(s);
-    bdrv_aio_flush(s->bs, qed_clear_need_check, s);
-}
-
 static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
                          Error **errp)
 {
@@ -1692,7 +1680,6 @@ static BlockDriver bdrv_qed = {
     .bdrv_check               = bdrv_qed_check,
     .bdrv_detach_aio_context  = bdrv_qed_detach_aio_context,
     .bdrv_attach_aio_context  = bdrv_qed_attach_aio_context,
-    .bdrv_drain               = bdrv_qed_drain,
 };
 
 static void bdrv_qed_init(void)
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Stefan Hajnoczi

This reverts commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01.

Note that commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01 included some unrelated hunks, possibly due to a merge failure or an overlooked squash. This only reverts the qed .bdrv_drain() implementation.

The qed .bdrv_drain() implementation is unsafe and can lead to a double request completion.

Paolo Bonzini reports:
"The problem is that bdrv_qed_drain calls qed_plug_allocating_write_reqs unconditionally, but this is not correct if an allocating write is queued. In this case, qed_unplug_allocating_write_reqs will restart the allocating write and possibly cause it to complete. The aiocb however is still in use for the L2/L1 table writes, and will then be completed again as soon as the table writes are stable."

Quoted 6 lines

For QEMU 2.6 we can simply revert this commit. A full solution for the qed need check timer may be added if the bdrv_drain() implementation is extended.

Paolo

Quoted 38 lines
---
 block/qed.c | 13 -------------
 1 file changed, 13 deletions(-)

Passes ./check -qed.

block/qed.c +0 -13
index 404be1e..3da8021 100644
@@ -376,18 +376,6 @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs,
     }
 }
 
-static void bdrv_qed_drain(BlockDriverState *bs)
-{
-    BDRVQEDState *s = bs->opaque;
-
-    /* Cancel timer and start doing I/O that were meant to happen as if it
-     * fired, that way we get bdrv_drain() taking care of the ongoing requests
-     * correctly. */
-    qed_cancel_need_check_timer(s);
-    qed_plug_allocating_write_reqs(s);
-    bdrv_aio_flush(s->bs, qed_clear_need_check, s);
-}
-
 static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
                          Error **errp)
 {
@@ -1692,7 +1680,6 @@ static BlockDriver bdrv_qed = {
     .bdrv_check               = bdrv_qed_check,
     .bdrv_detach_aio_context  = bdrv_qed_detach_aio_context,
     .bdrv_attach_aio_context  = bdrv_qed_attach_aio_context,
-    .bdrv_drain               = bdrv_qed_drain,
 };
 
 static void bdrv_qed_init(void)
author Applied
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 21 lines · Stefan Hajnoczi

This reverts commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01.

Note that commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01 included some unrelated hunks, possibly due to a merge failure or an overlooked squash. This only reverts the qed .bdrv_drain() implementation.

The qed .bdrv_drain() implementation is unsafe and can lead to a double request completion.

Paolo Bonzini reports:
"The problem is that bdrv_qed_drain calls qed_plug_allocating_write_reqs unconditionally, but this is not correct if an allocating write is queued. In this case, qed_unplug_allocating_write_reqs will restart the allocating write and possibly cause it to complete. The aiocb however is still in use for the L2/L1 table writes, and will then be completed again as soon as the table writes are stable."

For QEMU 2.6 we can simply revert this commit. A full solution for the qed need check timer may be added if the bdrv_drain() implementation is extended.

Quoted 7 lines
---
 block/qed.c | 13 -------------
 1 file changed, 13 deletions(-)

Passes ./check -qed.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan