Commit f6c82507030d61e15928d5cad946d3eac1c4a384

Authored by Michael S. Tsirkin
Committed by Rusty Russell
1 parent ff52c3fc71

virtio: delete vq from list

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>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

drivers/virtio/virtio_pci.c
... ... @@ -464,7 +464,11 @@
464 464 {
465 465 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
466 466 struct virtio_pci_vq_info *info = vq->priv;
467   - unsigned long size;
  467 + unsigned long flags, size;
  468 +
  469 + spin_lock_irqsave(&vp_dev->lock, flags);
  470 + list_del(&info->node);
  471 + spin_unlock_irqrestore(&vp_dev->lock, flags);
468 472  
469 473 iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
470 474