Skip to content

Commit c9c9735

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/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
2 parents fded091 + 7e0e8be commit c9c9735

File tree

17 files changed

+165
-98
lines changed

17 files changed

+165
-98
lines changed

drivers/scsi/fcoe/fcoe_ctlr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
256256
WARN_ON(!fcf_dev);
257257
new->fcf_dev = NULL;
258258
fcoe_fcf_device_delete(fcf_dev);
259-
kfree(new);
260259
mutex_unlock(&cdev->lock);
261260
}
261+
kfree(new);
262262
}
263263

264264
/**

drivers/scsi/libfc/fc_disc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,12 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
581581

582582
if (PTR_ERR(fp) == -FC_EX_CLOSED)
583583
goto out;
584-
if (IS_ERR(fp))
585-
goto redisc;
584+
if (IS_ERR(fp)) {
585+
mutex_lock(&disc->disc_mutex);
586+
fc_disc_restart(disc);
587+
mutex_unlock(&disc->disc_mutex);
588+
goto out;
589+
}
586590

587591
cp = fc_frame_payload_get(fp, sizeof(*cp));
588592
if (!cp)
@@ -609,7 +613,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
609613
new_rdata->disc_id = disc->disc_id;
610614
fc_rport_login(new_rdata);
611615
}
612-
goto out;
616+
goto free_fp;
613617
}
614618
rdata->disc_id = disc->disc_id;
615619
mutex_unlock(&rdata->rp_mutex);
@@ -626,6 +630,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
626630
fc_disc_restart(disc);
627631
mutex_unlock(&disc->disc_mutex);
628632
}
633+
free_fp:
634+
fc_frame_free(fp);
629635
out:
630636
kref_put(&rdata->kref, fc_rport_destroy);
631637
if (!IS_ERR(fp))

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6679,9 +6679,15 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
66796679
}
66806680
} else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) {
66816681
switch (phba->fc_linkspeed) {
6682+
case LPFC_ASYNC_LINK_SPEED_1GBPS:
6683+
fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
6684+
break;
66826685
case LPFC_ASYNC_LINK_SPEED_10GBPS:
66836686
fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
66846687
break;
6688+
case LPFC_ASYNC_LINK_SPEED_20GBPS:
6689+
fc_host_speed(shost) = FC_PORTSPEED_20GBIT;
6690+
break;
66856691
case LPFC_ASYNC_LINK_SPEED_25GBPS:
66866692
fc_host_speed(shost) = FC_PORTSPEED_25GBIT;
66876693
break;
@@ -7406,12 +7412,26 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
74067412
void
74077413
lpfc_nvme_mod_param_dep(struct lpfc_hba *phba)
74087414
{
7409-
if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu)
7415+
int logit = 0;
7416+
7417+
if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) {
74107418
phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu;
7411-
if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu)
7419+
logit = 1;
7420+
}
7421+
if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) {
74127422
phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu;
7413-
if (phba->cfg_irq_chann > phba->cfg_hdw_queue)
7423+
logit = 1;
7424+
}
7425+
if (phba->cfg_irq_chann > phba->cfg_hdw_queue) {
74147426
phba->cfg_irq_chann = phba->cfg_hdw_queue;
7427+
logit = 1;
7428+
}
7429+
if (logit)
7430+
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
7431+
"2006 Reducing Queues - CPU limitation: "
7432+
"IRQ %d HDWQ %d\n",
7433+
phba->cfg_irq_chann,
7434+
phba->cfg_hdw_queue);
74157435

74167436
if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME &&
74177437
phba->nvmet_support) {

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,13 +2494,12 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job)
24942494
diag_status_reply = (struct diag_status *)
24952495
bsg_reply->reply_data.vendor_reply.vendor_rsp;
24962496

2497-
if (job->reply_len <
2498-
sizeof(struct fc_bsg_request) + sizeof(struct diag_status)) {
2497+
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*diag_status_reply)) {
24992498
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
25002499
"3012 Received Run link diag test reply "
25012500
"below minimum size (%d): reply_len:%d\n",
2502-
(int)(sizeof(struct fc_bsg_request) +
2503-
sizeof(struct diag_status)),
2501+
(int)(sizeof(*bsg_reply) +
2502+
sizeof(*diag_status_reply)),
25042503
job->reply_len);
25052504
rc = -EINVAL;
25062505
goto job_error;
@@ -3418,8 +3417,7 @@ lpfc_bsg_get_dfc_rev(struct bsg_job *job)
34183417
event_reply = (struct get_mgmt_rev_reply *)
34193418
bsg_reply->reply_data.vendor_reply.vendor_rsp;
34203419

3421-
if (job->reply_len <
3422-
sizeof(struct fc_bsg_request) + sizeof(struct get_mgmt_rev_reply)) {
3420+
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) {
34233421
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
34243422
"2741 Received GET_DFC_REV reply below "
34253423
"minimum size\n");
@@ -5202,8 +5200,8 @@ lpfc_menlo_cmd(struct bsg_job *job)
52025200
goto no_dd_data;
52035201
}
52045202

5205-
if (job->reply_len <
5206-
sizeof(struct fc_bsg_request) + sizeof(struct menlo_response)) {
5203+
if (job->reply_len < sizeof(*bsg_reply) +
5204+
sizeof(struct menlo_response)) {
52075205
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
52085206
"2785 Received MENLO_CMD reply below "
52095207
"minimum size\n");
@@ -5359,9 +5357,7 @@ lpfc_forced_link_speed(struct bsg_job *job)
53595357
forced_reply = (struct forced_link_speed_support_reply *)
53605358
bsg_reply->reply_data.vendor_reply.vendor_rsp;
53615359

5362-
if (job->reply_len <
5363-
sizeof(struct fc_bsg_request) +
5364-
sizeof(struct forced_link_speed_support_reply)) {
5360+
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*forced_reply)) {
53655361
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
53665362
"0049 Received FORCED_LINK_SPEED reply below "
53675363
"minimum size\n");
@@ -5715,8 +5711,7 @@ lpfc_get_trunk_info(struct bsg_job *job)
57155711
event_reply = (struct lpfc_trunk_info *)
57165712
bsg_reply->reply_data.vendor_reply.vendor_rsp;
57175713

5718-
if (job->reply_len <
5719-
sizeof(struct fc_bsg_request) + sizeof(struct lpfc_trunk_info)) {
5714+
if (job->reply_len < sizeof(*bsg_reply) + sizeof(*event_reply)) {
57205715
lpfc_printf_log(phba, KERN_WARNING, LOG_LIBDFC,
57215716
"2728 Received GET TRUNK _INFO reply below "
57225717
"minimum size\n");

drivers/scsi/lpfc/lpfc_ct.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
713713
/* This is a GID_FT completing so the gidft_inp counter was
714714
* incremented before the GID_FT was issued to the wire.
715715
*/
716-
vport->gidft_inp--;
716+
if (vport->gidft_inp)
717+
vport->gidft_inp--;
717718

