SCSI fixes for 5.17-rc1
Subsystems (4)
James Bottomley
maintainerSeven fixes, six of which are fairly obvious driver fixes. The one core change to the device budget depth is to try to ensure that if the default depth is large (which can produce quite a sizeable bitmap allocation per device), we give back the memory we don't need if there's a queue size reduction in slave_configure (which happens to a lot of devices).
The patch is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes
The short changelog is:
Ajish Koshy (1):
scsi: pm80xx: Fix double completion for SATA devices
John Garry (4):
scsi: hisi_sas: Fix setting of hisi_sas_slot.is_internal
scsi: pm8001: Fix use-after-free for aborted SSP/STP sas_task
scsi: pm8001: Fix use-after-free for aborted TMF sas_task
scsi: pm8001: Fix warning for undescribed param in process_one_iomb()
John Meneghini (1):
scsi: bnx2fc: Make bnx2fc_recv_frame() mp safe
Ming Lei (1):
scsi: core: Reallocate device's budget map on queue depth change
And the diffstat:
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 21 ++++++++----- drivers/scsi/hisi_sas/hisi_sas_main.c | 14 ++++----- drivers/scsi/pm8001/pm8001_hwi.c | 18 ------------ drivers/scsi/pm8001/pm8001_sas.c | 5 ++++ drivers/scsi/pm8001/pm80xx_hwi.c | 31 ++------------------ drivers/scsi/scsi_scan.c | 55 +++++++++++++++++++++++++++++++---- 6 files changed, 77 insertions(+), 67 deletions(-)
With full diff below.
James
---
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +13 -8
@@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg)static void bnx2fc_recv_frame (struct sk_buff *skb) { -u32 fr_len; +u64 crc_err; +u32 fr_len, fr_crc;struct fc_lport *lport;struct fcoe_rcv_info *fr;struct fc_stats *stats;
@@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)skb_pull (skb,sizeof (struct fcoe_hdr )); fr_len = skb->len -sizeof (struct fcoe_crc_eof ); + stats =per_cpu_ptr (lport->stats,get_cpu ()); + stats->RxFrames++; + stats->RxWords += fr_len /FCOE_WORD_TO_BYTE ; +put_cpu (); + fp = (struct fc_frame *)skb;fc_frame_init (fp);fr_dev (fp) = lport;
@@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)return ; } - stats =per_cpu_ptr (lport->stats,smp_processor_id ()); - stats->RxFrames++; - stats->RxWords += fr_len /FCOE_WORD_TO_BYTE ; + fr_crc =le32_to_cpu (fr_crc (fp)); -if (le32_to_cpu (fr_crc (fp)) != - ~crc32 (~0 , skb->data, fr_len)) { -if (stats->InvalidCRCCount <5 ) +if (unlikely (fr_crc != ~crc32 (~0 , skb->data, fr_len))) { + stats =per_cpu_ptr (lport->stats,get_cpu ()); + crc_err = (stats->InvalidCRCCount++); +put_cpu (); +if (crc_err <5 ) printk(KERN_WARNING PFX "dropping frame with ""CRC error\n" ); - stats->InvalidCRCCount++;kfree_skb (skb);return ; }
drivers/scsi/hisi_sas/hisi_sas_main.c +6 -8
@@ -400,8 +400,7 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,struct hisi_sas_slot *slot, struct hisi_sas_dq *dq, struct hisi_sas_device *sas_dev, - struct hisi_sas_internal_abort *abort, - struct hisi_sas_tmf_task *tmf) + struct hisi_sas_internal_abort *abort) { struct hisi_sas_cmd_hdr *cmd_hdr_base;int dlvry_queue_slot, dlvry_queue;
@@ -427,8 +426,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba, cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue]; slot->cmd_hdr = &cmd_hdr_base[dlvry_queue_slot]; - slot->tmf = tmf; - slot->is_internal = tmf; task->lldd_task = slot;memset (slot->cmd_hdr,0 ,sizeof (struct hisi_sas_cmd_hdr ));
@@ -587,7 +584,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, slot->is_internal = tmf;/* protect task_prep and start_delivery sequence */ -hisi_sas_task_deliver (hisi_hba, slot, dq, sas_dev,NULL , tmf); +hisi_sas_task_deliver (hisi_hba, slot, dq, sas_dev,NULL );return 0 ;
@@ -1380,12 +1377,13 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)struct hisi_hba *hisi_hba =dev_to_hisi_hba (device);struct device *dev = hisi_hba->dev;int s =sizeof (struct host_to_dev_fis ); +struct hisi_sas_tmf_task tmf = {};ata_for_each_link (link, ap,EDGE ) {int pmp =sata_srst_pmp (link);hisi_sas_fill_ata_reset_cmd (link->device,1 , pmp, fis); - rc =hisi_sas_exec_internal_tmf_task (device, fis, s,NULL ); + rc =hisi_sas_exec_internal_tmf_task (device, fis, s, &tmf);if (rc !=TMF_RESP_FUNC_COMPLETE )break ; }
@@ -1396,7 +1394,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)hisi_sas_fill_ata_reset_cmd (link->device,0 , pmp, fis); rc =hisi_sas_exec_internal_tmf_task (device, fis, - s,NULL ); + s, &tmf);if (rc !=TMF_RESP_FUNC_COMPLETE )dev_err (dev,"ata disk %016llx de-reset failed\n" ,SAS_ADDR (device->sas_addr));
@@ -2067,7 +2065,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, slot->port = port; slot->is_internal = true; -hisi_sas_task_deliver (hisi_hba, slot, dq, sas_dev, abort,NULL ); +hisi_sas_task_deliver (hisi_hba, slot, dq, sas_dev, abort);return 0 ;
drivers/scsi/pm8001/pm8001_hwi.c +0 -18
@@ -2692,7 +2692,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)u32 tag =le32_to_cpu (psataPayload->tag);u32 port_id =le32_to_cpu (psataPayload->port_id);u32 dev_id =le32_to_cpu (psataPayload->device_id); -unsigned long flags;if (event)pm8001_dbg (pm8001_ha,FAIL ,"SATA EVENT 0x%x\n" , event);
@@ -2724,8 +2723,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DATA_OVERRUN ; ts->residual =0 ; -if (pm8001_dev) -atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_BREAK :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_BREAK\n" );
@@ -2767,7 +2764,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_QUEUE_FULL ; -pm8001_ccb_task_free_done (pm8001_ha, t, ccb, tag);return ; }break ;
@@ -2853,20 +2849,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->stat =SAS_OPEN_TO ;break ; } -spin_lock_irqsave (&t->task_state_lock, flags); - t->task_state_flags &= ~SAS_TASK_STATE_PENDING ; - t->task_state_flags &= ~SAS_TASK_AT_INITIATOR ; - t->task_state_flags |=SAS_TASK_STATE_DONE ; -if (unlikely ((t->task_state_flags &SAS_TASK_STATE_ABORTED ))) { -spin_unlock_irqrestore (&t->task_state_lock, flags); -pm8001_dbg (pm8001_ha,FAIL , -"task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n" , - t, event, ts->resp, ts->stat); -pm8001_ccb_task_free (pm8001_ha, t, ccb, tag); - }else { -spin_unlock_irqrestore (&t->task_state_lock, flags); -pm8001_ccb_task_free_done (pm8001_ha, t, ccb, tag); - } }/*See the comments for mpi_ssp_completion */
drivers/scsi/pm8001/pm8001_sas.c +5 -0
@@ -769,8 +769,13 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, res = -TMF_RESP_FUNC_FAILED ;/* Even TMF timed out, return direct. */ if (task->task_state_flags &SAS_TASK_STATE_ABORTED ) { +struct pm8001_ccb_info *ccb = task->lldd_task; +pm8001_dbg (pm8001_ha,FAIL ,"TMF task[%x]timeout.\n" , tmf->tmf); + +if (ccb) + ccb->task =NULL ; goto ex_err; }
drivers/scsi/pm8001/pm80xx_hwi.c +3 -28
@@ -2185,9 +2185,9 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_dbg (pm8001_ha,FAIL ,"task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n" , t, status, ts->resp, ts->stat); +pm8001_ccb_task_free (pm8001_ha, t, ccb, tag);if (t->slow_task)complete (&t->slow_task->completion); -pm8001_ccb_task_free (pm8001_ha, t, ccb, tag); }else {spin_unlock_irqrestore (&t->task_state_lock, flags);pm8001_ccb_task_free (pm8001_ha, t, ccb, tag);
@@ -2794,9 +2794,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,pm8001_dbg (pm8001_ha,FAIL ,"task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n" , t, status, ts->resp, ts->stat); +pm8001_ccb_task_free (pm8001_ha, t, ccb, tag);if (t->slow_task)complete (&t->slow_task->completion); -pm8001_ccb_task_free (pm8001_ha, t, ccb, tag); }else {spin_unlock_irqrestore (&t->task_state_lock, flags); spin_unlock_irqrestore(&circularQ->oq_lock,
@@ -2821,7 +2821,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha,u32 tag =le32_to_cpu (psataPayload->tag);u32 port_id =le32_to_cpu (psataPayload->port_id);u32 dev_id =le32_to_cpu (psataPayload->device_id); -unsigned long flags;if (event)pm8001_dbg (pm8001_ha,FAIL ,"SATA EVENT 0x%x\n" , event);
@@ -2854,8 +2853,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DATA_OVERRUN ; ts->residual =0 ; -if (pm8001_dev) -atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_BREAK :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_BREAK\n" );
@@ -2904,11 +2901,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_QUEUE_FULL ; -spin_unlock_irqrestore (&circularQ->oq_lock, - circularQ->lock_flags); -pm8001_ccb_task_free_done (pm8001_ha, t, ccb, tag); -spin_lock_irqsave (&circularQ->oq_lock, - circularQ->lock_flags);return ; }break ;
@@ -3008,24 +3000,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, ts->stat =SAS_OPEN_TO ;break ; } -spin_lock_irqsave (&t->task_state_lock, flags); - t->task_state_flags &= ~SAS_TASK_STATE_PENDING ; - t->task_state_flags &= ~SAS_TASK_AT_INITIATOR ; - t->task_state_flags |=SAS_TASK_STATE_DONE ; -if (unlikely ((t->task_state_flags &SAS_TASK_STATE_ABORTED ))) { -spin_unlock_irqrestore (&t->task_state_lock, flags); -pm8001_dbg (pm8001_ha,FAIL , -"task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n" , - t, event, ts->resp, ts->stat); -pm8001_ccb_task_free (pm8001_ha, t, ccb, tag); - }else { -spin_unlock_irqrestore (&t->task_state_lock, flags); -spin_unlock_irqrestore (&circularQ->oq_lock, - circularQ->lock_flags); -pm8001_ccb_task_free_done (pm8001_ha, t, ccb, tag); -spin_lock_irqsave (&circularQ->oq_lock, - circularQ->lock_flags); - } }/*See the comments for mpi_ssp_completion */
@@ -3931,6 +3905,7 @@ static int ssp_coalesced_comp_resp(struct pm8001_hba_info *pm8001_ha,/** * process_one_iomb - process one outbound Queue memory block * @pm8001_ha: our hba card information +* @circularQ: outbound circular queue * @piomb: IO message buffer */ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha,
drivers/scsi/scsi_scan.c +50 -5
73 lines not on this page · raw message
The pull request you sent on Fri, 04 Feb 2022 16:54:44 -0500:
The pull request you sent on Fri, 04 Feb 2022 16:54:44 -0500:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.gitscsi-fixes
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/fc93310c67ff1c0dc38e3df7814973b55eea5559
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html