virito_scsi: use freezable WQ for events
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Oct 2014 23:52:33 +0000 (10:22 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 14 Oct 2014 23:55:11 +0000 (10:25 +1030)
Michael S. Tsirkin noticed a race condition:
we reset device on freeze, but system WQ is still
running so it might try adding bufs to a VQ meanwhile.

To fix, switch to handling events from the freezable WQ.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/scsi/virtio_scsi.c

index 6a39896b30dc40862f81806f4a66d3a173b76f6e..29fd44a5d4ddced63337dad1bcaff71d82af5aec 100644 (file)
@@ -390,7 +390,7 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf)
 {
        struct virtio_scsi_event_node *event_node = buf;
 
-       schedule_work(&event_node->work);
+       queue_work(system_freezable_wq, &event_node->work);
 }
 
 static void virtscsi_event_done(struct virtqueue *vq)