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