718719
/*
719720
* Skip processing the NS response
@@ -741,11 +742,14 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
741742
goto out;
742743

743744
/* CT command is being retried */
744-
vport->gidft_inp--;
745745
rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_FT,
746746
vport->fc_ns_retry, type);
747747
if (rc == 0)
748748
goto out;
749+
else { /* Unable to send NS cmd */
750+
if (vport->gidft_inp)
751+
vport->gidft_inp--;
752+
}
749753
}
750754
if (vport->fc_flag & FC_RSCN_MODE)
751755
lpfc_els_flush_rscn(vport);
@@ -825,7 +829,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
825829
(uint32_t) CTrsp->ReasonCode,
826830
(uint32_t) CTrsp->Explanation);
827831
}
828-
vport->gidft_inp--;
832+
if (vport->gidft_inp)
833+
vport->gidft_inp--;
829834
}
830835

831836
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
@@ -918,7 +923,8 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
918923
/* This is a GID_PT completing so the gidft_inp counter was
919924
* incremented before the GID_PT was issued to the wire.
920925
*/
921-
vport->gidft_inp--;
926+
if (vport->gidft_inp)
927+
vport->gidft_inp--;
922928

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

944950
/* CT command is being retried */
945-
vport->gidft_inp--;
946951
rc = lpfc_ns_cmd(vport, SLI_CTNS_GID_PT,
947952
vport->fc_ns_retry, GID_PT_N_PORT);
948953
if (rc == 0)
949954
goto out;
955+
else { /* Unable to send NS cmd */
956+
if (vport->gidft_inp)
957+
vport->gidft_inp--;
958+
}
950959
}
951960
if (vport->fc_flag & FC_RSCN_MODE)
952961
lpfc_els_flush_rscn(vport);
@@ -1027,7 +1036,8 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
10271036
(uint32_t)CTrsp->ReasonCode,
10281037
(uint32_t)CTrsp->Explanation);
10291038
}
1030-
vport->gidft_inp--;
1039+
if (vport->gidft_inp)
1040+
vport->gidft_inp--;
10311041
}
10321042

