Re: [PATCH 1/2] virtio-blk: Fix hot-unplug race in remove method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/03/2012 01:02 PM, Sasha Levin wrote:
On Thu, May 3, 2012 at 4:19 AM, Asias He<asias@xxxxxxxxxx>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
Asias
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux