Skip to content

Fix SAS wildcard scan on smartpqi and other controllers

Martin Wilck linux-scsi stable 3 versions – Applied

Status from this message: Applied to 7.2/scsi-staging, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 7 repliesApplied
  2. v22 patches 2 repliesSuperseded
  3. v12 patches 6 repliesSuperseded

Changes in v3 from the cover letter

- Removed patch 2 and replaced it by a revert of 37c4e72b0651

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()drivers/scsi/smartpqi/smartpqi_init.c+1 -11 reply
2/2Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans"drivers/scsi/scsi_scan.c drivers/scsi/scsi_transport_sas.c+13 -493 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDon BraceChristoph HellwigHannes Reinecke
SeriesR-b
1/2R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] Fix SAS wildcard scan on smartpqi and other controllers

commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans") modified the way SAS drivers handle the common way of rescanning SCSI devices using "echo - - - >/sys/class/scsi_host/host$N/scan". Before this patch, SAS drivers would only scan channel 0 for this "wildcard scan" scenario; after this patch, it would scan all channels up to shost->max_channel.

This can cause massive resource usage for some drivers, as the driver needs to send an INQUIRY to LUN 0 to every supported ID and e.g. smartpqi sets shost->max_id to 0xffffffff. These INQUIRYs mostly fail, but the kernel needs to set up queues, tag sets, etc. before sending the INQUIRY. Also, some SAS drivers assign special meaning to SCSI channels such as channel 0 for physical and channel 1 for logical devices, and thus don't support "normal" SCSI scanning of these channels anyway.

With smartpqi and hisi_sas, actual kernel crashes due to resource exhaustion have been observed.

v1 and v2 of this patch set proposed leveraging the functions scan_start() and scan_finished() provided by some SAS drivers for fixing this issue. But the review of the v2 series by Sashiko showed that this is a complex and error-prone endeavor. Therefore I asked for some guidance on the ML [1]. I am now proposing a different, simpler solution to the issues we observed, which is simply reverting commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans").

This revert will require a different solution for the wildcard scan with mpi3mr and mpt3sas with "Tri-mode" enabled. But it seems wrong in the first place that adding the support for this special mode of operation for some drivers broke wildcard scan for other drivers.

The first patch is a minor fix for smartpqi.

[1] https://lore.kernel.org/linux-scsi/[email protected]/

----
Changes v2 -> v3:

- Removed patch 2 and replaced it by a revert of 37c4e72b0651

Changes v1 -> v2 (obsolete)

- export and call do_scsi_scan_host() instead of duplicating its code (Hannes Reinecke)

Martin Wilck (2):
scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel
scans"

 drivers/scsi/scsi_scan.c              |  2 +-
 drivers/scsi/scsi_transport_sas.c     | 60 ++++++---------------------
 drivers/scsi/smartpqi/smartpqi_init.c |  2 +-
 3 files changed, 14 insertions(+), 50 deletions(-)
Signature · 1 line
2.54.0