• Mike Christie's avatar
    vhost-scsi: Reduce vhost_scsi_mutex use · bea273c7
    Mike Christie authored
    We on longer need to hold the vhost_scsi_mutex the entire time we
    set/clear the endpoint. The tv_tpg_mutex handles tpg accesses not related
    to the tpg list, the port link/unlink functions use the tv_tpg_mutex while
    accessing the tpg->vhost_scsi pointer, vhost_scsi_do_plug will no longer
    queue events after the virtqueue's backend has been cleared and flushed,
    and we don't drop our refcount to the tpg until after we have stopped
    cmds and wait for outstanding cmds to complete.
    
    This moves the vhost_scsi_mutex use to it's documented use of being used
    to access the tpg list. We then don't need to hold it while a flush is
    being performed causing other device's vhost_scsi_set_endpoint
    and vhost_scsi_make_tpg/vhost_scsi_drop_tpg calls to have to wait on a
    flakey device.
    Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
    Message-Id: <20230321020624.13323-8-michael.christie@oracle.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    bea273c7
scsi.c 64.7 KB