10331043
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3937,10 +3937,14 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
39373937
case LSRJT_UNABLE_TPC:
39383938
/* The driver has a VALID PLOGI but the rport has
39393939
* rejected the PRLI - can't do it now. Delay
3940-
* for 1 second and try again - don't care about
3941-
* the explanation.
3940+
* for 1 second and try again.
3941+
*
3942+
* However, if explanation is REQ_UNSUPPORTED there's
3943+
* no point to retry PRLI.
39423944
*/
3943-
if (cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) {
3945+
if ((cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) &&
3946+
stat.un.b.lsRjtRsnCodeExp !=
3947+
LSEXP_REQ_UNSUPPORTED) {
39443948
delay = 1000;
39453949
maxretry = lpfc_max_els_tries + 1;
39463950
retry = 1;

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4577,6 +4577,13 @@ static void lpfc_host_supported_speeds_set(struct Scsi_Host *shost)
45774577
struct lpfc_hba *phba = vport->phba;
45784578

45794579
fc_host_supported_speeds(shost) = 0;
4580+
/*
4581+
* Avoid reporting supported link speed for FCoE as it can't be
4582+
* controlled via FCoE.
4583+
*/
4584+
if (phba->hba_flag & HBA_FCOE_MODE)
4585+
return;
4586+
45804587
if (phba->lmt & LMT_128Gb)
45814588
fc_host_supported_speeds(shost) |= FC_PORTSPEED_128GBIT;
45824589
if (phba->lmt & LMT_64Gb)
@@ -4910,6 +4917,9 @@ lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code,
49104917
case LPFC_ASYNC_LINK_SPEED_40GBPS:
49114918
port_speed = 40000;
49124919
break;
4920+
case LPFC_ASYNC_LINK_SPEED_100GBPS:
4921+
port_speed = 100000;
4922+
break;
49134923
default:
49144924
port_speed = 0;
49154925
}
@@ -8589,7 +8599,7 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
85898599
"VPI(B:%d M:%d) "
85908600
"VFI(B:%d M:%d) "
85918601
"RPI(B:%d M:%d) "
8592-
"FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d\n",
8602+
"FCFI:%d EQ:%d CQ:%d WQ:%d RQ:%d lmt:x%x\n",
85938603
phba->sli4_hba.extents_in_use,
85948604
phba->sli4_hba.max_cfg_param.xri_base,
85958605
phba->sli4_hba.max_cfg_param.max_xri,
@@ -8603,7 +8613,8 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
86038613
phba->sli4_hba.max_cfg_param.max_eq,
86048614
phba->sli4_hba.max_cfg_param.max_cq,
86058615
phba->sli4_hba.max_cfg_param.max_wq,
8606-
phba->sli4_hba.max_cfg_param.max_rq);
8616+
phba->sli4_hba.max_cfg_param.max_rq,
8617+
phba->lmt);
86078618

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

