Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 20 May 2017 00:46:51 +0000 (17:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 20 May 2017 00:46:51 +0000 (17:46 -0700)
Pull SCSI fixes from James Bottomley:
 "This is the first sweep of mostly minor fixes. There's one security
  one: the read past the end of a buffer in qedf, and a panic fix for
  lpfc SLI-3 adapters, but the rest are a set of include and build
  dependency tidy ups and assorted other small fixes and updates"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: pmcraid: remove redundant check to see if request_size is less than zero
  scsi: lpfc: ensure els_wq is being checked before destroying it
  scsi: cxlflash: Select IRQ_POLL
  scsi: qedf: Avoid reading past end of buffer
  scsi: qedf: Cleanup the type of io_log->op
  scsi: lpfc: double lock typo in lpfc_ns_rsp()
  scsi: qedf: properly update arguments position in function call
  scsi: scsi_lib: Add #include <scsi/scsi_transport.h>
  scsi: MAINTAINERS: update OSD entries
  scsi: Skip deleted devices in __scsi_device_lookup
  scsi: lpfc: Fix panic on BFS configuration
  scsi: libfc: do not flood console with messages 'libfc: queue full ...'

13 files changed:
MAINTAINERS
drivers/scsi/cxlflash/Kconfig
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/pmcraid.c
drivers/scsi/qedf/qedf.h
drivers/scsi/qedf/qedf_els.c
drivers/scsi/qedf/qedf_main.c
drivers/scsi/scsi.c
drivers/scsi/scsi_lib.c

index f7d568b8f133d9919e3823c102d7ac78f89c894a..503bcf4e3e8ffd09750bf6ee1b9cce43c7351be6 100644 (file)
@@ -9553,10 +9553,6 @@ F:       drivers/net/wireless/intersil/orinoco/
 
 OSD LIBRARY and FILESYSTEM
 M:     Boaz Harrosh <ooo@electrozaur.com>
-M:     Benny Halevy <bhalevy@primarydata.com>
-L:     osd-dev@open-osd.org
-W:     http://open-osd.org
-T:     git git://git.open-osd.org/open-osd.git
 S:     Maintained
 F:     drivers/scsi/osd/
 F:     include/scsi/osd_*
index c052104e523ee4f7212ce3c70be08509f8f7df5b..a011c5dbf214055315c6bbdd73c814fd752c2bbe 100644 (file)
@@ -5,6 +5,7 @@
 config CXLFLASH
        tristate "Support for IBM CAPI Flash"
        depends on PCI && SCSI && CXL && EEH
+       select IRQ_POLL
        default m
        help
          Allows CAPI Accelerated IO to Flash
index a808e8ef1d08d433ba4b703353d486a4f5ef3564..234352da5c3cebeff0d523bbe3842d297ddd8272 100644 (file)
@@ -407,11 +407,12 @@ unlock:
  * can_queue. Eventually we will hit the point where we run
  * on all reserved structs.
  */
-static void fc_fcp_can_queue_ramp_down(struct fc_lport *lport)
+static bool fc_fcp_can_queue_ramp_down(struct fc_lport *lport)
 {
        struct fc_fcp_internal *si = fc_get_scsi_internal(lport);
        unsigned long flags;
        int can_queue;
+       bool changed = false;
 
        spin_lock_irqsave(lport->host->host_lock, flags);
 
@@ -427,9 +428,11 @@ static void fc_fcp_can_queue_ramp_down(struct fc_lport *lport)
        if (!can_queue)
                can_queue = 1;
        lport->host->can_queue = can_queue;
+       changed = true;
 
 unlock:
        spin_unlock_irqrestore(lport->host->host_lock, flags);
+       return changed;
 }
 
 /*
@@ -1896,11 +1899,11 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd)
 
        if (!fc_fcp_lport_queue_ready(lport)) {
                if (lport->qfull) {
-                       fc_fcp_can_queue_ramp_down(lport);
-                       shost_printk(KERN_ERR, lport->host,
-                                    "libfc: queue full, "
-                                    "reducing can_queue to %d.\n",
-                                    lport->host->can_queue);
+                       if (fc_fcp_can_queue_ramp_down(lport))
+                               shost_printk(KERN_ERR, lport->host,
+                                            "libfc: queue full, "
+                                            "reducing can_queue to %d.\n",
+                                            lport->host->can_queue);
                }
                rc = SCSI_MLQUEUE_HOST_BUSY;
                goto out;
index 944b32ca493144f3fc66d625cc2f960ad484373d..1c55408ac718a94f9aa622210a0ebf96a9896137 100644 (file)
@@ -294,6 +294,7 @@ int lpfc_selective_reset(struct lpfc_hba *);
 void lpfc_reset_barrier(struct lpfc_hba *);
 int lpfc_sli_brdready(struct lpfc_hba *, uint32_t);
 int lpfc_sli_brdkill(struct lpfc_hba *);
+int lpfc_sli_chipset_init(struct lpfc_hba *phba);
 int lpfc_sli_brdreset(struct lpfc_hba *);
 int lpfc_sli_brdrestart(struct lpfc_hba *);
 int lpfc_sli_hba_setup(struct lpfc_hba *);
index 1487406aea778411476b1d95f6c454c790c559bb..c7962dae4dab8c7130dcb46fa1b7d45dac0509eb 100644 (file)
@@ -630,7 +630,7 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type,
                                                NLP_EVT_DEVICE_RECOVERY);
                        spin_lock_irq(shost->host_lock);
                        ndlp->nlp_flag &= ~NLP_NVMET_RECOV;
-                       spin_lock_irq(shost->host_lock);
+                       spin_unlock_irq(shost->host_lock);
                }
        }
 
index 90ae354a9c458c9151b03f6bdff444a248d0da0e..4b1eb98c228df823a986f5568f8b948a7b2ef9bf 100644 (file)
@@ -3602,6 +3602,13 @@ lpfc_get_wwpn(struct lpfc_hba *phba)
        LPFC_MBOXQ_t *mboxq;
        MAILBOX_t *mb;
 
+       if (phba->sli_rev < LPFC_SLI_REV4) {
+               /* Reset the port first */
+               lpfc_sli_brdrestart(phba);
+               rc = lpfc_sli_chipset_init(phba);
+               if (rc)
+                       return (uint64_t)-1;
+       }
 
        mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
                                                GFP_KERNEL);
