diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2009-10-30 12:59:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:52 -0500 |
commit | 65d430fa99cbd0e88d09a3343f697c51fc8a7009 (patch) | |
tree | d0e7f7353bb227ff7585ff77cc682611acd1680b /drivers/scsi/scsi_transport_fc.c | |
parent | 03b147083a2f9a2a3fbbd2505fa88ffa3c6ab194 (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/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f436e033adaf..3ce56b3b2cd7 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/delay.h> | ||
30 | #include <scsi/scsi_device.h> | 31 | #include <scsi/scsi_device.h> |
31 | #include <scsi/scsi_host.h> | 32 | #include <scsi/scsi_host.h> |
32 | #include <scsi/scsi_transport.h> | 33 | #include <scsi/scsi_transport.h> |
@@ -3144,6 +3145,31 @@ fc_scsi_scan_rport(struct work_struct *work) | |||
3144 | spin_unlock_irqrestore(shost->host_lock, flags); | 3145 | spin_unlock_irqrestore(shost->host_lock, flags); |
3145 | } | 3146 | } |
3146 | 3147 | ||
3148 | /** | ||
3149 | * fc_block_scsi_eh - Block SCSI eh thread for blocked fc_rport | ||
3150 | * @cmnd: SCSI command that scsi_eh is trying to recover | ||
3151 | * | ||
3152 | * This routine can be called from a FC LLD scsi_eh callback. It | ||
3153 | * blocks the scsi_eh thread until the fc_rport leaves the | ||
3154 | * FC_PORTSTATE_BLOCKED. This is necessary to avoid the scsi_eh | ||
3155 | * failing recovery actions for blocked rports which would lead to | ||
3156 | * offlined SCSI devices. | ||
3157 | */ | ||
3158 | void fc_block_scsi_eh(struct scsi_cmnd *cmnd) | ||
3159 | { | ||
3160 | struct Scsi_Host *shost = cmnd->device->host; | ||
3161 | struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); | ||
3162 | unsigned long flags; | ||
3163 | |||
3164 | spin_lock_irqsave(shost->host_lock, flags); | ||
3165 | while (rport->port_state == FC_PORTSTATE_BLOCKED) { | ||
3166 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
3167 | msleep(1000); | ||
3168 | spin_lock_irqsave(shost->host_lock, flags); | ||
3169 | } | ||
3170 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
3171 | } | ||
3172 | EXPORT_SYMBOL(fc_block_scsi_eh); | ||
3147 | 3173 | ||
3148 | /** | 3174 | /** |
3149 | * fc_vport_setup - allocates and creates a FC virtual port. | 3175 | * fc_vport_setup - allocates and creates a FC virtual port. |