diff options
author | James Smart <James.Smart@Emulex.Com> | 2006-03-13 08:28:57 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-03-13 09:58:58 -0500 |
commit | c829c394165f981d49f05a9be228404d7a9398d4 (patch) | |
tree | 649ca326052a4a35d31f150f274347ca9d38c678 /drivers/scsi/scsi_transport_fc.c | |
parent | ce313db240862d809c736c5b1dfc759817fc7ca9 (diff) |
[SCSI] FC transport : Avoid device offline cases by stalling aborts until device unblocked
This moves the eh_timed_out functionality from the scsi_host_template
to the transport_template. Given that this is now a transport function,
the EH_RESET_TIMER case no longer caps the timer reschedulings. The
transport guarantees that this is not an infinite condition.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 56012b2694d2..3c3baa9f5f28 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <scsi/scsi_host.h> | 31 | #include <scsi/scsi_host.h> |
32 | #include <scsi/scsi_transport.h> | 32 | #include <scsi/scsi_transport.h> |
33 | #include <scsi/scsi_transport_fc.h> | 33 | #include <scsi/scsi_transport_fc.h> |
34 | #include <scsi/scsi_cmnd.h> | ||
34 | #include "scsi_priv.h" | 35 | #include "scsi_priv.h" |
35 | 36 | ||
36 | /* | 37 | /* |
@@ -1090,6 +1091,40 @@ static int fc_rport_match(struct attribute_container *cont, | |||
1090 | } | 1091 | } |
1091 | 1092 | ||
1092 | 1093 | ||
1094 | /** | ||
1095 | * fc_timed_out - FC Transport I/O timeout intercept handler | ||
1096 | * | ||
1097 | * @scmd: The SCSI command which timed out | ||
1098 | * | ||
1099 | * This routine protects against error handlers getting invoked while a | ||
1100 | * rport is in a blocked state, typically due to a temporarily loss of | ||
1101 | * connectivity. If the error handlers are allowed to proceed, requests | ||
1102 | * to abort i/o, reset the target, etc will likely fail as there is no way | ||
1103 | * to communicate with the device to perform the requested function. These | ||
1104 | * failures may result in the midlayer taking the device offline, requiring | ||
1105 | * manual intervention to restore operation. | ||
1106 | * | ||
1107 | * This routine, called whenever an i/o times out, validates the state of | ||
1108 | * the underlying rport. If the rport is blocked, it returns | ||
1109 | * EH_RESET_TIMER, which will continue to reschedule the timeout. | ||
1110 | * Eventually, either the device will return, or devloss_tmo will fire, | ||
1111 | * and when the timeout then fires, it will be handled normally. | ||
1112 | * If the rport is not blocked, normal error handling continues. | ||
1113 | * | ||
1114 | * Notes: | ||
1115 | * This routine assumes no locks are held on entry. | ||
1116 | **/ | ||
1117 | static enum scsi_eh_timer_return | ||
1118 | fc_timed_out(struct scsi_cmnd *scmd) | ||
1119 | { | ||
1120 | struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device)); | ||
1121 | |||
1122 | if (rport->port_state == FC_PORTSTATE_BLOCKED) | ||
1123 | return EH_RESET_TIMER; | ||
1124 | |||
1125 | return EH_NOT_HANDLED; | ||
1126 | } | ||
1127 | |||
1093 | /* | 1128 | /* |
1094 | * Must be called with shost->host_lock held | 1129 | * Must be called with shost->host_lock held |
1095 | */ | 1130 | */ |
@@ -1146,6 +1181,8 @@ fc_attach_transport(struct fc_function_template *ft) | |||
1146 | /* Transport uses the shost workq for scsi scanning */ | 1181 | /* Transport uses the shost workq for scsi scanning */ |
1147 | i->t.create_work_queue = 1; | 1182 | i->t.create_work_queue = 1; |
1148 | 1183 | ||
1184 | i->t.eh_timed_out = fc_timed_out; | ||
1185 | |||
1149 | i->t.user_scan = fc_user_scan; | 1186 | i->t.user_scan = fc_user_scan; |
1150 | 1187 | ||
1151 | /* | 1188 | /* |