scsi: core: Add lock context annotations

Document which functions expect that shost->scan_mutex is held.

Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/ad5ca37acf8c933a12830c0811c293af54c87573.1786142946.git.bvanassche@acm.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
Bart Van Assche 2026-08-07 15:49:49 -07:00 committed by Martin K. Petersen (Oracle)
parent e70647b25a
commit 09982efcc0

View File

@ -1195,6 +1195,7 @@ static int scsi_probe_and_add_lun(struct Scsi_Host *shost,
struct scsi_device **sdevp,
enum scsi_scan_mode rescan,
void *hostdata)
__must_hold(&shost->scan_mutex)
{
struct scsi_device *sdev;
unsigned char *result;
@ -1352,6 +1353,7 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost,
struct scsi_target *starget,
blist_flags_t bflags, int scsi_level,
enum scsi_scan_mode rescan)
__must_hold(&shost->scan_mutex)
{
uint max_dev_lun;
u64 sparse_lun, lun;
@ -1444,6 +1446,7 @@ static void scsi_sequential_lun_scan(struct Scsi_Host *shost,
static int scsi_report_lun_scan(struct Scsi_Host *shost,
struct scsi_target *starget, blist_flags_t bflags,
enum scsi_scan_mode rescan)
__must_hold(&shost->scan_mutex)
{
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
unsigned int length;
@ -1769,6 +1772,7 @@ EXPORT_SYMBOL(scsi_rescan_device);
static void __scsi_scan_target(struct Scsi_Host *shost, struct device *parent,
unsigned int channel, unsigned int id, u64 lun,
enum scsi_scan_mode rescan)
__must_hold(&shost->scan_mutex)
{
blist_flags_t bflags = 0;
int res;
@ -1866,6 +1870,7 @@ EXPORT_SYMBOL(scsi_scan_target);
static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
unsigned int id, u64 lun,
enum scsi_scan_mode rescan)
__must_hold(&shost->scan_mutex)
{
uint order_id;