diff options
author | Mike Anderson <andmike@us.ibm.com> | 2005-06-16 14:14:33 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-07-30 12:13:01 -0400 |
commit | 82f29467a025f6a2192d281e97fca0be46e905cc (patch) | |
tree | 5cf356ece53caf2936ca85803676b326094f7c38 /drivers/scsi/scsi_scan.c | |
parent | d2c9d9eafa03dbd08a8a439e6c5addb8b1f03b9b (diff) |
[SCSI] host state model update: mediate host add/remove race
Add support to not allow additions to a host when it is being removed.
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 2d3c4ac475f2..076cbe3b5a05 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -1251,9 +1251,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, | |||
1251 | 1251 | ||
1252 | get_device(&starget->dev); | 1252 | get_device(&starget->dev); |
1253 | down(&shost->scan_mutex); | 1253 | down(&shost->scan_mutex); |
1254 | res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); | 1254 | if (scsi_host_scan_allowed(shost)) { |
1255 | if (res != SCSI_SCAN_LUN_PRESENT) | 1255 | res = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, |
1256 | sdev = ERR_PTR(-ENODEV); | 1256 | hostdata); |
1257 | if (res != SCSI_SCAN_LUN_PRESENT) | ||
1258 | sdev = ERR_PTR(-ENODEV); | ||
1259 | } | ||
1257 | up(&shost->scan_mutex); | 1260 | up(&shost->scan_mutex); |
1258 | scsi_target_reap(starget); | 1261 | scsi_target_reap(starget); |
1259 | put_device(&starget->dev); | 1262 | put_device(&starget->dev); |
@@ -1403,11 +1406,15 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, | |||
1403 | return -EINVAL; | 1406 | return -EINVAL; |
1404 | 1407 | ||
1405 | down(&shost->scan_mutex); | 1408 | down(&shost->scan_mutex); |
1406 | if (channel == SCAN_WILD_CARD) | 1409 | if (scsi_host_scan_allowed(shost)) { |
1407 | for (channel = 0; channel <= shost->max_channel; channel++) | 1410 | if (channel == SCAN_WILD_CARD) |
1411 | for (channel = 0; channel <= shost->max_channel; | ||
1412 | channel++) | ||
1413 | scsi_scan_channel(shost, channel, id, lun, | ||
1414 | rescan); | ||
1415 | else | ||
1408 | scsi_scan_channel(shost, channel, id, lun, rescan); | 1416 | scsi_scan_channel(shost, channel, id, lun, rescan); |
1409 | else | 1417 | } |
1410 | scsi_scan_channel(shost, channel, id, lun, rescan); | ||
1411 | up(&shost->scan_mutex); | 1418 | up(&shost->scan_mutex); |
1412 | 1419 | ||
1413 | return 0; | 1420 | return 0; |