Skip to content

Commit d4fc968

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Three driver fixes. Two (alua and hpsa) are in hard to trigger attach/detach situations but the mp3sas one involves a polled to interrupt switch over that could trigger in any high IOPS situation" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: mpt3sas: Fix timeouts observed while reenabling IRQ scsi: scsi_dh_alua: Avoid crash during alua_bus_detach() scsi: hpsa: Fix memory leak in hpsa_init_one()
2 parents bf3e762 + 5feed64 commit d4fc968

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

drivers/scsi/device_handler/scsi_dh_alua.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
658658
rcu_read_lock();
659659
list_for_each_entry_rcu(h,
660660
&tmp_pg->dh_list, node) {
661-
/* h->sdev should always be valid */
662-
BUG_ON(!h->sdev);
661+
if (!h->sdev)
662+
continue;
663663
h->sdev->access_state = desc[0];
664664
}
665665
rcu_read_unlock();
@@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
705705
pg->expiry = 0;
706706
rcu_read_lock();
707707
list_for_each_entry_rcu(h, &pg->dh_list, node) {
708-
BUG_ON(!h->sdev);
708+
if (!h->sdev)
709+
continue;
709710
h->sdev->access_state =
710711
(pg->state & SCSI_ACCESS_STATE_MASK);
711712
if (pg->pref)
@@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev)
11471148
spin_lock(&h->pg_lock);
11481149
pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock));
11491150
rcu_assign_pointer(h->pg, NULL);
1150-
h->sdev = NULL;
11511151
spin_unlock(&h->pg_lock);
11521152
if (pg) {
11531153
spin_lock_irq(&pg->lock);
@@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev)
11561156
kref_put(&pg->kref, release_port_group);
11571157
}
11581158
sdev->handler_data = NULL;
1159+
synchronize_rcu();
11591160
kfree(h);
11601161
}
11611162

drivers/scsi/hpsa.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8855,7 +8855,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
88558855
/* hook into SCSI subsystem */
88568856
rc = hpsa_scsi_add_host(h);
88578857
if (rc)
8858-
goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
8858+
goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
88598859

88608860
/* Monitor the controller for firmware lockups */
88618861
h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
@@ -8870,6 +8870,8 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
88708870
HPSA_EVENT_MONITOR_INTERVAL);
88718871
return 0;
88728872

8873+
clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8874+
kfree(h->lastlogicals);
88738875
clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
88748876
hpsa_free_performant_mode(h);
88758877
h->access.set_intr_mask(h, HPSA_INTR_OFF);

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget)
17401740
reply_q->irq_poll_scheduled = false;
17411741
reply_q->irq_line_enable = true;
17421742
enable_irq(reply_q->os_irq);
1743+
/*
1744+
* Go for one more round of processing the
1745+
* reply descriptor post queue incase if HBA
1746+
* Firmware has posted some reply descriptors
1747+
* while reenabling the IRQ.
1748+
*/
1749+
_base_process_reply_queue(reply_q);
17431750
}
17441751

17451752
return num_entries;

0 commit comments

Comments
 (0)