aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-10-30 12:59:29 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:00:52 -0500
commit65d430fa99cbd0e88d09a3343f697c51fc8a7009 (patch)
treed0e7f7353bb227ff7585ff77cc682611acd1680b /drivers/scsi/lpfc
parent03b147083a2f9a2a3fbbd2505fa88ffa3c6ab194 (diff)
[SCSI] scsi_transport_fc: Introduce helper function for blocking scsi_eh
Move the duplicated code from FC LLDs to SCSI FC transport class. Acked-by: James Smart <james.smart@emulex.com> Acked-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Acked-by: Abhijeet Joglekar <abjoglek@cisco.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c88f59f0ce30..e25179193a82 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -2917,28 +2917,6 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
2917} 2917}
2918 2918
2919/** 2919/**
2920 * lpfc_block_error_handler - Routine to block error handler
2921 * @cmnd: Pointer to scsi_cmnd data structure.
2922 *
2923 * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD.
2924 **/
2925static void
2926lpfc_block_error_handler(struct scsi_cmnd *cmnd)
2927{
2928 struct Scsi_Host *shost = cmnd->device->host;
2929 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
2930
2931 spin_lock_irq(shost->host_lock);
2932 while (rport->port_state == FC_PORTSTATE_BLOCKED) {
2933 spin_unlock_irq(shost->host_lock);
2934 msleep(1000);
2935 spin_lock_irq(shost->host_lock);
2936 }
2937 spin_unlock_irq(shost->host_lock);
2938 return;
2939}
2940
2941/**
2942 * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point 2920 * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point
2943 * @cmnd: Pointer to scsi_cmnd data structure. 2921 * @cmnd: Pointer to scsi_cmnd data structure.
2944 * 2922 *
@@ -2961,7 +2939,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
2961 int ret = SUCCESS; 2939 int ret = SUCCESS;
2962 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); 2940 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
2963 2941
2964 lpfc_block_error_handler(cmnd); 2942 fc_block_scsi_eh(cmnd);
2965 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble; 2943 lpfc_cmd = (struct lpfc_scsi_buf *)cmnd->host_scribble;
2966 BUG_ON(!lpfc_cmd); 2944 BUG_ON(!lpfc_cmd);
2967 2945
@@ -3259,7 +3237,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
3259 struct lpfc_scsi_event_header scsi_event; 3237 struct lpfc_scsi_event_header scsi_event;
3260 int status; 3238 int status;
3261 3239
3262 lpfc_block_error_handler(cmnd); 3240 fc_block_scsi_eh(cmnd);
3263 3241
3264 status = lpfc_chk_tgt_mapped(vport, cmnd); 3242 status = lpfc_chk_tgt_mapped(vport, cmnd);
3265 if (status == FAILED) { 3243 if (status == FAILED) {
@@ -3318,7 +3296,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
3318 struct lpfc_scsi_event_header scsi_event; 3296 struct lpfc_scsi_event_header scsi_event;
3319 int status; 3297 int status;
3320 3298
3321 lpfc_block_error_handler(cmnd); 3299 fc_block_scsi_eh(cmnd);
3322 3300
3323 status = lpfc_chk_tgt_mapped(vport, cmnd); 3301 status = lpfc_chk_tgt_mapped(vport, cmnd);
3324 if (status == FAILED) { 3302 if (status == FAILED) {
@@ -3384,7 +3362,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
3384 fc_host_post_vendor_event(shost, fc_get_event_number(), 3362 fc_host_post_vendor_event(shost, fc_get_event_number(),
3385 sizeof(scsi_event), (char *)&scsi_event, LPFC_NL_VENDOR_ID); 3363 sizeof(scsi_event), (char *)&scsi_event, LPFC_NL_VENDOR_ID);
3386 3364
3387 lpfc_block_error_handler(cmnd); 3365 fc_block_scsi_eh(cmnd);
3388 3366
3389 /* 3367 /*
3390 * Since the driver manages a single bus device, reset all 3368 * Since the driver manages a single bus device, reset all