diff mbox

[2/2] nbd: add missed aio_context_acquire in nbd_export_new

Message ID 1453273940-15382-3-git-send-email-den@openvz.org (mailing list archive)
State New, archived
Headers show

Commit Message

Denis V. Lunev Jan. 20, 2016, 7:12 a.m. UTC
blk_invalidate_cache() can call qcow2_invalidate_cache which performs
IO inside.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
---
 nbd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paolo Bonzini Jan. 26, 2016, 11:37 a.m. UTC | #1
On 20/01/2016 08:12, Denis V. Lunev wrote:
> blk_invalidate_cache() can call qcow2_invalidate_cache which performs
> IO inside.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  nbd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/nbd.c b/nbd.c
> index b3d9654..b271db5 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -1080,7 +1080,9 @@ NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size,
>       * that BDRV_O_INCOMING is cleared and the image is ready for write
>       * access since the export could be available before migration handover.
>       */
> +    aio_context_acquire(exp->ctx);
>      blk_invalidate_cache(blk, NULL);
> +    aio_context_release(exp->ctx);
>      return exp;
>  
>  fail:
> 

Queuing this one myself.

Paolo
diff mbox

Patch

diff --git a/nbd.c b/nbd.c
index b3d9654..b271db5 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1080,7 +1080,9 @@  NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size,
      * that BDRV_O_INCOMING is cleared and the image is ready for write
      * access since the export could be available before migration handover.
      */
+    aio_context_acquire(exp->ctx);
     blk_invalidate_cache(blk, NULL);
+    aio_context_release(exp->ctx);
     return exp;
 
 fail: