aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
authorAndreas Herrmann <aherrman@de.ibm.com>2006-09-18 16:29:56 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-09-23 19:01:23 -0400
commit2abbe866c8eb0296e3f5343bcf73e5371522a738 (patch)
treec839b12b43d07d538e32bcabec1fefa2106f384f /drivers/s390/scsi/zfcp_erp.c
parent4eff4a36516d72e4f6ede901141214a7e05607e7 (diff)
[SCSI] zfcp: introduce struct timer_list in struct zfcp_fsf_req
This instance will be used whenever a timer is needed for a request by zfcp. Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c228
1 files changed, 72 insertions, 156 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 7f60b6fdf724..af42a0eadf03 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -64,8 +64,6 @@ static int zfcp_erp_strategy_check_action(struct zfcp_erp_action *, int);
64static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *); 64static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *);
65static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *, int); 65static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *, int);
66static int zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *); 66static int zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *);
67static void zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *);
68static void zfcp_erp_adapter_strategy_close_fsf(struct zfcp_erp_action *);
69static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *); 67static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *);
70static int zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *); 68static int zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *);
71static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *); 69static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *);
@@ -111,64 +109,86 @@ static inline void zfcp_erp_action_to_ready(struct zfcp_erp_action *);
111static inline void zfcp_erp_action_to_running(struct zfcp_erp_action *); 109static inline void zfcp_erp_action_to_running(struct zfcp_erp_action *);
112 110
113static void zfcp_erp_memwait_handler(unsigned long); 111static void zfcp_erp_memwait_handler(unsigned long);
114static void zfcp_erp_timeout_handler(unsigned long);
115static inline void zfcp_erp_timeout_init(struct zfcp_erp_action *);
116 112
117/** 113/**
118 * zfcp_fsf_request_timeout_handler - called if a request timed out 114 * zfcp_close_qdio - close qdio queues for an adapter
119 * @data: pointer to adapter for handler function
120 *
121 * This function needs to be called if requests (ELS, Generic Service,
122 * or SCSI commands) exceed a certain time limit. The assumption is
123 * that after the time limit the adapter get stuck. So we trigger a reopen of
124 * the adapter. This should not be used for error recovery, SCSI abort
125 * commands and SCSI requests from SCSI mid-layer.
126 */ 115 */
127void 116static void zfcp_close_qdio(struct zfcp_adapter *adapter)
128zfcp_fsf_request_timeout_handler(unsigned long data)
129{ 117{
130 struct zfcp_adapter *adapter; 118 struct zfcp_qdio_queue *req_queue;
119 int first, count;
131 120
132 adapter = (struct zfcp_adapter *) data; 121 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status))
122 return;
133 123
134 zfcp_erp_adapter_reopen(adapter, 0); 124 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */
125 req_queue = &adapter->request_queue;
126 write_lock_irq(&req_queue->queue_lock);
127 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
128 write_unlock_irq(&req_queue->queue_lock);
129
130 debug_text_event(adapter->erp_dbf, 3, "qdio_down2a");
131 while (qdio_shutdown(adapter->ccw_device,
132 QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
133 msleep(1000);
134 debug_text_event(adapter->erp_dbf, 3, "qdio_down2b");
135
136 /* cleanup used outbound sbals */
137 count = atomic_read(&req_queue->free_count);
138 if (count < QDIO_MAX_BUFFERS_PER_Q) {
139 first = (req_queue->free_index+count) % QDIO_MAX_BUFFERS_PER_Q;
140 count = QDIO_MAX_BUFFERS_PER_Q - count;
141 zfcp_qdio_zero_sbals(req_queue->buffer, first, count);
142 }
143 req_queue->free_index = 0;
144 atomic_set(&req_queue->free_count, 0);
145 req_queue->distance_from_int = 0;
146 adapter->response_queue.free_index = 0;
147 atomic_set(&adapter->response_queue.free_count, 0);
135} 148}
136 149
137/** 150/**
138 * zfcp_fsf_scsi_er_timeout_handler - timeout handler for scsi eh tasks 151 * zfcp_close_fsf - stop FSF operations for an adapter
139 * 152 *
140 * This function needs to be called whenever a SCSI error recovery 153 * Dismiss and cleanup all pending fsf_reqs (this wakes up all initiators of
141 * action (abort/reset) does not return. Re-opening the adapter means 154 * requests waiting for completion; especially this returns SCSI commands
142 * that the abort/reset command can be returned by zfcp. It won't complete 155 * with error state).
143 * via the adapter anymore (because qdio queues are closed). If ERP is
144 * already running on this adapter it will be stopped.
145 */ 156 */
146void zfcp_fsf_scsi_er_timeout_handler(unsigned long data) 157static void zfcp_close_fsf(struct zfcp_adapter *adapter)
147{ 158{
148 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; 159 /* close queues to ensure that buffers are not accessed by adapter */
149 unsigned long flags; 160 zfcp_close_qdio(adapter);
150 161 zfcp_fsf_req_dismiss_all(adapter);
151 ZFCP_LOG_NORMAL("warning: SCSI error recovery timed out. " 162 /* reset FSF request sequence number */
152 "Restarting all operations on the adapter %s\n", 163 adapter->fsf_req_seq_no = 0;
153 zfcp_get_busid_by_adapter(adapter)); 164 /* all ports and units are closed */
154 debug_text_event(adapter->erp_dbf, 1, "eh_lmem_tout"); 165 zfcp_erp_modify_adapter_status(adapter,
166 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
167}
155 168
156 write_lock_irqsave(&adapter->erp_lock, flags); 169/**
157 if (atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, 170 * zfcp_fsf_request_timeout_handler - called if a request timed out
158 &adapter->status)) { 171 * @data: pointer to adapter for handler function
159 zfcp_erp_modify_adapter_status(adapter, 172 *
160 ZFCP_STATUS_COMMON_UNBLOCKED|ZFCP_STATUS_COMMON_OPEN, 173 * This function needs to be called if requests (ELS, Generic Service,
161 ZFCP_CLEAR); 174 * or SCSI commands) exceed a certain time limit. The assumption is
162 zfcp_erp_action_dismiss_adapter(adapter); 175 * that after the time limit the adapter get stuck. So we trigger a reopen of
163 write_unlock_irqrestore(&adapter->erp_lock, flags); 176 * the adapter.
164 /* dismiss all pending requests including requests for ERP */ 177 */
165 zfcp_fsf_req_dismiss_all(adapter); 178static void zfcp_fsf_request_timeout_handler(unsigned long data)
166 adapter->fsf_req_seq_no = 0; 179{
167 } else 180 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
168 write_unlock_irqrestore(&adapter->erp_lock, flags);
169 zfcp_erp_adapter_reopen(adapter, 0); 181 zfcp_erp_adapter_reopen(adapter, 0);
170} 182}
171 183
184void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
185{
186 fsf_req->timer.function = zfcp_fsf_request_timeout_handler;
187 fsf_req->timer.data = (unsigned long) fsf_req->adapter;
188 fsf_req->timer.expires = timeout;
189 add_timer(&fsf_req->timer);
190}
191
172/* 192/*
173 * function: 193 * function:
174 * 194 *
@@ -282,7 +302,6 @@ zfcp_erp_adisc(struct zfcp_port *port)
282 struct zfcp_ls_adisc *adisc; 302 struct zfcp_ls_adisc *adisc;
283 void *address = NULL; 303 void *address = NULL;
284 int retval = 0; 304 int retval = 0;
285 struct timer_list *timer;
286 305
287 send_els = kzalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC); 306 send_els = kzalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC);
288 if (send_els == NULL) 307 if (send_els == NULL)
@@ -329,22 +348,11 @@ zfcp_erp_adisc(struct zfcp_port *port)
329 (wwn_t) adisc->wwnn, adisc->hard_nport_id, 348 (wwn_t) adisc->wwnn, adisc->hard_nport_id,
330 adisc->nport_id); 349 adisc->nport_id);
331 350
332 timer = kmalloc(sizeof(struct timer_list), GFP_ATOMIC);
333 if (!timer)
334 goto nomem;
335
336 init_timer(timer);
337 timer->function = zfcp_fsf_request_timeout_handler;
338 timer->data = (unsigned long) adapter;
339 timer->expires = ZFCP_FSF_REQUEST_TIMEOUT;
340 send_els->timer = timer;
341
342 retval = zfcp_fsf_send_els(send_els); 351 retval = zfcp_fsf_send_els(send_els);
343 if (retval != 0) { 352 if (retval != 0) {
344 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port " 353 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port "
345 "0x%08x on adapter %s\n", send_els->d_id, 354 "0x%08x on adapter %s\n", send_els->d_id,
346 zfcp_get_busid_by_adapter(adapter)); 355 zfcp_get_busid_by_adapter(adapter));
347 del_timer(send_els->timer);
348 goto freemem; 356 goto freemem;
349 } 357 }
350 358
@@ -356,7 +364,6 @@ zfcp_erp_adisc(struct zfcp_port *port)
356 if (address != NULL) 364 if (address != NULL)
357 __free_pages(send_els->req->page, 0); 365 __free_pages(send_els->req->page, 0);
358 if (send_els != NULL) { 366 if (send_els != NULL) {
359 kfree(send_els->timer);
360 kfree(send_els->req); 367 kfree(send_els->req);
361 kfree(send_els->resp); 368 kfree(send_els->resp);
362 kfree(send_els); 369 kfree(send_els);
@@ -382,9 +389,6 @@ zfcp_erp_adisc_handler(unsigned long data)
382 struct zfcp_ls_adisc_acc *adisc; 389 struct zfcp_ls_adisc_acc *adisc;
383 390
384 send_els = (struct zfcp_send_els *) data; 391 send_els = (struct zfcp_send_els *) data;
385
386 del_timer(send_els->timer);
387
388 adapter = send_els->adapter; 392 adapter = send_els->adapter;
389 port = send_els->port; 393 port = send_els->port;
390 d_id = send_els->d_id; 394 d_id = send_els->d_id;
@@ -433,7 +437,6 @@ zfcp_erp_adisc_handler(unsigned long data)
433 out: 437 out:
434 zfcp_port_put(port); 438 zfcp_port_put(port);
435 __free_pages(send_els->req->page, 0); 439 __free_pages(send_els->req->page, 0);
436 kfree(send_els->timer);
437 kfree(send_els->req); 440 kfree(send_els->req);
438 kfree(send_els->resp); 441 kfree(send_els->resp);
439 kfree(send_els); 442 kfree(send_els);
@@ -909,8 +912,6 @@ static void zfcp_erp_async_handler_nolock(struct zfcp_erp_action *erp_action,
909 debug_text_event(adapter->erp_dbf, 2, "a_asyh_ex"); 912 debug_text_event(adapter->erp_dbf, 2, "a_asyh_ex");
910 debug_event(adapter->erp_dbf, 2, &erp_action->action, 913 debug_event(adapter->erp_dbf, 2, &erp_action->action,
911 sizeof (int)); 914 sizeof (int));
912 if (!(set_mask & ZFCP_STATUS_ERP_TIMEDOUT))
913 del_timer(&erp_action->timer);
914 erp_action->status |= set_mask; 915 erp_action->status |= set_mask;
915 zfcp_erp_action_ready(erp_action); 916 zfcp_erp_action_ready(erp_action);
916 } else { 917 } else {
@@ -957,8 +958,7 @@ zfcp_erp_memwait_handler(unsigned long data)
957 * action gets an appropriate flag and will be processed 958 * action gets an appropriate flag and will be processed
958 * accordingly 959 * accordingly
959 */ 960 */
960static void 961void zfcp_erp_timeout_handler(unsigned long data)
961zfcp_erp_timeout_handler(unsigned long data)
962{ 962{
963 struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data; 963 struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data;
964 struct zfcp_adapter *adapter = erp_action->adapter; 964 struct zfcp_adapter *adapter = erp_action->adapter;
@@ -1934,8 +1934,7 @@ zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *erp_action, int close)
1934 &erp_action->adapter->status); 1934 &erp_action->adapter->status);
1935 1935
1936 failed_openfcp: 1936 failed_openfcp:
1937 zfcp_erp_adapter_strategy_close_qdio(erp_action); 1937 zfcp_close_fsf(erp_action->adapter);
1938 zfcp_erp_adapter_strategy_close_fsf(erp_action);
1939 failed_qdio: 1938 failed_qdio:
1940 out: 1939 out:
1941 return retval; 1940 return retval;
@@ -2040,59 +2039,6 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action)
2040 return retval; 2039 return retval;
2041} 2040}
2042 2041
2043/**
2044 * zfcp_erp_adapter_strategy_close_qdio - close qdio queues for an adapter
2045 */
2046static void
2047zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *erp_action)
2048{
2049 int first_used;
2050 int used_count;
2051 struct zfcp_adapter *adapter = erp_action->adapter;
2052
2053 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status)) {
2054 ZFCP_LOG_DEBUG("error: attempt to shut down inactive QDIO "
2055 "queues on adapter %s\n",
2056 zfcp_get_busid_by_adapter(adapter));
2057 return;
2058 }
2059
2060 /*
2061 * Get queue_lock and clear QDIOUP flag. Thus it's guaranteed that
2062 * do_QDIO won't be called while qdio_shutdown is in progress.
2063 */
2064 write_lock_irq(&adapter->request_queue.queue_lock);
2065 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
2066 write_unlock_irq(&adapter->request_queue.queue_lock);
2067
2068 debug_text_event(adapter->erp_dbf, 3, "qdio_down2a");
2069 while (qdio_shutdown(adapter->ccw_device,
2070 QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
2071 msleep(1000);
2072 debug_text_event(adapter->erp_dbf, 3, "qdio_down2b");
2073
2074 /*
2075 * First we had to stop QDIO operation.
2076 * Now it is safe to take the following actions.
2077 */
2078
2079 /* Cleanup only necessary when there are unacknowledged buffers */
2080 if (atomic_read(&adapter->request_queue.free_count)
2081 < QDIO_MAX_BUFFERS_PER_Q) {
2082 first_used = (adapter->request_queue.free_index +
2083 atomic_read(&adapter->request_queue.free_count))
2084 % QDIO_MAX_BUFFERS_PER_Q;
2085 used_count = QDIO_MAX_BUFFERS_PER_Q -
2086 atomic_read(&adapter->request_queue.free_count);
2087 zfcp_qdio_zero_sbals(adapter->request_queue.buffer,
2088 first_used, used_count);
2089 }
2090 adapter->response_queue.free_index = 0;
2091 atomic_set(&adapter->response_queue.free_count, 0);
2092 adapter->request_queue.free_index = 0;
2093 atomic_set(&adapter->request_queue.free_count, 0);
2094 adapter->request_queue.distance_from_int = 0;
2095}
2096 2042
2097static int 2043static int
2098zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) 2044zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action)
@@ -2127,7 +2073,6 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
2127 write_lock_irq(&adapter->erp_lock); 2073 write_lock_irq(&adapter->erp_lock);
2128 zfcp_erp_action_to_running(erp_action); 2074 zfcp_erp_action_to_running(erp_action);
2129 write_unlock_irq(&adapter->erp_lock); 2075 write_unlock_irq(&adapter->erp_lock);
2130 zfcp_erp_timeout_init(erp_action);
2131 if (zfcp_fsf_exchange_config_data(erp_action)) { 2076 if (zfcp_fsf_exchange_config_data(erp_action)) {
2132 retval = ZFCP_ERP_FAILED; 2077 retval = ZFCP_ERP_FAILED;
2133 debug_text_event(adapter->erp_dbf, 5, "a_fstx_xf"); 2078 debug_text_event(adapter->erp_dbf, 5, "a_fstx_xf");
@@ -2196,7 +2141,6 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
2196 zfcp_erp_action_to_running(erp_action); 2141 zfcp_erp_action_to_running(erp_action);
2197 write_unlock_irq(&adapter->erp_lock); 2142 write_unlock_irq(&adapter->erp_lock);
2198 2143
2199 zfcp_erp_timeout_init(erp_action);
2200 ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL); 2144 ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL);
2201 if (ret == -EOPNOTSUPP) { 2145 if (ret == -EOPNOTSUPP) {
2202 debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); 2146 debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp");
@@ -2248,27 +2192,6 @@ zfcp_erp_adapter_strategy_open_fsf_statusread(struct zfcp_erp_action
2248 return retval; 2192 return retval;
2249} 2193}
2250 2194
2251/**
2252 * zfcp_erp_adapter_strategy_close_fsf - stop FSF operations for an adapter
2253 */
2254static void
2255zfcp_erp_adapter_strategy_close_fsf(struct zfcp_erp_action *erp_action)
2256{
2257 struct zfcp_adapter *adapter = erp_action->adapter;
2258
2259 /*
2260 * wake waiting initiators of requests,
2261 * return SCSI commands (with error status),
2262 * clean up all requests (synchronously)
2263 */
2264 zfcp_fsf_req_dismiss_all(adapter);
2265 /* reset FSF request sequence number */
2266 adapter->fsf_req_seq_no = 0;
2267 /* all ports and units are closed */
2268 zfcp_erp_modify_adapter_status(adapter,
2269 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
2270}
2271
2272/* 2195/*
2273 * function: 2196 * function:
2274 * 2197 *
@@ -2605,7 +2528,6 @@ zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *erp_action)
2605 struct zfcp_adapter *adapter = erp_action->adapter; 2528 struct zfcp_adapter *adapter = erp_action->adapter;
2606 struct zfcp_port *port = erp_action->port; 2529 struct zfcp_port *port = erp_action->port;
2607 2530
2608 zfcp_erp_timeout_init(erp_action);
2609 retval = zfcp_fsf_close_physical_port(erp_action); 2531 retval = zfcp_fsf_close_physical_port(erp_action);
2610 if (retval == -ENOMEM) { 2532 if (retval == -ENOMEM) {
2611 debug_text_event(adapter->erp_dbf, 5, "o_pfstc_nomem"); 2533 debug_text_event(adapter->erp_dbf, 5, "o_pfstc_nomem");
@@ -2662,7 +2584,6 @@ zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action)
2662 struct zfcp_adapter *adapter = erp_action->adapter; 2584 struct zfcp_adapter *adapter = erp_action->adapter;
2663 struct zfcp_port *port = erp_action->port; 2585 struct zfcp_port *port = erp_action->port;
2664 2586
2665 zfcp_erp_timeout_init(erp_action);
2666 retval = zfcp_fsf_close_port(erp_action); 2587 retval = zfcp_fsf_close_port(erp_action);
2667 if (retval == -ENOMEM) { 2588 if (retval == -ENOMEM) {
2668 debug_text_event(adapter->erp_dbf, 5, "p_pstc_nomem"); 2589 debug_text_event(adapter->erp_dbf, 5, "p_pstc_nomem");
@@ -2700,7 +2621,6 @@ zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action)
2700 struct zfcp_adapter *adapter = erp_action->adapter; 2621 struct zfcp_adapter *adapter = erp_action->adapter;
2701 struct zfcp_port *port = erp_action->port; 2622 struct zfcp_port *port = erp_action->port;
2702 2623
2703 zfcp_erp_timeout_init(erp_action);
2704 retval = zfcp_fsf_open_port(erp_action); 2624 retval = zfcp_fsf_open_port(erp_action);
2705 if (retval == -ENOMEM) { 2625 if (retval == -ENOMEM) {
2706 debug_text_event(adapter->erp_dbf, 5, "p_psto_nomem"); 2626 debug_text_event(adapter->erp_dbf, 5, "p_psto_nomem");
@@ -2738,7 +2658,6 @@ zfcp_erp_port_strategy_open_common_lookup(struct zfcp_erp_action *erp_action)
2738 struct zfcp_adapter *adapter = erp_action->adapter; 2658 struct zfcp_adapter *adapter = erp_action->adapter;
2739 struct zfcp_port *port = erp_action->port; 2659 struct zfcp_port *port = erp_action->port;
2740 2660
2741 zfcp_erp_timeout_init(erp_action);
2742 retval = zfcp_ns_gid_pn_request(erp_action); 2661 retval = zfcp_ns_gid_pn_request(erp_action);
2743 if (retval == -ENOMEM) { 2662 if (retval == -ENOMEM) {
2744 debug_text_event(adapter->erp_dbf, 5, "p_pstn_nomem"); 2663 debug_text_event(adapter->erp_dbf, 5, "p_pstn_nomem");
@@ -2864,7 +2783,6 @@ zfcp_erp_unit_strategy_close(struct zfcp_erp_action *erp_action)
2864 struct zfcp_adapter *adapter = erp_action->adapter; 2783 struct zfcp_adapter *adapter = erp_action->adapter;
2865 struct zfcp_unit *unit = erp_action->unit; 2784 struct zfcp_unit *unit = erp_action->unit;
2866 2785
2867 zfcp_erp_timeout_init(erp_action);
2868 retval = zfcp_fsf_close_unit(erp_action); 2786 retval = zfcp_fsf_close_unit(erp_action);
2869 if (retval == -ENOMEM) { 2787 if (retval == -ENOMEM) {
2870 debug_text_event(adapter->erp_dbf, 5, "u_ustc_nomem"); 2788 debug_text_event(adapter->erp_dbf, 5, "u_ustc_nomem");
@@ -2905,7 +2823,6 @@ zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action)
2905 struct zfcp_adapter *adapter = erp_action->adapter; 2823 struct zfcp_adapter *adapter = erp_action->adapter;
2906 struct zfcp_unit *unit = erp_action->unit; 2824 struct zfcp_unit *unit = erp_action->unit;
2907 2825
2908 zfcp_erp_timeout_init(erp_action);
2909 retval = zfcp_fsf_open_unit(erp_action); 2826 retval = zfcp_fsf_open_unit(erp_action);
2910 if (retval == -ENOMEM) { 2827 if (retval == -ENOMEM) {
2911 debug_text_event(adapter->erp_dbf, 5, "u_usto_nomem"); 2828 debug_text_event(adapter->erp_dbf, 5, "u_usto_nomem");
@@ -2930,14 +2847,13 @@ zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action)
2930 return retval; 2847 return retval;
2931} 2848}
2932 2849
2933static inline void 2850void zfcp_erp_start_timer(struct zfcp_fsf_req *fsf_req)
2934zfcp_erp_timeout_init(struct zfcp_erp_action *erp_action)
2935{ 2851{
2936 init_timer(&erp_action->timer); 2852 BUG_ON(!fsf_req->erp_action);
2937 erp_action->timer.function = zfcp_erp_timeout_handler; 2853 fsf_req->timer.function = zfcp_erp_timeout_handler;
2938 erp_action->timer.data = (unsigned long) erp_action; 2854 fsf_req->timer.data = (unsigned long) fsf_req->erp_action;
2939 /* jiffies will be added in zfcp_fsf_req_send */ 2855 fsf_req->timer.expires = jiffies + ZFCP_ERP_FSFREQ_TIMEOUT;
2940 erp_action->timer.expires = ZFCP_ERP_FSFREQ_TIMEOUT; 2856 add_timer(&fsf_req->timer);
2941} 2857}
2942 2858
2943/* 2859/*