From: Bin Wu <wu.wubin@huawei.com>
To: Fam Zheng <famz@redhat.com>
Cc: jcody@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] mirror: hold aio_context before bdrv_drain
Date: Wed, 1 Apr 2015 16:49:39 +0800 [thread overview]
Message-ID: <551BB123.9050909@huawei.com> (raw)
In-Reply-To: <20150401081932.GA2777@fam-t430.nay.redhat.com>
On 2015/4/1 16:19, Fam Zheng wrote:
> On Wed, 04/01 12:42, Bin Wu wrote:
>> From: Bin Wu <wu.wubin@huawei.com>
>
> What's the issue are you fixing? I think the coroutine already is running in
> the AioContext of bs.
>
> Fam
>
In the current implementation of bdrv_drain, it should be placed in a critical
section as suggested in the comments above the function: "Note that unlike
bdrv_drain_all(), the caller must hold the BlockDriverState AioContext".
However, the mirror coroutine starting with mirror_run doesn't do this. I just
found qmp_drive_mirror protects the AioCentext, but it is out of the scope of
the mirror coroutine.
Bin
>>
>> Signed-off-by: Bin Wu <wu.wubin@huawei.com>
>> ---
>> block/mirror.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/block/mirror.c b/block/mirror.c
>> index 4056164..08372df 100644
>> --- a/block/mirror.c
>> +++ b/block/mirror.c
>> @@ -530,7 +530,9 @@ static void coroutine_fn mirror_run(void *opaque)
>> * mirror_populate runs.
>> */
>> trace_mirror_before_drain(s, cnt);
>> + aio_context_acquire(bdrv_get_aio_context(bs));
>> bdrv_drain(bs);
>> + aio_context_release(bdrv_get_aio_context(bs));
>> cnt = bdrv_get_dirty_count(bs, s->dirty_bitmap);
>> }
>>
>> --
>> 1.7.12.4
>>
>>
>>
>
> .
>
next prev parent reply other threads:[~2015-04-01 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 4:42 [Qemu-devel] [PATCH] mirror: hold aio_context before bdrv_drain Bin Wu
2015-04-01 8:19 ` Fam Zheng
2015-04-01 8:49 ` Bin Wu [this message]
2015-04-01 11:59 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-04-02 0:40 ` Bin Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=551BB123.9050909@huawei.com \
--to=wu.wubin@huawei.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.