[Qemu-devel] [PATCH 39/54] block: Fix pending requests check in bdrv_append()

Kevin Wolf posted 54 patches 8 years, 11 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 39/54] block: Fix pending requests check in bdrv_append()
Posted by Kevin Wolf 8 years, 11 months ago
bdrv_append() cares about isolation of the node that it modifies, but
not about activity in some subtree below it. Instead of using the
recursive bdrv_requests_pending(), directly check bs->in_flight, which
considers only the node in question.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index c7c0a8b..a800e81 100644
--- a/block.c
+++ b/block.c
@@ -2874,8 +2874,8 @@ static void change_parent_backing_link(BlockDriverState *from,
  */
 void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top)
 {
-    assert(!bdrv_requests_pending(bs_top));
-    assert(!bdrv_requests_pending(bs_new));
+    assert(!atomic_read(&bs_top->in_flight));
+    assert(!atomic_read(&bs_new->in_flight));
 
     bdrv_ref(bs_top);
 
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH 39/54] block: Fix pending requests check in bdrv_append()
Posted by Max Reitz 8 years, 11 months ago
On 21.02.2017 15:58, Kevin Wolf wrote:
> bdrv_append() cares about isolation of the node that it modifies, but
> not about activity in some subtree below it. Instead of using the
> recursive bdrv_requests_pending(), directly check bs->in_flight, which
> considers only the node in question.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>