Received: from eggs.gnu.org ([2001:4830:134:3::10]:49845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c08Tk-0006GE-Dd for qemu-devel@nongnu.org; Fri, 28 Oct 2016 10:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c08Tj-0001Qb-Gz for qemu-devel@nongnu.org; Fri, 28 Oct 2016 10:49:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35146) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c08Tj-0001Q6-BZ for qemu-devel@nongnu.org; Fri, 28 Oct 2016 10:49:55 -0400 From: Fam Zheng Date: Fri, 28 Oct 2016 22:49:20 +0800 Message-Id: <1477666165-17297-16-git-send-email-famz@redhat.com> In-Reply-To: <1477666165-17297-1-git-send-email-famz@redhat.com> References: <1477666165-17297-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PULL 15/20] qemu-io: acquire AioContext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell From: Paolo Bonzini Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng Message-Id: <1477565348-5458-16-git-send-email-pbonzini@redhat.com> Signed-off-by: Fam Zheng --- qemu-io-cmds.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index dbe0413..4750e9a 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -2216,6 +2216,7 @@ static const cmdinfo_t help_cmd = { bool qemuio_command(BlockBackend *blk, const char *cmd) { + AioContext *ctx; char *input; const cmdinfo_t *ct; char **v; @@ -2227,7 +2228,10 @@ bool qemuio_command(BlockBackend *blk, const char *cmd) if (c) { ct = find_command(v[0]); if (ct) { + ctx = blk ? blk_get_aio_context(blk) : qemu_get_aio_context(); + aio_context_acquire(ctx); done = command(blk, ct, c, v); + aio_context_release(ctx); } else { fprintf(stderr, "command \"%s\" not found\n", v[0]); } -- 2.7.4