qemu/hw/scsi
Li Feng 6eaf0e612b vhost-user: fix lost reconnect again
When the vhost-user is reconnecting to the backend, and if the vhost-user fails
at the get_features in vhost_dev_init(), then the reconnect will fail
and it will not be retriggered forever.

The reason is:
When the vhost-user fail at get_features, the vhost_dev_cleanup will be called
immediately.

vhost_dev_cleanup calls 'memset(hdev, 0, sizeof(struct vhost_dev))'.

The reconnect path is:
vhost_user_blk_event
   vhost_user_async_close(.. vhost_user_blk_disconnect ..)
     qemu_chr_fe_set_handlers <----- clear the notifier callback
       schedule vhost_user_async_close_bh

The vhost->vdev is null, so the vhost_user_blk_disconnect will not be
called, then the event fd callback will not be reinstalled.

We need to ensure that even if vhost_dev_init initialization fails, the event
handler still needs to be reinstalled when s->connected is false.

All vhost-user devices have this issue, including vhost-user-blk/scsi.

Fixes: 71e076a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling")

Signed-off-by: Li Feng <fengli@smartx.com>
Message-Id: <20240516025753.130171-3-fengli@smartx.com>
Reviewed-by: Raphael Norwitz <raphael@enfabrica.net>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-01 17:16:04 -04:00
..
emulation.c
esp-pci.c
esp.c esp.c: remove explicit setting of DRQ within ESP state machine 2024-04-04 15:17:53 +01:00
Kconfig
lsi53c895a.c lsi53c895a: avoid out of bounds access to s->msg[] 2024-04-02 18:08:59 +02:00
megasas.c
meson.build
mfi.h
mpi.h
mptconfig.c
mptendian.c
mptsas.c
mptsas.h
scsi-bus.c
scsi-disk.c scsi-disk: Fix crash for VM configured with USB CDROM after live migration 2024-06-10 19:01:08 +02:00
scsi-generic.c hw/scsi/scsi-generic: Fix io_timeout property not applying 2024-03-26 14:24:06 +01:00
spapr_vscsi.c
srp.h
trace-events hw/scsi/lsi53c895a: add timer to scripts processing 2024-03-08 15:51:21 +01:00
trace.h
vhost-scsi-common.c
vhost-scsi.c vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits 2024-07-01 14:56:23 -04:00
vhost-user-scsi.c vhost-user: fix lost reconnect again 2024-07-01 17:16:04 -04:00
viosrp.h
virtio-scsi-dataplane.c
virtio-scsi.c
vmw_pvscsi.c
vmw_pvscsi.h