Skip to content

Commit

Permalink
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jejb/scsi

Pull more SCSI updates from James Bottomley:
 "This is the set of patches which arrived too late to stabilise in
  -next for the first pull.

  It's really just an lpfc driver update and an assortment of minor
  fixes, all in drivers. The only core update is to the zone block
  device driver, which isn't the one most people use"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: lpfc: Update lpfc version to 12.8.0.3
  scsi: lpfc: Fix LUN loss after cable pull
  scsi: lpfc: Fix validation of bsg reply lengths
  scsi: lpfc: Fix retry of PRLI when status indicates its unsupported
  scsi: lpfc: Fix oops when unloading driver while running mds diags
  scsi: lpfc: Fix RSCN timeout due to incorrect gidft counter
  scsi: lpfc: Fix no message shown for lpfc_hdw_queue out of range value
  scsi: lpfc: Fix FCoE speed reporting
  scsi: lpfc: Add missing misc_deregister() for lpfc_init()
  scsi: lpfc: nvmet: Avoid hang / use-after-free again when destroying targetport
  scsi: scsi_transport_sas: Add spaces around binary operator "|"
  scsi: sd_zbc: Improve zone revalidation
  scsi: libfc: Free skb in fc_disc_gpn_id_resp() for valid cases
  scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
  scsi: target: Make iscsit_register_transport() return void
  • Loading branch information
torvalds committed Aug 14, 2020
2 parents fded091 + 7e0e8be commit c9c9735
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 98 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/fcoe/fcoe_ctlr.c
Expand Up @@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
WARN_ON(!fcf_dev);
new->fcf_dev = NULL;
fcoe_fcf_device_delete(fcf_dev);
kfree(new);
mutex_unlock(&cdev->lock);
}
kfree(new);
}

/**
Expand Down
12 changes: 9 additions & 3 deletions drivers/scsi/libfc/fc_disc.c
Expand Up @@ -581,8 +581,12 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,

if (PTR_ERR(fp) == -FC_EX_CLOSED)
goto out;
if (IS_ERR(fp))
goto redisc;
if (IS_ERR(fp)) {
mutex_lock(&disc->disc_mutex);
fc_disc_restart(disc);
mutex_unlock(&disc->disc_mutex);
goto out;
}

cp = fc_frame_payload_get(fp, sizeof(*cp));
if (!cp)
Expand All @@ -609,7 +613,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
new_rdata->disc_id = disc->disc_id;
fc_rport_login(new_rdata);
}
goto out;
goto free_fp;
}
rdata->disc_id = disc->disc_id;
mutex_unlock(&rdata->rp_mutex);
Expand All @@ -626,6 +630,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
fc_disc_restart(disc);
mutex_unlock(&disc->disc_mutex);
}
free_fp:
fc_frame_free(fp);
out:
kref_put(&rdata->kref, fc_rport_destroy);
if (!IS_ERR(fp))
Expand Down
26 changes: 23 additions & 3 deletions drivers/scsi/lpfc/lpfc_attr.c
Expand Up @@ -6679,9 +6679,15 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
}
} else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) {
switch (phba->fc_linkspeed) {
case LPFC_ASYNC_LINK_SPEED_1GBPS:
fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
break;
case LPFC_ASYNC_LINK_SPEED_10GBPS:
fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
break;
case LPFC_ASYNC_LINK_SPEED_20GBPS:
fc_host_speed(shost) = FC_PORTSPEED_20GBIT;
break;
case LPFC_ASYNC_LINK_SPEED_25GBPS:
fc_host_speed(shost) = FC_PORTSPEED_25GBIT;
break;
Expand Down Expand Up @@ -7406,12 +7412,26 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
void
lpfc_nvme_mod_param_dep(struct lpfc_hba *phba)
{
if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu)
int logit = 0;

if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) {
phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu;
if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu)
logit = 1;
}
if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) {
phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu;
if (phba->cfg_irq_chann > phba->cfg_hdw_queue)
logit = 1;
}
if (phba->cfg_irq_chann > phba->cfg_hdw_queue) {
phba->cfg_irq_chann = phba->cfg_hdw_queue;
logit = 1;
}
if (logit)
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2006 Reducing Queues - CPU limitation: "
"IRQ %d HDWQ %d\n",
phba->cfg_irq_chann,
phba->cfg_hdw_queue);

if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME &&
phba->nvmet_support) {
Expand Down
21 changes: 8 additions & 13 deletions drivers/scsi/lpfc/lpfc_bsg.c
Expand Up @@ -2494,13 +2494,12 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job)
diag_status_reply = (struct diag_status *)
bsg_reply->reply_data.vendor_reply.vendor_rsp;

if (job->reply_len <
sizeof(struct fc_bsg_request) + sizeof(struct diag_status)) {
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*diag_status_reply)) {
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
"3012 Received Run link diag test reply "
"below minimum size (%d): reply_len:%d\n",
(int)(sizeof(struct fc_bsg_request) +
sizeof(struct diag_status)),
(int)(sizeof(*bsg_reply) +
sizeof(*diag_status_reply)),
job->reply_len);
rc = -EINVAL;
goto job_error;
Expand Down Expand Up @@ -3418,8 +3417,7 @@ lpfc_bsg_get_dfc_rev(struct bsg_job *job)
event_reply = (struct get_mgmt_rev_reply *)
bsg_reply->reply_data.vendor_reply.vendor_rsp;

if (job->reply_len <
sizeof(struct fc_bsg_request) + sizeof(struct get_mgmt_rev_reply)) {
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) {
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
"2741 Received GET_DFC_REV reply below "
"minimum size\n");
Expand Down Expand Up @@ -5202,8 +5200,8 @@ lpfc_menlo_cmd(struct bsg_job *job)
goto no_dd_data;
}

if (job->reply_len <
sizeof(struct fc_bsg_request) + sizeof(struct menlo_response)) {
if (job->reply_len < sizeof(*bsg_reply) +
sizeof(struct menlo_response)) {
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
"2785 Received MENLO_CMD reply below "
"minimum size\n");
Expand Down Expand Up @@ -5359,9 +5357,7 @@ lpfc_forced_link_speed(struct bsg_job *job)
forced_reply = (struct forced_link_speed_support_reply *)
bsg_reply->reply_data.vendor_reply.vendor_rsp;

if (job->reply_len <
sizeof(struct fc_bsg_request) +
sizeof(struct forced_link_speed_support_reply)) {
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*forced_reply)) {
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
"0049 Received FORCED_LINK_SPEED reply below "
"minimum size\n");
Expand Down Expand Up @@ -5715,8 +5711,7 @@ lpfc_get_trunk_info(struct bsg_job *job)
event_reply = (struct lpfc_trunk_info *)
bsg_reply->reply_data.vendor_reply.vendor_rsp;

if (job->reply_len <
sizeof(struct fc_bsg_request) + sizeof(struct lpfc_trunk_info)) {
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) {
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
"2728 Received GET TRUNK _INFO reply below "
"minimum size\n");
Expand Down
22 changes: 16 additions & 6 deletions drivers/scsi/lpfc/lpfc_ct.c
Expand Up @@ -713,7 +713,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* This is a GID_FT completing so the gidft_inp counter was
* incremented before the GID_FT was issued to the wire.
*/
vport->gidft_inp--;
if (vport->gidft_inp)
vport->gidft_inp--;

/*
* Skip processing the NS response
Expand Down Expand Up @@ -741,11 +742,14 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
goto out;

/* CT command is being retried */
vport->gidft_inp--;
rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT,
vport->fc_ns_retry, type);
if (rc == 0)
goto out;
else { /* Unable to send NS cmd */
if (vport->gidft_inp)
vport->gidft_inp--;
}
}
if (vport->fc_flag & FC_RSCN_MODE)
lpfc_els_flush_rscn(vport);
Expand Down Expand Up @@ -825,7 +829,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
(uint32_t) CTrsp->ReasonCode,
(uint32_t) CTrsp->Explanation);
}
vport->gidft_inp--;
if (vport->gidft_inp)
vport->gidft_inp--;
}

lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
Expand Down Expand Up @@ -918,7 +923,8 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* This is a GID_PT completing so the gidft_inp counter was
* incremented before the GID_PT was issued to the wire.
*/
vport->gidft_inp--;
if (vport->gidft_inp)
vport->gidft_inp--;

/*
* Skip processing the NS response
Expand All @@ -942,11 +948,14 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
vport->fc_ns_retry++;

/* CT command is being retried */
vport->gidft_inp--;
rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_PT,
vport->fc_ns_retry, GID_PT_N_PORT);
if (rc == 0)
goto out;
else { /* Unable to send NS cmd */
if (vport->gidft_inp)
vport->gidft_inp--;
}
}
if (vport->fc_flag & FC_RSCN_MODE)
lpfc_els_flush_rscn(vport);
Expand Down Expand Up @@ -1027,7 +1036,8 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
(uint32_t)CTrsp->ReasonCode,
(uint32_t)CTrsp->Explanation);
}
vport->gidft_inp--;
if (vport->gidft_inp)
vport->gidft_inp--;
}

lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
Expand Down
10 changes: 7 additions & 3 deletions drivers/scsi/lpfc/lpfc_els.c
Expand Up @@ -3937,10 +3937,14 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
case LSRJT_UNABLE_TPC:
/* The driver has a VALID PLOGI but the rport has
* rejected the PRLI - can't do it now. Delay
* for 1 second and try again - don't care about
* the explanation.
* for 1 second and try again.
*
* However, if explanation is REQ_UNSUPPORTED there's
* no point to retry PRLI.
*/
if (cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) {
if ((cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) &&
stat.un.b.lsRjtRsnCodeExp !=
LSEXP_REQ_UNSUPPORTED) {
delay = 1000;
maxretry = lpfc_max_els_tries + 1;
retry = 1;
Expand Down
25 changes: 20 additions & 5 deletions drivers/scsi/lpfc/lpfc_init.c
Expand Up @@ -4577,6 +4577,13 @@ static void lpfc_host_supported_speeds_set(struct Scsi_Host *shost)
struct lpfc_hba *phba = vport->phba;

fc_host_supported_speeds(shost) = 0;
/*
* Avoid reporting supported link speed for FCoE as it can't be
* controlled via FCoE.
*/
if (phba->hba_flag & HBA_FCOE_MODE)
return;

if (phba->lmt & LMT_128Gb)
fc_host_supported_speeds(shost) |= FC_PORTSPEED_128GBIT;
if (phba->lmt & LMT_64Gb)
Expand Down Expand Up @@ -4910,6 +4917,9 @@ lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code,
case LPFC_ASYNC_LINK_SPEED_40GBPS:
port_speed = 40000;
break;
case LPFC_ASYNC_LINK_SPEED_100GBPS:
port_speed = 100000;
break;
default:
port_speed = 0;
}
Expand Down Expand Up @@ -8589,7 +8599,7 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
"VPI(B:%d M:%d) "
"VFI(B:%d M:%d) "
"RPI(B:%d M:%d) "
"FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d\n",
"FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d lmt:x%x\n",
phba->sli4_hba.extents_in_use,
phba->sli4_hba.max_cfg_param.xri_base,
phba->sli4_hba.max_cfg_param.max_xri,
Expand All @@ -8603,7 +8613,8 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
phba->sli4_hba.max_cfg_param.max_eq,
phba->sli4_hba.max_cfg_param.max_cq,
phba->sli4_hba.max_cfg_param.max_wq,
phba->sli4_hba.max_cfg_param.max_rq);
phba->sli4_hba.max_cfg_param.max_rq,
phba->lmt);

