* [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain"
@ 2016-03-08 10:11 Stefan Hajnoczi
2016-03-08 12:06 ` Paolo Bonzini
2016-03-09 14:52 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-03-08 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Fam Zheng, 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.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/qed.c | 13 -------------
1 file changed, 13 deletions(-)
Passes ./check -qed.
diff --git a/block/qed.c b/block/qed.c
index 404be1e..3da8021 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -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)
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain"
2016-03-08 10:11 [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain" Stefan Hajnoczi
@ 2016-03-08 12:06 ` Paolo Bonzini
2016-03-09 14:52 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-03-08 12:06 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: Kevin Wolf, Fam Zheng
On 08/03/2016 11:11, Stefan Hajnoczi wrote:
> 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.
>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
> ---
> block/qed.c | 13 -------------
> 1 file changed, 13 deletions(-)
>
> Passes ./check -qed.
>
> diff --git a/block/qed.c b/block/qed.c
> index 404be1e..3da8021 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -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)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain"
2016-03-08 10:11 [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain" Stefan Hajnoczi
2016-03-08 12:06 ` Paolo Bonzini
@ 2016-03-09 14:52 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-03-09 14:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Fam Zheng
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
On Tue, Mar 08, 2016 at 10:11:16AM +0000, Stefan Hajnoczi wrote:
> 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.
>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-09 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08 10:11 [Qemu-devel] [PATCH] Revert "qed: Implement .bdrv_drain" Stefan Hajnoczi
2016-03-08 12:06 ` Paolo Bonzini
2016-03-09 14:52 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).