@@ -8847,7 +8854,7 @@ lpfc_sli4_queue_unset(struct lpfc_hba *phba)
                lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq);
 
        /* Unset ELS work queue */
-       if (phba->sli4_hba.els_cq)
+       if (phba->sli4_hba.els_wq)
                lpfc_wq_destroy(phba, phba->sli4_hba.els_wq);
 
        /* Unset unsolicited receive queue */
index cf19f4976f5fb6338509d85a6e9c4624b9b882b5..2a4fc00dfa9bdc7dbe42d5bed00935abd0a9e398 100644 (file)
@@ -4204,13 +4204,16 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
        /* Reset HBA */
        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
                        "0325 Reset HBA Data: x%x x%x\n",
-                       phba->pport->port_state, psli->sli_flag);
+                       (phba->pport) ? phba->pport->port_state : 0,
+                       psli->sli_flag);
 
        /* perform board reset */
        phba->fc_eventTag = 0;
        phba->link_events = 0;
-       phba->pport->fc_myDID = 0;
-       phba->pport->fc_prevDID = 0;
+       if (phba->pport) {
+               phba->pport->fc_myDID = 0;
+               phba->pport->fc_prevDID = 0;
+       }
 
        /* Turn off parity checking and serr during the physical reset */
        pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value);
@@ -4336,7 +4339,8 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba)
        /* Restart HBA */
        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
                        "0337 Restart HBA Data: x%x x%x\n",
-                       phba->pport->port_state, psli->sli_flag);
+                       (phba->pport) ? phba->pport->port_state : 0,
+                       psli->sli_flag);
 
        word0 = 0;
        mb = (MAILBOX_t *) &word0;
@@ -4350,7 +4354,7 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba)
        readl(to_slim); /* flush */
 
        /* Only skip post after fc_ffinit is completed */
