Skip to contentSkip to conversation

mirror: fix the inconsistent AioContext problem in the backing BDSs during mirroring.

PATCH In review sochin.jiang 2 participants 3 messages Jun 26, 2017 – Jun 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mirror: fix the inconsistent AioContext problem in the backing BDSs during mirroring.

From: "sochin.jiang" <[email protected]>

mirror_complete opens the backings, BDSs of the new open backings should have a same AioContext with the top when using iothreads, fix the code to guarantee this, also avoiding unexpected qemu exit(assert fails in bdrv_attach_child).

---
 block.c | 1 +
 1 file changed, 1 insertion(+)
block.c +1 -0
index 6943962..b312fe6 100644
@@ -2185,6 +2185,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
         ret = -EINVAL;
         goto free_exit;
     }
+    bdrv_set_aio_context(backing_hd, bdrv_get_aio_context(bs));
 
     /* Hook up the backing file link; drop our reference, bs owns the
      * backing_hd reference now */
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · sochin.jiang

From: "sochin.jiang" <[email protected]>

mirror_complete opens the backings, BDSs of the new open backings should have a same AioContext with the top when using iothreads, fix the code to guarantee this, also avoiding unexpected qemu exit(assert fails in bdrv_attach_child).

Thanks! The functional change looks good to me. I'll see to add an iotest to cover this case.

Some notes: There shouldn't be any spaces at the front of these lines, and every line should be limited to 72 characters.

Also, the commit message should not end in a full stop (and it's good to keep it short).

I've reworded a bit of the commit message (and shortened the title*) and applied it to my block branch:

https://github.com/XanClic/qemu/commits/block

Max

[1] I've shortened it to "mirror: Fix inconsistent backing AioContext for after mirroring". I usually try to fit the title into 50 characters (because that's what the default vim highlighting is proposing...), so for reference, I would have made it something like "block: Align backing BDS's AioContext with overlay" -- if it had been my patch. Since it was yours, I'm fine with commit titles longer than 50 characters (although they really should not exceed 72).

Quoted 18 lines
---
 block.c | 1 +
 1 file changed, 1 insertion(+)
block.c +1 -0
index 6943962..b312fe6 100644
@@ -2185,6 +2185,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
         ret = -EINVAL;
         goto free_exit;
     }
+    bdrv_set_aio_context(backing_hd, bdrv_get_aio_context(bs));
 
     /* Hook up the backing file link; drop our reference, bs owns the
      * backing_hd reference now */
#2 lore raw

Oh,I got it, thanks.

Sochin

Quoted 49 lines · Max Reitz
Quoted 5 lines · sochin.jiang

From: "sochin.jiang" <[email protected]>

mirror_complete opens the backings, BDSs of the new open backings should have a same AioContext with the top when using iothreads, fix the code to guarantee this, also avoiding unexpected qemu exit(assert fails in bdrv_attach_child).

Thanks! The functional change looks good to me. I'll see to add an iotest to cover this case.

Some notes: There shouldn't be any spaces at the front of these lines, and every line should be limited to 72 characters.

Also, the commit message should not end in a full stop (and it's good to keep it short).

I've reworded a bit of the commit message (and shortened the title*) and applied it to my block branch:

https://github.com/XanClic/qemu/commits/block

Max

[1] I've shortened it to "mirror: Fix inconsistent backing AioContext for after mirroring". I usually try to fit the title into 50 characters (because that's what the default vim highlighting is proposing...), so for reference, I would have made it something like "block: Align backing BDS's AioContext with overlay" -- if it had been my patch. Since it was yours, I'm fine with commit titles longer than 50 characters (although they really should not exceed 72).

Quoted 18 lines
---
 block.c | 1 +
 1 file changed, 1 insertion(+)
block.c +1 -0
index 6943962..b312fe6 100644
@@ -2185,6 +2185,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
         ret = -EINVAL;
         goto free_exit;
     }
+    bdrv_set_aio_context(backing_hd, bdrv_get_aio_context(bs));
 
     /* Hook up the backing file link; drop our reference, bs owns the
      * backing_hd reference now */