diff options
author | Eddie Wai <eddie.wai@broadcom.com> | 2010-11-23 18:29:28 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:24:14 -0500 |
commit | 842158d7b7bc3b1a49c31f43ac20414234c33a8d (patch) | |
tree | 8cb1ba191f2808d9f22a08262bd1589f4f9cc3b3 /drivers/scsi/bnx2i/bnx2i_init.c | |
parent | 016ef69076f3e8f9e42f31152157f46812d25566 (diff) |
[SCSI] bnx2i: Modified the bnx2i stop path to compensate for in progress ops
The stop path has been augmented to wait a max of 10s for all in
progress offload and destroy activities to complete before proceeding
to terminate all active connections (via iscsid or forcefully).
Note that any new offload and destroy requests are now blocked and
return to the caller immediately.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bnx2i/bnx2i_init.c')
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_init.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c index 769311f6504d..338caac418b8 100644 --- a/drivers/scsi/bnx2i/bnx2i_init.c +++ b/drivers/scsi/bnx2i/bnx2i_init.c | |||
@@ -209,13 +209,24 @@ void bnx2i_stop(void *handle) | |||
209 | { | 209 | { |
210 | struct bnx2i_hba *hba = handle; | 210 | struct bnx2i_hba *hba = handle; |
211 | int conns_active; | 211 | int conns_active; |
212 | int wait_delay = 1 * HZ; | ||
212 | 213 | ||
213 | /* check if cleanup happened in GOING_DOWN context */ | 214 | /* check if cleanup happened in GOING_DOWN context */ |
214 | if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN, | 215 | if (!test_and_set_bit(ADAPTER_STATE_GOING_DOWN, |
215 | &hba->adapter_state)) | 216 | &hba->adapter_state)) { |
216 | iscsi_host_for_each_session(hba->shost, | 217 | iscsi_host_for_each_session(hba->shost, |
217 | bnx2i_drop_session); | 218 | bnx2i_drop_session); |
218 | 219 | wait_delay = hba->hba_shutdown_tmo; | |
220 | } | ||
221 | /* Wait for inflight offload connection tasks to complete before | ||
222 | * proceeding. Forcefully terminate all connection recovery in | ||
223 | * progress at the earliest, either in bind(), send_pdu(LOGIN), | ||
224 | * or conn_start() | ||
225 | */ | ||
226 | wait_event_interruptible_timeout(hba->eh_wait, | ||
227 | (list_empty(&hba->ep_ofld_list) && | ||
228 | list_empty(&hba->ep_destroy_list)), | ||
229 | 10 * HZ); | ||
219 | /* Wait for all endpoints to be torn down, Chip will be reset once | 230 | /* Wait for all endpoints to be torn down, Chip will be reset once |
220 | * control returns to network driver. So it is required to cleanup and | 231 | * control returns to network driver. So it is required to cleanup and |
221 | * release all connection resources before returning from this routine. | 232 | * release all connection resources before returning from this routine. |
@@ -224,7 +235,7 @@ void bnx2i_stop(void *handle) | |||
224 | conns_active = hba->ofld_conns_active; | 235 | conns_active = hba->ofld_conns_active; |
225 | wait_event_interruptible_timeout(hba->eh_wait, | 236 | wait_event_interruptible_timeout(hba->eh_wait, |
226 | (hba->ofld_conns_active != conns_active), | 237 | (hba->ofld_conns_active != conns_active), |
227 | hba->hba_shutdown_tmo); | 238 | wait_delay); |
228 | if (hba->ofld_conns_active == conns_active) | 239 | if (hba->ofld_conns_active == conns_active) |
229 | break; | 240 | break; |
230 | } | 241 | } |
@@ -233,9 +244,11 @@ void bnx2i_stop(void *handle) | |||
233 | /* This flag should be cleared last so that ep_disconnect() gracefully | 244 | /* This flag should be cleared last so that ep_disconnect() gracefully |
234 | * cleans up connection context | 245 | * cleans up connection context |
235 | */ | 246 | */ |
247 | clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); | ||
236 | clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); | 248 | clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); |
237 | } | 249 | } |
238 | 250 | ||
251 | |||
239 | /** | 252 | /** |
240 | * bnx2i_init_one - initialize an adapter instance and allocate memory resources | 253 | * bnx2i_init_one - initialize an adapter instance and allocate memory resources |
241 | * @hba: bnx2i adapter instance | 254 | * @hba: bnx2i adapter instance |