Commit 246de42c authored by Seokmann Ju's avatar Seokmann Ju Committed by James Bottomley

[SCSI] qla2xxx: Always aquire the parent's hardware_lock.

While issuing a marker, manipulating the request/response queues
and modifying the outstanding command array.
Signed-off-by: default avatarSeokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 436a7b11
...@@ -4052,7 +4052,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *ha) ...@@ -4052,7 +4052,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *ha)
rval = qla2x00_fw_ready(ha->parent); rval = qla2x00_fw_ready(ha->parent);
if (rval == QLA_SUCCESS) { if (rval == QLA_SUCCESS) {
clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
qla2x00_marker(ha->parent, 0, 0, MK_SYNC_ALL); qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
} }
ha->flags.management_server_logged_in = 0; ha->flags.management_server_logged_in = 0;
......
...@@ -269,7 +269,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -269,7 +269,7 @@ qla2x00_start_scsi(srb_t *sp)
{ {
int ret, nseg; int ret, nseg;
unsigned long flags; unsigned long flags;
scsi_qla_host_t *ha; scsi_qla_host_t *ha, *pha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
uint32_t *clr_ptr; uint32_t *clr_ptr;
uint32_t index; uint32_t index;
...@@ -283,6 +283,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -283,6 +283,7 @@ qla2x00_start_scsi(srb_t *sp)
/* Setup device pointers. */ /* Setup device pointers. */
ret = 0; ret = 0;
ha = sp->ha; ha = sp->ha;
pha = to_qla_parent(ha);
reg = &ha->iobase->isp; reg = &ha->iobase->isp;
cmd = sp->cmd; cmd = sp->cmd;
/* So we know we haven't pci_map'ed anything yet */ /* So we know we haven't pci_map'ed anything yet */
...@@ -297,7 +298,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -297,7 +298,7 @@ qla2x00_start_scsi(srb_t *sp)
} }
/* Acquire ring specific lock */ /* Acquire ring specific lock */
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&pha->hardware_lock, flags);
/* Check for room in outstanding command list. */ /* Check for room in outstanding command list. */
handle = ha->current_outstanding_cmd; handle = ha->current_outstanding_cmd;
...@@ -386,14 +387,14 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -386,14 +387,14 @@ qla2x00_start_scsi(srb_t *sp)
ha->response_ring_ptr->signature != RESPONSE_PROCESSED) ha->response_ring_ptr->signature != RESPONSE_PROCESSED)
qla2x00_process_response_queue(ha); qla2x00_process_response_queue(ha);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
return (QLA_SUCCESS); return (QLA_SUCCESS);
queuing_error: queuing_error:
if (tot_dsds) if (tot_dsds)
scsi_dma_unmap(cmd); scsi_dma_unmap(cmd);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
return (QLA_FUNCTION_FAILED); return (QLA_FUNCTION_FAILED);
} }
...@@ -454,10 +455,11 @@ qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, ...@@ -454,10 +455,11 @@ qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
{ {
int ret; int ret;
unsigned long flags = 0; unsigned long flags = 0;
scsi_qla_host_t *pha = to_qla_parent(ha);
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&pha->hardware_lock, flags);
ret = __qla2x00_marker(ha, loop_id, lun, type); ret = __qla2x00_marker(ha, loop_id, lun, type);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
return (ret); return (ret);
} }
...@@ -672,7 +674,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -672,7 +674,7 @@ qla24xx_start_scsi(srb_t *sp)
{ {
int ret, nseg; int ret, nseg;
unsigned long flags; unsigned long flags;
scsi_qla_host_t *ha; scsi_qla_host_t *ha, *pha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
uint32_t *clr_ptr; uint32_t *clr_ptr;
uint32_t index; uint32_t index;
...@@ -686,6 +688,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -686,6 +688,7 @@ qla24xx_start_scsi(srb_t *sp)
/* Setup device pointers. */ /* Setup device pointers. */
ret = 0; ret = 0;
ha = sp->ha; ha = sp->ha;
pha = to_qla_parent(ha);
reg = &ha->iobase->isp24; reg = &ha->iobase->isp24;
cmd = sp->cmd; cmd = sp->cmd;
/* So we know we haven't pci_map'ed anything yet */ /* So we know we haven't pci_map'ed anything yet */
...@@ -700,7 +703,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -700,7 +703,7 @@ qla24xx_start_scsi(srb_t *sp)
} }
/* Acquire ring specific lock */ /* Acquire ring specific lock */
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&pha->hardware_lock, flags);
/* Check for room in outstanding command list. */ /* Check for room in outstanding command list. */
handle = ha->current_outstanding_cmd; handle = ha->current_outstanding_cmd;
...@@ -795,14 +798,14 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -795,14 +798,14 @@ qla24xx_start_scsi(srb_t *sp)
ha->response_ring_ptr->signature != RESPONSE_PROCESSED) ha->response_ring_ptr->signature != RESPONSE_PROCESSED)
qla24xx_process_response_queue(ha); qla24xx_process_response_queue(ha);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
return QLA_SUCCESS; return QLA_SUCCESS;
queuing_error: queuing_error:
if (tot_dsds) if (tot_dsds)
scsi_dma_unmap(cmd); scsi_dma_unmap(cmd);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
} }
...@@ -749,17 +749,18 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp) ...@@ -749,17 +749,18 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp)
uint32_t handle; uint32_t handle;
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
scsi_qla_host_t *pha = to_qla_parent(ha);
DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no)); DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no));
fcport = sp->fcport; fcport = sp->fcport;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&pha->hardware_lock, flags);
for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
if (ha->outstanding_cmds[handle] == sp) if (ha->outstanding_cmds[handle] == sp)
break; break;
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
if (handle == MAX_OUTSTANDING_COMMANDS) { if (handle == MAX_OUTSTANDING_COMMANDS) {
/* command not found */ /* command not found */
...@@ -2161,17 +2162,18 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) ...@@ -2161,17 +2162,18 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
struct abort_entry_24xx *abt; struct abort_entry_24xx *abt;
dma_addr_t abt_dma; dma_addr_t abt_dma;
uint32_t handle; uint32_t handle;
scsi_qla_host_t *pha = to_qla_parent(ha);
DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
fcport = sp->fcport; fcport = sp->fcport;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&pha->hardware_lock, flags);
for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
if (ha->outstanding_cmds[handle] == sp) if (ha->outstanding_cmds[handle] == sp)
break; break;
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&pha->hardware_lock, flags);
if (handle == MAX_OUTSTANDING_COMMANDS) { if (handle == MAX_OUTSTANDING_COMMANDS) {
/* Command not found. */ /* Command not found. */
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment