mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
scsi: Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans"
This reverts commit37c4e72b06. Said commit causes excessive resource usage and even system freeze with some controllers, e.g. smartpqi and hisi_sas. The justification provided by the patch authors [1] was supporting a special mode of the mpi3mr and mpt3sas, so-called "Tri-mode", in which NVMe drives are exposed as SCSI devices on a separate channel. While that's useful for these drivers, it seems wrong to cause major breakage for other drivers for the sake of this feature. [1] https://lore.kernel.org/linux-scsi/CAFdVvOwjy+2ORJ6uJkspiLTPF05481U7gcS4QohFOFGPqAs8ig@mail.gmail.com/ Fixes:37c4e72b06("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans") Signed-off-by: Martin Wilck <martin.wilck@suse.com> Cc: Don Brace <don.brace@microchip.com> Cc: storagedev@microchip.com Cc: Ranjan Kumar <ranjan.kumar@broadcom.com> Cc: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com> Cc: Kashyap Desai <kashyap.desai@broadcom.com> Cc: Sumit Saxena <sumit.saxena@broadcom.com> Cc: mpi3mr-linuxdrv.pdl@broadcom.com Cc: MPT-FusionLinux.pdl@broadcom.com Cc: Yihang Li <liyihang9@h-partners.c> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20260513174236.430465-3-mwilck@suse.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
57db1307af
commit
8c292e89bd
@@ -1921,7 +1921,7 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_scan_host_selected);
|
||||
|
||||
static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
|
||||
{
|
||||
struct scsi_device *sdev;
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
#include <scsi/scsi_transport_sas.h>
|
||||
|
||||
#include "scsi_sas_internal.h"
|
||||
#include "scsi_priv.h"
|
||||
|
||||
struct sas_host_attrs {
|
||||
struct list_head rphy_list;
|
||||
struct mutex lock;
|
||||
@@ -1685,22 +1683,6 @@ int scsi_is_sas_rphy(const struct device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_is_sas_rphy);
|
||||
|
||||
static void scan_channel_zero(struct Scsi_Host *shost, uint id, u64 lun)
|
||||
{
|
||||
struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
|
||||
struct sas_rphy *rphy;
|
||||
|
||||
list_for_each_entry(rphy, &sas_host->rphy_list, list) {
|
||||
if (rphy->identify.device_type != SAS_END_DEVICE ||
|
||||
rphy->scsi_target_id == -1)
|
||||
continue;
|
||||
|
||||
if (id == SCAN_WILD_CARD || id == rphy->scsi_target_id) {
|
||||
scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,
|
||||
lun, SCSI_SCAN_MANUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* SCSI scan helper
|
||||
@@ -1710,41 +1692,23 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
|
||||
uint id, u64 lun)
|
||||
{
|
||||
struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
|
||||
int res = 0;
|
||||
int i;
|
||||
struct sas_rphy *rphy;
|
||||
|
||||
switch (channel) {
|
||||
case 0:
|
||||
mutex_lock(&sas_host->lock);
|
||||
scan_channel_zero(shost, id, lun);
|
||||
mutex_unlock(&sas_host->lock);
|
||||
break;
|
||||
mutex_lock(&sas_host->lock);
|
||||
list_for_each_entry(rphy, &sas_host->rphy_list, list) {
|
||||
if (rphy->identify.device_type != SAS_END_DEVICE ||
|
||||
rphy->scsi_target_id == -1)
|
||||
continue;
|
||||
|
||||
case SCAN_WILD_CARD:
|
||||
mutex_lock(&sas_host->lock);
|
||||
scan_channel_zero(shost, id, lun);
|
||||
mutex_unlock(&sas_host->lock);
|
||||
|
||||
for (i = 1; i <= shost->max_channel; i++) {
|
||||
res = scsi_scan_host_selected(shost, i, id, lun,
|
||||
SCSI_SCAN_MANUAL);
|
||||
if (res)
|
||||
goto exit_scan;
|
||||
if ((channel == SCAN_WILD_CARD || channel == 0) &&
|
||||
(id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
|
||||
scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,
|
||||
lun, SCSI_SCAN_MANUAL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (channel <= shost->max_channel) {
|
||||
res = scsi_scan_host_selected(shost, channel, id, lun,
|
||||
SCSI_SCAN_MANUAL);
|
||||
} else {
|
||||
res = -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&sas_host->lock);
|
||||
|
||||
exit_scan:
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user