14115+
error = -ENOMEM;
1410314116
lpfc_transport_functions.vport_create = lpfc_vport_create;
1410414117
lpfc_transport_functions.vport_delete = lpfc_vport_delete;
1410514118
lpfc_transport_template =
1410614119
fc_attach_transport(&lpfc_transport_functions);
1410714120
if (lpfc_transport_template == NULL)
14108-
return -ENOMEM;
14121+
goto unregister;
1410914122
lpfc_vport_transport_template =
1411014123
fc_attach_transport(&lpfc_vport_transport_functions);
1411114124
if (lpfc_vport_transport_template == NULL) {
1411214125
fc_release_transport(lpfc_transport_template);
14113-
return -ENOMEM;
14126+
goto unregister;
1411414127
}
1411514128
lpfc_nvme_cmd_template();
1411614129
lpfc_nvmet_cmd_template();
@@ -14136,6 +14149,8 @@ lpfc_init(void)
1413614149
cpuhp_failure:
1413714150
fc_release_transport(lpfc_transport_template);
1413814151
fc_release_transport(lpfc_vport_transport_template);
14152+
unregister:
14153+
misc_deregister(&lpfc_mgmt_dev);
1413914154

1414014155
return error;
1414114156
}

drivers/scsi/lpfc/lpfc_nportdisc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,13 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_vport *vport,
17451745
}
17461746
}
17471747

1748-
if (ndlp->nlp_type & NLP_FCP_TARGET) {
1748+
if (ndlp->nlp_type & NLP_FCP_TARGET)
1749+
ndlp->nlp_fc4_type |= NLP_FC4_FCP;
1750+
1751+
if (ndlp->nlp_type & NLP_NVME_TARGET)
1752+
ndlp->nlp_fc4_type |= NLP_FC4_NVME;
1753+
1754+
if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) {
17491755
ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
17501756
lpfc_nlp_set_state(vport, ndlp, NLP_STE_MAPPED_NODE);
17511757
} else {

drivers/scsi/lpfc/lpfc_nvmet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
21102110
}
21112111
tgtp->tport_unreg_cmp = &tport_unreg_cmp;
21122112
nvmet_fc_unregister_targetport(phba->targetport);
2113-
if (!wait_for_completion_timeout(tgtp->tport_unreg_cmp,
2113+
if (!wait_for_completion_timeout(&tport_unreg_cmp,
21142114
msecs_to_jiffies(LPFC_NVMET_WAIT_TMO)))
21152115
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
21162116
"6179 Unreg targetport x%px timeout "

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13650,7 +13650,11 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
1365013650
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
1365113651
spin_unlock_irqrestore(&phba->hbalock, iflags);
1365213652
/* Handle MDS Loopback frames */
13653-
lpfc_sli4_handle_mds_loopback(phba->pport, dma_buf);
13653+
if (!(phba->pport->load_flag & FC_UNLOADING))
13654+
lpfc_sli4_handle_mds_loopback(phba->pport,
13655+
dma_buf);
13656+
else
13657+
lpfc_in_buf_free(phba, &dma_buf->dbuf);
1365413658
break;
1365513659
}
1365613660

@@ -18363,7 +18367,10 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
1836318367
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
1836418368
vport = phba->pport;
1836518369
/* Handle MDS Loopback frames */
18366-
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
18370+
if (!(phba->pport->load_flag & FC_UNLOADING))
18371+
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
18372+
else
18373+
lpfc_in_buf_free(phba, &dmabuf->dbuf);
1836718374
return;
1836818375
}
1836918376

0 commit comments

Comments
 (0)