-       if (phba->pport->port_state)
+       if (phba->pport && phba->pport->port_state)
                word0 = 1;      /* This is really setting up word1 */
        else
                word0 = 0;      /* This is really setting up word1 */
@@ -4359,7 +4363,8 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba)
        readl(to_slim); /* flush */
 
        lpfc_sli_brdreset(phba);
-       phba->pport->stopped = 0;
+       if (phba->pport)
+               phba->pport->stopped = 0;
        phba->link_state = LPFC_INIT_START;
        phba->hba_flag = 0;
        spin_unlock_irq(&phba->hbalock);
@@ -4446,7 +4451,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba)
  * iteration, the function will restart the HBA again. The function returns
  * zero if HBA successfully restarted else returns negative error code.
  **/
-static int
+int
 lpfc_sli_chipset_init(struct lpfc_hba *phba)
 {
        uint32_t status, i = 0;
index a4aadf5f4dc61e9d80a5f1382fd63f11d169dd0d..1cc814f1505a3c149133a0c8c5c2f5f556c056d4 100644 (file)
@@ -3770,9 +3770,6 @@ static long pmcraid_ioctl_passthrough(
                        pmcraid_err("couldn't build passthrough ioadls\n");
                        goto out_free_cmd;
                }
-       } else if (request_size < 0) {
-               rc = -EINVAL;
-               goto out_free_cmd;
        }
 
        /* If data is being written into the device, copy the data from user
index 40aeb6bb96a2afd11c3264b7ea0004110033e2d1..07ee88200e91cfc072eed5506c6eca0974dda67f 100644 (file)
@@ -259,7 +259,7 @@ struct qedf_io_log {
        uint16_t task_id;
        uint32_t port_id; /* Remote port fabric ID */
        int lun;
-       char op; /* SCSI CDB */
+       unsigned char op; /* SCSI CDB */
        uint8_t lba[4];
        unsigned int bufflen; /* SCSI buffer length */
        unsigned int sg_count; /* Number of SG elements */
index c505d41f6dc843825fb52fabaaca33e5dd25d1ce..90627033bde600c551af700004858a18ddadaa6c 100644 (file)
@@ -109,7 +109,7 @@ retry_els:
        did = fcport->rdata->ids.port_id;
        sid = fcport->sid;
 
-       __fc_fill_fc_hdr(fc_hdr, FC_RCTL_ELS_REQ, sid, did,
+       __fc_fill_fc_hdr(fc_hdr, FC_RCTL_ELS_REQ, did, sid,
                           FC_TYPE_ELS, FC_FC_FIRST_SEQ | FC_FC_END_SEQ |
                           FC_FC_SEQ_INIT, 0);
 
index cceddd995a4bf46605ae94143cfcff9df693fb83..a5c97342fd5d2bc5f9826d34974e8d7b7c285dd3 100644 (file)
@@ -2895,7 +2895,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
        slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER;
        slowpath_params.drv_rev = QEDF_DRIVER_REV_VER;
        slowpath_params.drv_eng = QEDF_DRIVER_ENG_VER;
-       memcpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE);
+       strncpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE);
        rc = qed_ops->common->slowpath_start(qedf->cdev, &slowpath_params);
        if (rc) {
                QEDF_ERR(&(qedf->dbg_ctx), "Cannot start slowpath.\n");
index 7bfbcfa7af40b7df8bff2a0f38728621ee9f13e0..61cdd99ae41ec7e45a0cf0de604be4e169172368 100644 (file)
@@ -763,6 +763,8 @@ struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost,
        struct scsi_device *sdev;
 
        list_for_each_entry(sdev, &shost->__devices, siblings) {
+               if (sdev->sdev_state == SDEV_DEL)
+                       continue;
                if (sdev->channel == channel && sdev->id == id &&
                                sdev->lun ==lun)
                        return sdev;
index 814a4bd8405dca1a4897edd7f4cb66a163cb2545..e31f1cc90b815b28a332d1a6915c82e19519a62f 100644 (file)
@@ -30,6 +30,7 @@
 #include <scsi/scsi_driver.h>
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport.h> /* __scsi_init_queue() */
 #include <scsi/scsi_dh.h>
 
 #include <trace/events/scsi.h>