[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: Seokmann Ju <seokmann.ju@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Seokmann Ju and committed by
James Bottomley
246de42c 436a7b11

+20 -15
+1 -1
drivers/scsi/qla2xxx/qla_init.c
··· 4052 rval = qla2x00_fw_ready(ha->parent); 4053 if (rval == QLA_SUCCESS) { 4054 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 4055 - qla2x00_marker(ha->parent, 0, 0, MK_SYNC_ALL); 4056 } 4057 4058 ha->flags.management_server_logged_in = 0;
··· 4052 rval = qla2x00_fw_ready(ha->parent); 4053 if (rval == QLA_SUCCESS) { 4054 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 4055 + qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); 4056 } 4057 4058 ha->flags.management_server_logged_in = 0;
+13 -10
drivers/scsi/qla2xxx/qla_iocb.c
··· 269 { 270 int ret, nseg; 271 unsigned long flags; 272 - scsi_qla_host_t *ha; 273 struct scsi_cmnd *cmd; 274 uint32_t *clr_ptr; 275 uint32_t index; ··· 283 /* Setup device pointers. */ 284 ret = 0; 285 ha = sp->ha; 286 reg = &ha->iobase->isp; 287 cmd = sp->cmd; 288 /* So we know we haven't pci_map'ed anything yet */ ··· 298 } 299 300 /* Acquire ring specific lock */ 301 - spin_lock_irqsave(&ha->hardware_lock, flags); 302 303 /* Check for room in outstanding command list. */ 304 handle = ha->current_outstanding_cmd; ··· 387 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 388 qla2x00_process_response_queue(ha); 389 390 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 391 return (QLA_SUCCESS); 392 393 queuing_error: 394 if (tot_dsds) 395 scsi_dma_unmap(cmd); 396 397 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 398 399 return (QLA_FUNCTION_FAILED); 400 } ··· 455 { 456 int ret; 457 unsigned long flags = 0; 458 459 - spin_lock_irqsave(&ha->hardware_lock, flags); 460 ret = __qla2x00_marker(ha, loop_id, lun, type); 461 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 462 463 return (ret); 464 } ··· 674 { 675 int ret, nseg; 676 unsigned long flags; 677 - scsi_qla_host_t *ha; 678 struct scsi_cmnd *cmd; 679 uint32_t *clr_ptr; 680 uint32_t index; ··· 688 /* Setup device pointers. */ 689 ret = 0; 690 ha = sp->ha; 691 reg = &ha->iobase->isp24; 692 cmd = sp->cmd; 693 /* So we know we haven't pci_map'ed anything yet */ ··· 703 } 704 705 /* Acquire ring specific lock */ 706 - spin_lock_irqsave(&ha->hardware_lock, flags); 707 708 /* Check for room in outstanding command list. */ 709 handle = ha->current_outstanding_cmd; ··· 798 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 799 qla24xx_process_response_queue(ha); 800 801 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 802 return QLA_SUCCESS; 803 804 queuing_error: 805 if (tot_dsds) 806 scsi_dma_unmap(cmd); 807 808 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 809 810 return QLA_FUNCTION_FAILED; 811 }
··· 269 { 270 int ret, nseg; 271 unsigned long flags; 272 + scsi_qla_host_t *ha, *pha; 273 struct scsi_cmnd *cmd; 274 uint32_t *clr_ptr; 275 uint32_t index; ··· 283 /* Setup device pointers. */ 284 ret = 0; 285 ha = sp->ha; 286 + pha = to_qla_parent(ha); 287 reg = &ha->iobase->isp; 288 cmd = sp->cmd; 289 /* So we know we haven't pci_map'ed anything yet */ ··· 297 } 298 299 /* Acquire ring specific lock */ 300 + spin_lock_irqsave(&pha->hardware_lock, flags); 301 302 /* Check for room in outstanding command list. */ 303 handle = ha->current_outstanding_cmd; ··· 386 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 387 qla2x00_process_response_queue(ha); 388 389 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 390 return (QLA_SUCCESS); 391 392 queuing_error: 393 if (tot_dsds) 394 scsi_dma_unmap(cmd); 395 396 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 397 398 return (QLA_FUNCTION_FAILED); 399 } ··· 454 { 455 int ret; 456 unsigned long flags = 0; 457 + scsi_qla_host_t *pha = to_qla_parent(ha); 458 459 + spin_lock_irqsave(&pha->hardware_lock, flags); 460 ret = __qla2x00_marker(ha, loop_id, lun, type); 461 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 462 463 return (ret); 464 } ··· 672 { 673 int ret, nseg; 674 unsigned long flags; 675 + scsi_qla_host_t *ha, *pha; 676 struct scsi_cmnd *cmd; 677 uint32_t *clr_ptr; 678 uint32_t index; ··· 686 /* Setup device pointers. */ 687 ret = 0; 688 ha = sp->ha; 689 + pha = to_qla_parent(ha); 690 reg = &ha->iobase->isp24; 691 cmd = sp->cmd; 692 /* So we know we haven't pci_map'ed anything yet */ ··· 700 } 701 702 /* Acquire ring specific lock */ 703 + spin_lock_irqsave(&pha->hardware_lock, flags); 704 705 /* Check for room in outstanding command list. */ 706 handle = ha->current_outstanding_cmd; ··· 795 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 796 qla24xx_process_response_queue(ha); 797 798 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 799 return QLA_SUCCESS; 800 801 queuing_error: 802 if (tot_dsds) 803 scsi_dma_unmap(cmd); 804 805 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 806 807 return QLA_FUNCTION_FAILED; 808 }
+6 -4
drivers/scsi/qla2xxx/qla_mbx.c
··· 749 uint32_t handle; 750 mbx_cmd_t mc; 751 mbx_cmd_t *mcp = &mc; 752 753 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no)); 754 755 fcport = sp->fcport; 756 757 - spin_lock_irqsave(&ha->hardware_lock, flags); 758 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 759 if (ha->outstanding_cmds[handle] == sp) 760 break; 761 } 762 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 763 764 if (handle == MAX_OUTSTANDING_COMMANDS) { 765 /* command not found */ ··· 2162 struct abort_entry_24xx *abt; 2163 dma_addr_t abt_dma; 2164 uint32_t handle; 2165 2166 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); 2167 2168 fcport = sp->fcport; 2169 2170 - spin_lock_irqsave(&ha->hardware_lock, flags); 2171 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 2172 if (ha->outstanding_cmds[handle] == sp) 2173 break; 2174 } 2175 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 2176 if (handle == MAX_OUTSTANDING_COMMANDS) { 2177 /* Command not found. */ 2178 return QLA_FUNCTION_FAILED;
··· 749 uint32_t handle; 750 mbx_cmd_t mc; 751 mbx_cmd_t *mcp = &mc; 752 + scsi_qla_host_t *pha = to_qla_parent(ha); 753 754 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no)); 755 756 fcport = sp->fcport; 757 758 + spin_lock_irqsave(&pha->hardware_lock, flags); 759 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 760 if (ha->outstanding_cmds[handle] == sp) 761 break; 762 } 763 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 764 765 if (handle == MAX_OUTSTANDING_COMMANDS) { 766 /* command not found */ ··· 2161 struct abort_entry_24xx *abt; 2162 dma_addr_t abt_dma; 2163 uint32_t handle; 2164 + scsi_qla_host_t *pha = to_qla_parent(ha); 2165 2166 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); 2167 2168 fcport = sp->fcport; 2169 2170 + spin_lock_irqsave(&pha->hardware_lock, flags); 2171 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 2172 if (ha->outstanding_cmds[handle] == sp) 2173 break; 2174 } 2175 + spin_unlock_irqrestore(&pha->hardware_lock, flags); 2176 if (handle == MAX_OUTSTANDING_COMMANDS) { 2177 /* Command not found. */ 2178 return QLA_FUNCTION_FAILED;