vhost/scsi: don't send events when eventq is unset
We do technically support initiators without eventq or controlq, but the lun hotplug/hotremove path expected the eventq to be always present. This was causing vhost to randomly crash in the fuzz tests. Specifically, the crash happened if lun hotplug was handled while a VM was in the middle of switching from BIOS to OS. We fix it by checking if eventq is set before putting any event there. LUN hotplug and hotremove won't work without an eventq, but the entire session will be restarted after new queues are initialized. This will make the VM retrieve all up-to-date luns after OS initialization is complete. Change-Id: I5d28cbedad8fb2a35ede5a491aeb7fdc52faad06 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451789 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
5bf0a3838c
commit
47cf47e482
@ -276,7 +276,7 @@ eventq_enqueue(struct spdk_vhost_scsi_session *svsession, unsigned scsi_dev_num,
|
||||
assert(scsi_dev_num < SPDK_VHOST_SCSI_CTRLR_MAX_DEVS);
|
||||
vq = &vsession->virtqueue[VIRTIO_SCSI_EVENTQ];
|
||||
|
||||
if (spdk_vhost_vq_avail_ring_get(vq, &req, 1) != 1) {
|
||||
if (vq->vring.desc == NULL || spdk_vhost_vq_avail_ring_get(vq, &req, 1) != 1) {
|
||||
SPDK_ERRLOG("Controller %s: Failed to send virtio event (no avail ring entries?).\n",
|
||||
vdev->name);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user