aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2016-03-17 03:39:45 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-11 16:57:09 -0400
commit1d64508810d8d15867251c75a68d7250278ce2bd (patch)
treea7f43abdbf163aad5545eeea1d3b840c4adb2954
parent216fad91387aab7c9e69fe0854d843f012968748 (diff)
scsi: disable automatic target scan
On larger installations it is useful to disable automatic LUN scanning, and only add the required LUNs via udev rules. This can speed up bootup dramatically. This patch introduces a new scan module parameter value 'manual', which works like 'none', but can be overridden by setting the 'rescan' value from scsi_scan_target to 'SCSI_SCAN_MANUAL'. And it updates all relevant callers to set the 'rescan' value to 'SCSI_SCAN_MANUAL' if invoked via the 'scan' option in sysfs. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Tested-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c2
-rw-r--r--drivers/message/fusion/mptspi.c2
-rw-r--r--drivers/s390/scsi/zfcp_unit.c3
-rw-r--r--drivers/scsi/scsi_priv.h2
-rw-r--r--drivers/scsi/scsi_proc.c3
-rw-r--r--drivers/scsi/scsi_scan.c44
-rw-r--r--drivers/scsi/scsi_sysfs.c3
-rw-r--r--drivers/scsi/scsi_transport_fc.c6
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c5
-rw-r--r--drivers/scsi/scsi_transport_sas.c7
-rw-r--r--drivers/scsi/snic/snic_disc.c2
-rw-r--r--include/scsi/scsi_device.h9
12 files changed, 60 insertions, 28 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index b6bf20496021..ff21597aa54d 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2819,7 +2819,7 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
2819 spin_unlock(&host->target_lock); 2819 spin_unlock(&host->target_lock);
2820 2820
2821 scsi_scan_target(&target->scsi_host->shost_gendev, 2821 scsi_scan_target(&target->scsi_host->shost_gendev,
2822 0, target->scsi_id, SCAN_WILD_CARD, 0); 2822 0, target->scsi_id, SCAN_WILD_CARD, SCSI_SCAN_INITIAL);
2823 2823
2824 if (srp_connected_ch(target) < target->ch_count || 2824 if (srp_connected_ch(target) < target->ch_count ||
2825 target->qp_in_error) { 2825 target->qp_in_error) {
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 613231c16194..031e088edb5e 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -1150,7 +1150,7 @@ static void mpt_work_wrapper(struct work_struct *work)
1150 } 1150 }
1151 shost_printk(KERN_INFO, shost, MYIOC_s_FMT 1151 shost_printk(KERN_INFO, shost, MYIOC_s_FMT
1152 "Integrated RAID detects new device %d\n", ioc->name, disk); 1152 "Integrated RAID detects new device %d\n", ioc->name, disk);
1153 scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1); 1153 scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, SCSI_SCAN_RESCAN);
1154} 1154}
1155 1155
1156 1156
diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
index 157d3d203ba1..08bba7ce7cef 100644
--- a/drivers/s390/scsi/zfcp_unit.c
+++ b/drivers/s390/scsi/zfcp_unit.c
@@ -26,7 +26,8 @@ void zfcp_unit_scsi_scan(struct zfcp_unit *unit)
26 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun); 26 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
27 27
28 if (rport && rport->port_state == FC_PORTSTATE_ONLINE) 28 if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
29 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id, lun, 1); 29 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id, lun,
30 SCSI_SCAN_RESCAN);
30} 31}
31 32
32static void zfcp_unit_scsi_scan_work(struct work_struct *work) 33static void zfcp_unit_scsi_scan_work(struct work_struct *work)
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 27b4d0a6a01d..57a4b9973320 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -116,7 +116,7 @@ extern void scsi_exit_procfs(void);
116extern char scsi_scan_type[]; 116extern char scsi_scan_type[];
117extern int scsi_complete_async_scans(void); 117extern int scsi_complete_async_scans(void);
118extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, 118extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
119 unsigned int, u64, int); 119 unsigned int, u64, enum scsi_scan_mode);
120extern void scsi_forget_host(struct Scsi_Host *); 120extern void scsi_forget_host(struct Scsi_Host *);
121extern void scsi_rescan_device(struct device *); 121extern void scsi_rescan_device(struct device *);
122 122
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 251598eb3547..7a74b82e8973 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -251,7 +251,8 @@ static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
251 if (shost->transportt->user_scan) 251 if (shost->transportt->user_scan)
252 error = shost->transportt->user_scan(shost, channel, id, lun); 252 error = shost->transportt->user_scan(shost, channel, id, lun);
253 else 253 else
254 error = scsi_scan_host_selected(shost, channel, id, lun, 1); 254 error = scsi_scan_host_selected(shost, channel, id, lun,
255 SCSI_SCAN_MANUAL);
255 scsi_host_put(shost); 256 scsi_host_put(shost);
256 return error; 257 return error;
257} 258}
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 97074c91e328..6c8ad36560d1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -96,10 +96,13 @@ MODULE_PARM_DESC(max_luns,
96#define SCSI_SCAN_TYPE_DEFAULT "sync" 96#define SCSI_SCAN_TYPE_DEFAULT "sync"
97#endif 97#endif
98 98
99char scsi_scan_type[6] = SCSI_SCAN_TYPE_DEFAULT; 99char scsi_scan_type[7] = SCSI_SCAN_TYPE_DEFAULT;
100 100
101module_param_string(scan, scsi_scan_type, sizeof(scsi_scan_type), S_IRUGO); 101module_param_string(scan, scsi_scan_type, sizeof(scsi_scan_type),
102MODULE_PARM_DESC(scan, "sync, async or none"); 102 S_IRUGO|S_IWUSR);
103MODULE_PARM_DESC(scan, "sync, async, manual, or none. "
104 "Setting to 'manual' disables automatic scanning, but allows "
105 "for manual device scan via the 'scan' sysfs attribute.");
103 106
104static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ + 18; 107static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ + 18;
105 108
@@ -1040,7 +1043,8 @@ static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
1040 * @lun: LUN of target device 1043 * @lun: LUN of target device
1041 * @bflagsp: store bflags here if not NULL 1044 * @bflagsp: store bflags here if not NULL
1042 * @sdevp: probe the LUN corresponding to this scsi_device 1045 * @sdevp: probe the LUN corresponding to this scsi_device
1043 * @rescan: if nonzero skip some code only needed on first scan 1046 * @rescan: if not equal to SCSI_SCAN_INITIAL skip some code only
1047 * needed on first scan
1044 * @hostdata: passed to scsi_alloc_sdev() 1048 * @hostdata: passed to scsi_alloc_sdev()
1045 * 1049 *
1046 * Description: 1050 * Description:
@@ -1055,7 +1059,8 @@ static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
1055 **/ 1059 **/
1056static int scsi_probe_and_add_lun(struct scsi_target *starget, 1060static int scsi_probe_and_add_lun(struct scsi_target *starget,
1057 u64 lun, int *bflagsp, 1061 u64 lun, int *bflagsp,
1058 struct scsi_device **sdevp, int rescan, 1062 struct scsi_device **sdevp,
1063 enum scsi_scan_mode rescan,
1059 void *hostdata) 1064 void *hostdata)
1060{ 1065{
1061 struct scsi_device *sdev; 1066 struct scsi_device *sdev;
@@ -1069,7 +1074,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1069 */ 1074 */
1070 sdev = scsi_device_lookup_by_target(starget, lun); 1075 sdev = scsi_device_lookup_by_target(starget, lun);
1071 if (sdev) { 1076 if (sdev) {
1072 if (rescan || !scsi_device_created(sdev)) { 1077 if (rescan != SCSI_SCAN_INITIAL || !scsi_device_created(sdev)) {
1073 SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, 1078 SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
1074 "scsi scan: device exists on %s\n", 1079 "scsi scan: device exists on %s\n",
1075 dev_name(&sdev->sdev_gendev))); 1080 dev_name(&sdev->sdev_gendev)));
@@ -1205,7 +1210,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1205 * Modifies sdevscan->lun. 1210 * Modifies sdevscan->lun.
1206 **/ 1211 **/
1207static void scsi_sequential_lun_scan(struct scsi_target *starget, 1212static void scsi_sequential_lun_scan(struct scsi_target *starget,
1208 int bflags, int scsi_level, int rescan) 1213 int bflags, int scsi_level,
1214 enum scsi_scan_mode rescan)
1209{ 1215{
1210 uint max_dev_lun; 1216 uint max_dev_lun;
1211 u64 sparse_lun, lun; 1217 u64 sparse_lun, lun;
@@ -1300,7 +1306,7 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
1300 * 1: could not scan with REPORT LUN 1306 * 1: could not scan with REPORT LUN
1301 **/ 1307 **/
1302static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, 1308static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1303 int rescan) 1309 enum scsi_scan_mode rescan)
1304{ 1310{
1305 char devname[64]; 1311 char devname[64];
1306 unsigned char scsi_cmd[MAX_COMMAND_SIZE]; 1312 unsigned char scsi_cmd[MAX_COMMAND_SIZE];
@@ -1546,7 +1552,7 @@ void scsi_rescan_device(struct device *dev)
1546EXPORT_SYMBOL(scsi_rescan_device); 1552EXPORT_SYMBOL(scsi_rescan_device);
1547 1553
1548static void __scsi_scan_target(struct device *parent, unsigned int channel, 1554static void __scsi_scan_target(struct device *parent, unsigned int channel,
1549 unsigned int id, u64 lun, int rescan) 1555 unsigned int id, u64 lun, enum scsi_scan_mode rescan)
1550{ 1556{
1551 struct Scsi_Host *shost = dev_to_shost(parent); 1557 struct Scsi_Host *shost = dev_to_shost(parent);
1552 int bflags = 0; 1558 int bflags = 0;
@@ -1604,7 +1610,10 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1604 * @channel: channel to scan 1610 * @channel: channel to scan
1605 * @id: target id to scan 1611 * @id: target id to scan
1606 * @lun: Specific LUN to scan or SCAN_WILD_CARD 1612 * @lun: Specific LUN to scan or SCAN_WILD_CARD
1607 * @rescan: passed to LUN scanning routines 1613 * @rescan: passed to LUN scanning routines; SCSI_SCAN_INITIAL for
1614 * no rescan, SCSI_SCAN_RESCAN to rescan existing LUNs,
1615 * and SCSI_SCAN_MANUAL to force scanning even if
1616 * 'scan=manual' is set.
1608 * 1617 *
1609 * Description: 1618 * Description:
1610 * Scan the target id on @parent, @channel, and @id. Scan at least LUN 0, 1619 * Scan the target id on @parent, @channel, and @id. Scan at least LUN 0,
@@ -1614,13 +1623,17 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1614 * sequential scan of LUNs on the target id. 1623 * sequential scan of LUNs on the target id.
1615 **/ 1624 **/
1616void scsi_scan_target(struct device *parent, unsigned int channel, 1625void scsi_scan_target(struct device *parent, unsigned int channel,
1617 unsigned int id, u64 lun, int rescan) 1626 unsigned int id, u64 lun, enum scsi_scan_mode rescan)
1618{ 1627{
1619 struct Scsi_Host *shost = dev_to_shost(parent); 1628 struct Scsi_Host *shost = dev_to_shost(parent);
1620 1629
1621 if (strncmp(scsi_scan_type, "none", 4) == 0) 1630 if (strncmp(scsi_scan_type, "none", 4) == 0)
1622 return; 1631 return;
1623 1632
1633 if (rescan != SCSI_SCAN_MANUAL &&
1634 strncmp(scsi_scan_type, "manual", 6) == 0)
1635 return;
1636
1624 mutex_lock(&shost->scan_mutex); 1637 mutex_lock(&shost->scan_mutex);
1625 if (!shost->async_scan) 1638 if (!shost->async_scan)
1626 scsi_complete_async_scans(); 1639 scsi_complete_async_scans();
@@ -1634,7 +1647,8 @@ void scsi_scan_target(struct device *parent, unsigned int channel,
1634EXPORT_SYMBOL(scsi_scan_target); 1647EXPORT_SYMBOL(scsi_scan_target);
1635 1648
1636static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel, 1649static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1637 unsigned int id, u64 lun, int rescan) 1650 unsigned int id, u64 lun,
1651 enum scsi_scan_mode rescan)
1638{ 1652{
1639 uint order_id; 1653 uint order_id;
1640 1654
@@ -1665,7 +1679,8 @@ static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1665} 1679}
1666 1680
1667int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, 1681int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
1668 unsigned int id, u64 lun, int rescan) 1682 unsigned int id, u64 lun,
1683 enum scsi_scan_mode rescan)
1669{ 1684{
1670 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost, 1685 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost,
1671 "%s: <%u:%u:%llu>\n", 1686 "%s: <%u:%u:%llu>\n",
@@ -1844,7 +1859,8 @@ void scsi_scan_host(struct Scsi_Host *shost)
1844{ 1859{
1845 struct async_scan_data *data; 1860 struct async_scan_data *data;
1846 1861
1847 if (strncmp(scsi_scan_type, "none", 4) == 0) 1862 if (strncmp(scsi_scan_type, "none", 4) == 0 ||
1863 strncmp(scsi_scan_type, "manual", 6) == 0)
1848 return; 1864 return;
1849 if (scsi_autopm_get_host(shost) < 0) 1865 if (scsi_autopm_get_host(shost) < 0)
1850 return; 1866 return;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 2b642b145be1..b36544162f2f 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -145,7 +145,8 @@ static int scsi_scan(struct Scsi_Host *shost, const char *str)
145 if (shost->transportt->user_scan) 145 if (shost->transportt->user_scan)
146 res = shost->transportt->user_scan(shost, channel, id, lun); 146 res = shost->transportt->user_scan(shost, channel, id, lun);
147 else 147 else
148 res = scsi_scan_host_selected(shost, channel, id, lun, 1); 148 res = scsi_scan_host_selected(shost, channel, id, lun,
149 SCSI_SCAN_MANUAL);
149 return res; 150 return res;
150} 151}
151 152
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 8a8822641b26..bf28c688c72a 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2110,7 +2110,8 @@ fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, u64 lun)
2110 if ((channel == rport->channel) && 2110 if ((channel == rport->channel) &&
2111 (id == rport->scsi_target_id)) { 2111 (id == rport->scsi_target_id)) {
2112 spin_unlock_irqrestore(shost->host_lock, flags); 2112 spin_unlock_irqrestore(shost->host_lock, flags);
2113 scsi_scan_target(&rport->dev, channel, id, lun, 1); 2113 scsi_scan_target(&rport->dev, channel, id, lun,
2114 SCSI_SCAN_MANUAL);
2114 return; 2115 return;
2115 } 2116 }
2116 } 2117 }
@@ -3277,7 +3278,8 @@ fc_scsi_scan_rport(struct work_struct *work)
3277 (rport->roles & FC_PORT_ROLE_FCP_TARGET) && 3278 (rport->roles & FC_PORT_ROLE_FCP_TARGET) &&
3278 !(i->f->disable_target_scan)) { 3279 !(i->f->disable_target_scan)) {
3279 scsi_scan_target(&rport->dev, rport->channel, 3280 scsi_scan_target(&rport->dev, rport->channel,
3280 rport->scsi_target_id, SCAN_WILD_CARD, 1); 3281 rport->scsi_target_id, SCAN_WILD_CARD,
3282 SCSI_SCAN_RESCAN);
3281 } 3283 }
3282 3284
3283 spin_lock_irqsave(shost->host_lock, flags); 3285 spin_lock_irqsave(shost->host_lock, flags);
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 441481623fb9..7a759a9257ea 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1783,6 +1783,7 @@ struct iscsi_scan_data {
1783 unsigned int channel; 1783 unsigned int channel;
1784 unsigned int id; 1784 unsigned int id;
1785 u64 lun; 1785 u64 lun;
1786 enum scsi_scan_mode rescan;
1786}; 1787};
1787 1788
1788static int iscsi_user_scan_session(struct device *dev, void *data) 1789static int iscsi_user_scan_session(struct device *dev, void *data)
@@ -1819,7 +1820,7 @@ static int iscsi_user_scan_session(struct device *dev, void *data)
1819 (scan_data->id == SCAN_WILD_CARD || 1820 (scan_data->id == SCAN_WILD_CARD ||
1820 scan_data->id == id)) 1821 scan_data->id == id))
1821 scsi_scan_target(&session->dev, 0, id, 1822 scsi_scan_target(&session->dev, 0, id,
1822 scan_data->lun, 1); 1823 scan_data->lun, scan_data->rescan);
1823 } 1824 }
1824 1825
1825user_scan_exit: 1826user_scan_exit:
@@ -1836,6 +1837,7 @@ static int iscsi_user_scan(struct Scsi_Host *shost, uint channel,
1836 scan_data.channel = channel; 1837 scan_data.channel = channel;
1837 scan_data.id = id; 1838 scan_data.id = id;
1838 scan_data.lun = lun; 1839 scan_data.lun = lun;
1840 scan_data.rescan = SCSI_SCAN_MANUAL;
1839 1841
1840 return device_for_each_child(&shost->shost_gendev, &scan_data, 1842 return device_for_each_child(&shost->shost_gendev, &scan_data,
1841 iscsi_user_scan_session); 1843 iscsi_user_scan_session);
@@ -1852,6 +1854,7 @@ static void iscsi_scan_session(struct work_struct *work)
1852 scan_data.channel = 0; 1854 scan_data.channel = 0;
1853 scan_data.id = SCAN_WILD_CARD; 1855 scan_data.id = SCAN_WILD_CARD;
1854 scan_data.lun = SCAN_WILD_CARD; 1856 scan_data.lun = SCAN_WILD_CARD;
1857 scan_data.rescan = SCSI_SCAN_RESCAN;
1855 1858
1856 iscsi_user_scan_session(&session->dev, &scan_data); 1859 iscsi_user_scan_session(&session->dev, &scan_data);
1857 atomic_dec(&ihost->nr_scans); 1860 atomic_dec(&ihost->nr_scans);
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index b6f958193dad..3f0ff072184b 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -1614,7 +1614,8 @@ int sas_rphy_add(struct sas_rphy *rphy)
1614 else 1614 else
1615 lun = 0; 1615 lun = 0;
1616 1616
1617 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, 0); 1617 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun,
1618 SCSI_SCAN_INITIAL);
1618 } 1619 }
1619 1620
1620 return 0; 1621 return 0;
@@ -1739,8 +1740,8 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
1739 1740
1740 if ((channel == SCAN_WILD_CARD || channel == 0) && 1741 if ((channel == SCAN_WILD_CARD || channel == 0) &&
1741 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { 1742 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
1742 scsi_scan_target(&rphy->dev, 0, 1743 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,
1743 rphy->scsi_target_id, lun, 1); 1744 lun, SCSI_SCAN_MANUAL);
1744 } 1745 }
1745 } 1746 }
1746 mutex_unlock(&sas_host->lock); 1747 mutex_unlock(&sas_host->lock);
diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
index 5f6321759ad9..5f48795767bd 100644
--- a/drivers/scsi/snic/snic_disc.c
+++ b/drivers/scsi/snic/snic_disc.c
@@ -171,7 +171,7 @@ snic_scsi_scan_tgt(struct work_struct *work)
171 tgt->channel, 171 tgt->channel,
172 tgt->scsi_tgt_id, 172 tgt->scsi_tgt_id,
173 SCAN_WILD_CARD, 173 SCAN_WILD_CARD,
174 1); 174 SCSI_SCAN_RESCAN);
175 175
176 spin_lock_irqsave(shost->host_lock, flags); 176 spin_lock_irqsave(shost->host_lock, flags);
177 tgt->flags &= ~SNIC_TGT_SCAN_PENDING; 177 tgt->flags &= ~SNIC_TGT_SCAN_PENDING;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 74d79bde7075..1d4a3297559e 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -50,6 +50,12 @@ enum scsi_device_state {
50 SDEV_CREATED_BLOCK, /* same as above but for created devices */ 50 SDEV_CREATED_BLOCK, /* same as above but for created devices */
51}; 51};
52 52
53enum scsi_scan_mode {
54 SCSI_SCAN_INITIAL = 0,
55 SCSI_SCAN_RESCAN,
56 SCSI_SCAN_MANUAL,
57};
58
53enum scsi_device_event { 59enum scsi_device_event {
54 SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */ 60 SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */
55 SDEV_EVT_INQUIRY_CHANGE_REPORTED, /* 3F 03 UA reported */ 61 SDEV_EVT_INQUIRY_CHANGE_REPORTED, /* 3F 03 UA reported */
@@ -391,7 +397,8 @@ extern void scsi_device_resume(struct scsi_device *sdev);
391extern void scsi_target_quiesce(struct scsi_target *); 397extern void scsi_target_quiesce(struct scsi_target *);
392extern void scsi_target_resume(struct scsi_target *); 398extern void scsi_target_resume(struct scsi_target *);
393extern void scsi_scan_target(struct device *parent, unsigned int channel, 399extern void scsi_scan_target(struct device *parent, unsigned int channel,
394 unsigned int id, u64 lun, int rescan); 400 unsigned int id, u64 lun,
401 enum scsi_scan_mode rescan);
395extern void scsi_target_reap(struct scsi_target *); 402extern void scsi_target_reap(struct scsi_target *);
396extern void scsi_target_block(struct device *); 403extern void scsi_target_block(struct device *);
397extern void scsi_target_unblock(struct device *, enum scsi_device_state); 404extern void scsi_target_unblock(struct device *, enum scsi_device_state);