aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/hosts.c2
-rw-r--r--drivers/scsi/scsi_scan.c21
2 files changed, 16 insertions, 7 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 67c4c0c3aa5e..8640ad1c17e2 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -133,7 +133,9 @@ EXPORT_SYMBOL(scsi_host_set_state);
133 **/ 133 **/
134void scsi_remove_host(struct Scsi_Host *shost) 134void scsi_remove_host(struct Scsi_Host *shost)
135{ 135{
136 down(&shost->scan_mutex);
136 scsi_host_set_state(shost, SHOST_CANCEL); 137 scsi_host_set_state(shost, SHOST_CANCEL);
138 up(&shost->scan_mutex);
137 scsi_forget_host(shost); 139 scsi_forget_host(shost);
138 scsi_proc_host_rm(shost); 140 scsi_proc_host_rm(shost);
139 141
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;