public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	Don Brace <don.brace@microchip.com>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Lee Duncan <lduncan@suse.com>, Martin Wilck <mwilck@suse.com>
Subject: [PATCH v2 0/2] Fix SAS wildcard scan on smartpqi and other controllers
Date: Tue, 21 Apr 2026 22:20:16 +0200	[thread overview]
Message-ID: <20260421202018.511388-1-mwilck@suse.com> (raw)

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.

A lot of SAS drivers, including the affected ones, provide scan_start() and
scan_finished() functions that offer custom, firmware-assisted scanning
functionality specific for the driver in question. The idea of this patch set
is to map the "wildcard scan" to this driver-specific scanning procedure if
the driver provides one.

The first patch is a minor fix for smartpqi to make pqi_scan_finished() work.

Changes v1 -> v2:

- 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()
  scsi: sas_user_scan: use scan_start if available

 drivers/scsi/scsi_scan.c              |  3 ++-
 drivers/scsi/scsi_transport_sas.c     | 19 +++++++++++++++++++
 drivers/scsi/smartpqi/smartpqi_init.c |  2 +-
 include/scsi/scsi_host.h              |  1 +
 4 files changed, 23 insertions(+), 2 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-04-21 20:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 20:20 Martin Wilck [this message]
2026-04-21 20:20 ` [PATCH v2 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
2026-04-21 20:20 ` [PATCH v2 2/2] scsi: sas_user_scan: use scan_start if available Martin Wilck
2026-04-30 16:30 ` [PATCH v2 0/2] Fix SAS wildcard scan on smartpqi and other controllers Martin K. Petersen
2026-05-04 16:58   ` Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260421202018.511388-1-mwilck@suse.com \
    --to=martin.wilck@suse.com \
    --cc=don.brace@microchip.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mwilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox