]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/scsi/scsi_scan.c
scsi_dh: add 'rescan' callback
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / scsi_scan.c
index 6a820668d442f2e1b1d111ee652717e9ae0e896a..97074c91e328fbd96757f89dec8d3b9da4647843 100644 (file)
@@ -43,6 +43,7 @@
 #include <scsi/scsi_devinfo.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
+#include <scsi/scsi_dh.h>
 #include <scsi/scsi_eh.h>
 
 #include "scsi_priv.h"
@@ -518,7 +519,8 @@ void scsi_target_reap(struct scsi_target *starget)
 }
 
 /**
- * sanitize_inquiry_string - remove non-graphical chars from an INQUIRY result string
+ * scsi_sanitize_inquiry_string - remove non-graphical chars from an
+ *                                INQUIRY result string
  * @s: INQUIRY result string to sanitize
  * @len: length of the string
  *
@@ -531,7 +533,7 @@ void scsi_target_reap(struct scsi_target *starget)
  *     string terminator, so all the following characters are set to
  *     spaces.
  **/
-static void sanitize_inquiry_string(unsigned char *s, int len)
+void scsi_sanitize_inquiry_string(unsigned char *s, int len)
 {
        int terminated = 0;
 
@@ -542,6 +544,7 @@ static void sanitize_inquiry_string(unsigned char *s, int len)
                        *s = ' ';
        }
 }
+EXPORT_SYMBOL(scsi_sanitize_inquiry_string);
 
 /**
  * scsi_probe_lun - probe a single LUN using a SCSI INQUIRY
@@ -627,9 +630,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
        }
 
        if (result == 0) {
-               sanitize_inquiry_string(&inq_result[8], 8);
-               sanitize_inquiry_string(&inq_result[16], 16);
-               sanitize_inquiry_string(&inq_result[32], 4);
+               scsi_sanitize_inquiry_string(&inq_result[8], 8);
+               scsi_sanitize_inquiry_string(&inq_result[16], 16);
+               scsi_sanitize_inquiry_string(&inq_result[32], 4);
 
                response_len = inq_result[4] + 5;
                if (response_len > 255)
@@ -962,6 +965,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
        if (*bflags & BLIST_NO_DIF)
                sdev->no_dif = 1;
 
+       if (*bflags & BLIST_SYNC_ALUA)
+               sdev->synchronous_alua = 1;
+
        sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT;
 
        if (*bflags & BLIST_TRY_VPD_PAGES)
@@ -1519,9 +1525,14 @@ EXPORT_SYMBOL(scsi_add_device);
 
 void scsi_rescan_device(struct device *dev)
 {
+       struct scsi_device *sdev = to_scsi_device(dev);
+
        device_lock(dev);
 
-       scsi_attach_vpd(to_scsi_device(dev));
+       scsi_attach_vpd(sdev);
+
+       if (sdev->handler && sdev->handler->rescan)
+               sdev->handler->rescan(sdev);
 
        if (dev->driver && try_module_get(dev->driver->owner)) {
                struct scsi_driver *drv = to_scsi_driver(dev->driver);