mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
scsi: virtio_scsi: Rescan the entire target on transport reset when LUN is 0
VirtIO 1.0 spec says: The removed and rescan events ... when sent for LUN 0, they MAY apply to the entire target so the driver can ask the initiator to rescan the target to detect this. This change introduces the behaviour described above by scanning the entire SCSI target when LUN is set to 0. This is both a functional and a performance fix. It aligns the driver with the spec and allows control planes to hotplug targets with large numbers of LUNs without having to request a RESCAN for each one of them. Link: https://lore.kernel.org/r/CY4PR02MB33354370E0A81E75DD9DFE74FB520@CY4PR02MB3335.namprd02.prod.outlook.com Suggested-by: Felipe Franciosi <felipe@nutanix.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Matej Genci <matej.genci@nutanix.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
9d8a551028
commit
beef6fd02b
1 changed files with 6 additions and 1 deletions
|
@ -284,7 +284,12 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi,
|
||||||
|
|
||||||
switch (virtio32_to_cpu(vscsi->vdev, event->reason)) {
|
switch (virtio32_to_cpu(vscsi->vdev, event->reason)) {
|
||||||
case VIRTIO_SCSI_EVT_RESET_RESCAN:
|
case VIRTIO_SCSI_EVT_RESET_RESCAN:
|
||||||
scsi_add_device(shost, 0, target, lun);
|
if (lun == 0) {
|
||||||
|
scsi_scan_target(&shost->shost_gendev, 0, target,
|
||||||
|
SCAN_WILD_CARD, SCSI_SCAN_INITIAL);
|
||||||
|
} else {
|
||||||
|
scsi_add_device(shost, 0, target, lun);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case VIRTIO_SCSI_EVT_RESET_REMOVED:
|
case VIRTIO_SCSI_EVT_RESET_REMOVED:
|
||||||
sdev = scsi_device_lookup(shost, 0, target, lun);
|
sdev = scsi_device_lookup(shost, 0, target, lun);
|
||||||
|
|
Loading…
Reference in a new issue