[SCSI] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Stall error handler if attempting recovery while an rport is
blocked. This avoids device offline scenarios due to errors in
the error handler.

Reference implementation from lpfc/mptfc.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by Andrew Vasquez and committed by James Bottomley 07db5183 bb8ee499

+25
+25
drivers/scsi/qla2xxx/qla_os.c
··· 589 589 return (return_status); 590 590 } 591 591 592 + static void 593 + qla2x00_block_error_handler(struct scsi_cmnd *cmnd) 594 + { 595 + struct Scsi_Host *shost = cmnd->device->host; 596 + struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); 597 + unsigned long flags; 598 + 599 + spin_lock_irqsave(shost->host_lock, flags); 600 + while (rport->port_state == FC_PORTSTATE_BLOCKED) { 601 + spin_unlock_irqrestore(shost->host_lock, flags); 602 + msleep(1000); 603 + spin_lock_irqsave(shost->host_lock, flags); 604 + } 605 + spin_unlock_irqrestore(shost->host_lock, flags); 606 + return; 607 + } 608 + 592 609 /************************************************************************** 593 610 * qla2xxx_eh_abort 594 611 * ··· 631 614 unsigned long serial; 632 615 unsigned long flags; 633 616 int wait = 0; 617 + 618 + qla2x00_block_error_handler(cmd); 634 619 635 620 if (!CMD_SP(cmd)) 636 621 return SUCCESS; ··· 767 748 unsigned int id, lun; 768 749 unsigned long serial; 769 750 751 + qla2x00_block_error_handler(cmd); 752 + 770 753 ret = FAILED; 771 754 772 755 id = cmd->device->id; ··· 898 877 unsigned int id, lun; 899 878 unsigned long serial; 900 879 880 + qla2x00_block_error_handler(cmd); 881 + 901 882 ret = FAILED; 902 883 903 884 id = cmd->device->id; ··· 958 935 int ret; 959 936 unsigned int id, lun; 960 937 unsigned long serial; 938 + 939 + qla2x00_block_error_handler(cmd); 961 940 962 941 ret = FAILED; 963 942