virtio-scsi: dataplane: stop trying on notifier error
There's no use to constantly trying to enable dataplane if we failed to set up guest or host notifiers, so fence it off in that case. We'll try again if the device is reinitialized. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
361dcc790d
commit
4adea8042f
|
@ -53,6 +53,7 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
|
fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
|
||||||
rc);
|
rc);
|
||||||
|
s->dataplane_fenced = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
r->host_notifier = *virtio_queue_get_host_notifier(vq);
|
r->host_notifier = *virtio_queue_get_host_notifier(vq);
|
||||||
|
@ -198,6 +199,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
|
||||||
|
|
||||||
if (s->dataplane_started ||
|
if (s->dataplane_started ||
|
||||||
s->dataplane_starting ||
|
s->dataplane_starting ||
|
||||||
|
s->dataplane_fenced ||
|
||||||
s->ctx != iothread_get_aio_context(vs->conf.iothread)) {
|
s->ctx != iothread_get_aio_context(vs->conf.iothread)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -211,6 +213,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s)
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
|
fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
|
||||||
"ensure -enable-kvm is set\n", rc);
|
"ensure -enable-kvm is set\n", rc);
|
||||||
|
s->dataplane_fenced = true;
|
||||||
goto fail_guest_notifiers;
|
goto fail_guest_notifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +265,11 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
|
||||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Better luck next time. */
|
||||||
|
if (s->dataplane_fenced) {
|
||||||
|
s->dataplane_fenced = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!s->dataplane_started || s->dataplane_stopping) {
|
if (!s->dataplane_started || s->dataplane_stopping) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,6 +195,7 @@ typedef struct VirtIOSCSI {
|
||||||
bool dataplane_starting;
|
bool dataplane_starting;
|
||||||
bool dataplane_stopping;
|
bool dataplane_stopping;
|
||||||
bool dataplane_disabled;
|
bool dataplane_disabled;
|
||||||
|
bool dataplane_fenced;
|
||||||
Error *blocker;
|
Error *blocker;
|
||||||
Notifier migration_state_notifier;
|
Notifier migration_state_notifier;
|
||||||
} VirtIOSCSI;
|
} VirtIOSCSI;
|
||||||
|
|
Loading…
Reference in a new issue