virtio: delete vq from list
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 26 Jul 2009 12:48:01 +0000 (15:48 +0300)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 30 Jul 2009 06:33:44 +0000 (16:03 +0930)
This makes delete vq the reverse of find vq.
This is required to make it possible to retry find_vqs
after a failure, otherwise the list gets corrupted.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_pci.c

index ca40517..a1cb1a1 100644 (file)
@@ -464,7 +464,11 @@ static void vp_del_vq(struct virtqueue *vq)
 {
        struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
        struct virtio_pci_vq_info *info = vq->priv;
-       unsigned long size;
+       unsigned long flags, size;
+
+       spin_lock_irqsave(&vp_dev->lock, flags);
+       list_del(&info->node);
+       spin_unlock_irqrestore(&vp_dev->lock, flags);
 
        iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);