From: Rusty Russell <rusty@rustcorp.com.au>
To: Asias He <asias@redhat.com>,
virtualization@lists.linux-foundation.org,
"Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3] virtio-blk: Fix hot-unplug race in remove method
Date: Mon, 07 May 2012 14:31:04 +0930 [thread overview]
Message-ID: <87sjfcega7.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1336120789-12076-1-git-send-email-asias@redhat.com>
On Fri, 4 May 2012 16:39:49 +0800, Asias He <asias@redhat.com> wrote:
> If we reset the virtio-blk device before the requests already dispatched
> to the virtio-blk driver from the block layer are finised, we will stuck
> in blk_cleanup_queue() and the remove will fail.
>
> blk_cleanup_queue() calls blk_drain_queue() to drain all requests queued
> before DEAD marking. However it will never success if the device is
> already stopped. We'll have q->in_flight[] > 0, so the drain will not
> finish.
>
> How to reproduce the race:
> 1. hot-plug a virtio-blk device
> 2. keep reading/writing the device in guest
> 3. hot-unplug while the device is busy serving I/O
>
> Test:
> ~1000 rounds of hot-plug/hot-unplug test passed with this patch.
>
> Changes in v3:
> - Drop blk_abort_queue and blk_abort_request
> - Use __blk_end_request_all to complete request dispatched to driver
>
> Changes in v2:
> - Drop req_in_flight
> - Use virtqueue_detach_unused_buf to get request dispatched to driver
>
> Signed-off-by: Asias He <asias@redhat.com>
Thanks, applied.
Cheers,
Rusty.
next prev parent reply other threads:[~2012-05-07 5:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-04 8:39 [PATCH v3] virtio-blk: Fix hot-unplug race in remove method Asias He
2012-05-07 5:01 ` Rusty Russell [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-05-04 12:22 Asias He
2012-05-07 5:05 ` Rusty Russell
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=87sjfcega7.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=asias@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox