From: Asias He <asias@redhat.com>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] virtio-blk: Fix hot-unplug race in remove method
Date: Thu, 03 May 2012 15:36:56 +0800 [thread overview]
Message-ID: <4FA23598.5040701@redhat.com> (raw)
In-Reply-To: <CA+1xoqcKQmSQxvUR6syvseUow4AfcnKmDODW=j6t6gejmSi4NA@mail.gmail.com>
On 05/03/2012 01:02 PM, Sasha Levin wrote:
> On Thu, May 3, 2012 at 4:19 AM, Asias He<asias@redhat.com> wrote:
>> @@ -190,6 +194,7 @@ static void do_virtblk_request(struct request_queue *q)
>>
>> while ((req = blk_peek_request(q)) != NULL) {
>> BUG_ON(req->nr_phys_segments + 2> vblk->sg_elems);
>> + vblk->req_in_flight++;
>>
>> /* If this request fails, stop queue and wait for something to
>> finish to restart it. */
>
> This is being increased before we know if the request will actually be
> sent, so if do_req() fails afterwards, req_in_flight would be
> increased but the request will never be sent.
>
> Which means we won't be able to unplug the device ever.
Yes, you are right. This introduces another race. I could do
vblk->req_in_flight++ right after blk_start_request(req) to avoid this
race.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Asias
prev parent reply other threads:[~2012-05-03 7:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 2:19 [PATCH 1/2] virtio-blk: Fix hot-unplug race in remove method Asias He
2012-05-03 5:02 ` Sasha Levin
2012-05-03 5:27 ` Michael S. Tsirkin
2012-05-03 7:38 ` Asias He
[not found] ` <CA+1xoqcKQmSQxvUR6syvseUow4AfcnKmDODW=j6t6gejmSi4NA@mail.gmail.com>
2012-05-03 7:36 ` Asias He [this message]
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=4FA23598.5040701@redhat.com \
--to=asias@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--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