Skip to content

Commit

Permalink
vhost: set started flag while start is in progress
Browse files Browse the repository at this point in the history
This makes it possible to use started flag for sanity checking
of callbacks that happen during start/stop.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
mstsirkin committed Jan 7, 2013
1 parent 1830b80 commit 24f4fe3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/vhost.c
Expand Up @@ -873,6 +873,9 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
{
int i, r;

hdev->started = true;

if (!vdev->binding->set_guest_notifiers) {
fprintf(stderr, "binding does not support guest notifiers\n");
r = -ENOSYS;
Expand Down Expand Up @@ -918,8 +921,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
}
}

hdev->started = true;

return 0;
fail_log:
fail_vq:
Expand All @@ -934,6 +935,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
vdev->binding->set_guest_notifiers(vdev->binding_opaque, hdev->nvqs, false);
fail_notifiers:
fail:

hdev->started = false;
return r;
}

Expand Down

0 comments on commit 24f4fe3

Please sign in to comment.