/*
* Calculate queue resources based on how
Expand All @@ -8626,7 +8637,8 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
if ((phba->cfg_irq_chann > qmin) ||
(phba->cfg_hdw_queue > qmin)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2005 Reducing Queues: "
"2005 Reducing Queues - "
"FW resource limitation: "
"WQ %d CQ %d EQ %d: min %d: "
"IRQ %d HDWQ %d\n",
phba->sli4_hba.max_cfg_param.max_wq,
Expand Down Expand Up @@ -14100,17 +14112,18 @@ lpfc_init(void)
printk(KERN_ERR "Could not register lpfcmgmt device, "
"misc_register returned with status %d", error);

error = -ENOMEM;
lpfc_transport_functions.vport_create = lpfc_vport_create;
lpfc_transport_functions.vport_delete = lpfc_vport_delete;
lpfc_transport_template =
fc_attach_transport(&lpfc_transport_functions);
if (lpfc_transport_template == NULL)
return -ENOMEM;
goto unregister;
lpfc_vport_transport_template =
fc_attach_transport(&lpfc_vport_transport_functions);
if (lpfc_vport_transport_template == NULL) {
fc_release_transport(lpfc_transport_template);
return -ENOMEM;
goto unregister;
}
lpfc_nvme_cmd_template();
lpfc_nvmet_cmd_template();
Expand All @@ -14136,6 +14149,8 @@ lpfc_init(void)
cpuhp_failure:
fc_release_transport(lpfc_transport_template);
fc_release_transport(lpfc_vport_transport_template);
unregister:
misc_deregister(&lpfc_mgmt_dev);

return error;
}
Expand Down
8 changes: 7 additions & 1 deletion drivers/scsi/lpfc/lpfc_nportdisc.c
Expand Up @@ -1745,7 +1745,13 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_vport *vport,
}
}

if (ndlp->nlp_type & NLP_FCP_TARGET) {
if (ndlp->nlp_type & NLP_FCP_TARGET)
ndlp->nlp_fc4_type |= NLP_FC4_FCP;

if (ndlp->nlp_type & NLP_NVME_TARGET)
ndlp->nlp_fc4_type |= NLP_FC4_NVME;

if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) {
ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_MAPPED_NODE);
} else {
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/lpfc/lpfc_nvmet.c
Expand Up @@ -2110,7 +2110,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
}
tgtp->tport_unreg_cmp = &tport_unreg_cmp;
nvmet_fc_unregister_targetport(phba->targetport);
if (!wait_for_completion_timeout(tgtp->tport_unreg_cmp,
if (!wait_for_completion_timeout(&tport_unreg_cmp,
msecs_to_jiffies(LPFC_NVMET_WAIT_TMO)))
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6179 Unreg targetport x%px timeout "
Expand Down
11 changes: 9 additions & 2 deletions drivers/scsi/lpfc/lpfc_sli.c
Expand Up @@ -13650,7 +13650,11 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
spin_unlock_irqrestore(&phba->hbalock, iflags);
/* Handle MDS Loopback frames */
lpfc_sli4_handle_mds_loopback(phba->pport, dma_buf);
if (!(phba->pport->load_flag & FC_UNLOADING))
lpfc_sli4_handle_mds_loopback(phba->pport,
dma_buf);
else
lpfc_in_buf_free(phba, &dma_buf->dbuf);
break;
}

Expand Down Expand Up @@ -18363,7 +18367,10 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
vport = phba->pport;
/* Handle MDS Loopback frames */
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
if (!(phba->pport->load_flag & FC_UNLOADING))
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
else
lpfc_in_buf_free(phba, &dmabuf->dbuf);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/lpfc/lpfc_version.h
Expand Up @@ -20,7 +20,7 @@
* included with this package. *
*******************************************************************/

#define LPFC_DRIVER_VERSION "12.8.0.2"
#define LPFC_DRIVER_VERSION "12.8.0.3"
#define LPFC_DRIVER_NAME "lpfc"

/* Used for SLI 2/3 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/scsi_transport_sas.c
Expand Up @@ -1526,7 +1526,7 @@ int sas_rphy_add(struct sas_rphy *rphy)
list_add_tail(&rphy->list, &sas_host->rphy_list);
if (identify->device_type == SAS_END_DEVICE &&
(identify->target_port_protocols &
(SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA)))
(SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA)))
rphy->scsi_target_id = sas_host->next_target_id++;
else if (identify->device_type == SAS_END_DEVICE)
rphy->scsi_target_id = -1;
Expand Down

0 comments on commit c9c9735

Please sign in to comment.