aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-27 09:22:03 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:04 -0400
commit9467a9b3efdd9041202f71cc270bda827a7ec777 (patch)
tree9e7b8e167da9aa5065b1f7ed1d2a1ab9c2ad47da /drivers/s390/scsi/zfcp_erp.c
parent698ec01635819c5ae60090bb4efcbeffc41642fb (diff)
[SCSI] zfcp: Trace all triggers of error recovery activity
This patch allows any recovery event to be traced back to an exact cause, e.g. a particular request identified by an id (address). Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c213
1 files changed, 108 insertions, 105 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index bee03443efd..55e034b10de 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -26,13 +26,16 @@
26static int zfcp_erp_adisc(struct zfcp_port *); 26static int zfcp_erp_adisc(struct zfcp_port *);
27static void zfcp_erp_adisc_handler(unsigned long); 27static void zfcp_erp_adisc_handler(unsigned long);
28 28
29static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int); 29static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8,
30static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int); 30 u64);
31static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int); 31static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int, u8,
32static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int); 32 u64);
33static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int, u8, u64);
34static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int, u8, u64);
33 35
34static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int); 36static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int, u8,
35static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int); 37 u64);
38static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int, u8, u64);
36 39
37static void zfcp_erp_adapter_block(struct zfcp_adapter *, int); 40static void zfcp_erp_adapter_block(struct zfcp_adapter *, int);
38static void zfcp_erp_adapter_unblock(struct zfcp_adapter *); 41static void zfcp_erp_adapter_unblock(struct zfcp_adapter *);
@@ -97,7 +100,8 @@ static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *);
97static void zfcp_erp_action_dismiss(struct zfcp_erp_action *); 100static void zfcp_erp_action_dismiss(struct zfcp_erp_action *);
98 101
99static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *, 102static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *,
100 struct zfcp_port *, struct zfcp_unit *); 103 struct zfcp_port *, struct zfcp_unit *,
104 u8 id, u64 ref);
101static int zfcp_erp_action_dequeue(struct zfcp_erp_action *); 105static int zfcp_erp_action_dequeue(struct zfcp_erp_action *);
102static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *, 106static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *,
103 struct zfcp_port *, struct zfcp_unit *, 107 struct zfcp_port *, struct zfcp_unit *,
@@ -179,7 +183,7 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter)
179static void zfcp_fsf_request_timeout_handler(unsigned long data) 183static void zfcp_fsf_request_timeout_handler(unsigned long data)
180{ 184{
181 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; 185 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
182 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); 186 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 62, 0);
183} 187}
184 188
185void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) 189void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
@@ -200,8 +204,8 @@ void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
200 * returns: 0 - initiated action successfully 204 * returns: 0 - initiated action successfully
201 * <0 - failed to initiate action 205 * <0 - failed to initiate action
202 */ 206 */
203static int 207static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter,
204zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask) 208 int clear_mask, u8 id, u64 ref)
205{ 209{
206 int retval; 210 int retval;
207 211
@@ -221,7 +225,7 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask)
221 goto out; 225 goto out;
222 } 226 }
223 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, 227 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
224 adapter, NULL, NULL); 228 adapter, NULL, NULL, id, ref);
225 229
226 out: 230 out:
227 return retval; 231 return retval;
@@ -236,56 +240,56 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask)
236 * returns: 0 - initiated action successfully 240 * returns: 0 - initiated action successfully
237 * <0 - failed to initiate action 241 * <0 - failed to initiate action
238 */ 242 */
239int 243int zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask,
240zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask) 244 u8 id, u64 ref)
241{ 245{
242 int retval; 246 int retval;
243 unsigned long flags; 247 unsigned long flags;
244 248
245 read_lock_irqsave(&zfcp_data.config_lock, flags); 249 read_lock_irqsave(&zfcp_data.config_lock, flags);
246 write_lock(&adapter->erp_lock); 250 write_lock(&adapter->erp_lock);
247 retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask); 251 retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask, id, ref);
248 write_unlock(&adapter->erp_lock); 252 write_unlock(&adapter->erp_lock);
249 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 253 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
250 254
251 return retval; 255 return retval;
252} 256}
253 257
254int 258int zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask,
255zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask) 259 u8 id, u64 ref)
256{ 260{
257 int retval; 261 int retval;
258 262
259 retval = zfcp_erp_adapter_reopen(adapter, 263 retval = zfcp_erp_adapter_reopen(adapter,
260 ZFCP_STATUS_COMMON_RUNNING | 264 ZFCP_STATUS_COMMON_RUNNING |
261 ZFCP_STATUS_COMMON_ERP_FAILED | 265 ZFCP_STATUS_COMMON_ERP_FAILED |
262 clear_mask); 266 clear_mask, id, ref);
263 267
264 return retval; 268 return retval;
265} 269}
266 270
267int 271int zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask, u8 id,
268zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask) 272 u64 ref)
269{ 273{
270 int retval; 274 int retval;
271 275
272 retval = zfcp_erp_port_reopen(port, 276 retval = zfcp_erp_port_reopen(port,
273 ZFCP_STATUS_COMMON_RUNNING | 277 ZFCP_STATUS_COMMON_RUNNING |
274 ZFCP_STATUS_COMMON_ERP_FAILED | 278 ZFCP_STATUS_COMMON_ERP_FAILED |
275 clear_mask); 279 clear_mask, id, ref);
276 280
277 return retval; 281 return retval;
278} 282}
279 283
280int 284int zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask, u8 id,
281zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask) 285 u64 ref)
282{ 286{
283 int retval; 287 int retval;
284 288
285 retval = zfcp_erp_unit_reopen(unit, 289 retval = zfcp_erp_unit_reopen(unit,
286 ZFCP_STATUS_COMMON_RUNNING | 290 ZFCP_STATUS_COMMON_RUNNING |
287 ZFCP_STATUS_COMMON_ERP_FAILED | 291 ZFCP_STATUS_COMMON_ERP_FAILED |
288 clear_mask); 292 clear_mask, id, ref);
289 293
290 return retval; 294 return retval;
291} 295}
@@ -400,7 +404,7 @@ zfcp_erp_adisc_handler(unsigned long data)
400 "(adapter %s, port d_id=0x%06x)\n", 404 "(adapter %s, port d_id=0x%06x)\n",
401 zfcp_get_busid_by_adapter(adapter), d_id); 405 zfcp_get_busid_by_adapter(adapter), d_id);
402 debug_text_event(adapter->erp_dbf, 3, "forcreop"); 406 debug_text_event(adapter->erp_dbf, 3, "forcreop");
403 if (zfcp_erp_port_forced_reopen(port, 0)) 407 if (zfcp_erp_port_forced_reopen(port, 0, 63, 0))
404 ZFCP_LOG_NORMAL("failed reopen of port " 408 ZFCP_LOG_NORMAL("failed reopen of port "
405 "(adapter %s, wwpn=0x%016Lx)\n", 409 "(adapter %s, wwpn=0x%016Lx)\n",
406 zfcp_get_busid_by_port(port), 410 zfcp_get_busid_by_port(port),
@@ -427,7 +431,7 @@ zfcp_erp_adisc_handler(unsigned long data)
427 "adisc_resp_wwpn=0x%016Lx)\n", 431 "adisc_resp_wwpn=0x%016Lx)\n",
428 zfcp_get_busid_by_port(port), 432 zfcp_get_busid_by_port(port),
429 port->wwpn, (wwn_t) adisc->wwpn); 433 port->wwpn, (wwn_t) adisc->wwpn);
430 if (zfcp_erp_port_reopen(port, 0)) 434 if (zfcp_erp_port_reopen(port, 0, 64, 0))
431 ZFCP_LOG_NORMAL("failed reopen of port " 435 ZFCP_LOG_NORMAL("failed reopen of port "
432 "(adapter %s, wwpn=0x%016Lx)\n", 436 "(adapter %s, wwpn=0x%016Lx)\n",
433 zfcp_get_busid_by_port(port), 437 zfcp_get_busid_by_port(port),
@@ -461,7 +465,7 @@ zfcp_test_link(struct zfcp_port *port)
461 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx " 465 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx "
462 "on adapter %s\n ", port->wwpn, 466 "on adapter %s\n ", port->wwpn,
463 zfcp_get_busid_by_port(port)); 467 zfcp_get_busid_by_port(port));
464 retval = zfcp_erp_port_forced_reopen(port, 0); 468 retval = zfcp_erp_port_forced_reopen(port, 0, 65, 0);
465 if (retval != 0) { 469 if (retval != 0) {
466 ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx " 470 ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx "
467 "on adapter %s failed\n", port->wwpn, 471 "on adapter %s failed\n", port->wwpn,
@@ -484,8 +488,8 @@ zfcp_test_link(struct zfcp_port *port)
484 * returns: 0 - initiated action successfully 488 * returns: 0 - initiated action successfully
485 * <0 - failed to initiate action 489 * <0 - failed to initiate action
486 */ 490 */
487static int 491static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port,
488zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask) 492 int clear_mask, u8 id, u64 ref)
489{ 493{
490 int retval; 494 int retval;
491 struct zfcp_adapter *adapter = port->adapter; 495 struct zfcp_adapter *adapter = port->adapter;
@@ -509,7 +513,7 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask)
509 } 513 }
510 514
511 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, 515 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
512 port->adapter, port, NULL); 516 port->adapter, port, NULL, id, ref);
513 517
514 out: 518 out:
515 return retval; 519 return retval;
@@ -524,8 +528,8 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask)
524 * returns: 0 - initiated action successfully 528 * returns: 0 - initiated action successfully
525 * <0 - failed to initiate action 529 * <0 - failed to initiate action
526 */ 530 */
527int 531int zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask, u8 id,
528zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask) 532 u64 ref)
529{ 533{
530 int retval; 534 int retval;
531 unsigned long flags; 535 unsigned long flags;
@@ -534,7 +538,8 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask)
534 adapter = port->adapter; 538 adapter = port->adapter;
535 read_lock_irqsave(&zfcp_data.config_lock, flags); 539 read_lock_irqsave(&zfcp_data.config_lock, flags);
536 write_lock(&adapter->erp_lock); 540 write_lock(&adapter->erp_lock);
537 retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask); 541 retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask, id,
542 ref);
538 write_unlock(&adapter->erp_lock); 543 write_unlock(&adapter->erp_lock);
539 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 544 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
540 545
@@ -551,8 +556,8 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask)
551 * returns: 0 - initiated action successfully 556 * returns: 0 - initiated action successfully
552 * <0 - failed to initiate action 557 * <0 - failed to initiate action
553 */ 558 */
554static int 559static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask,
555zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask) 560 u8 id, u64 ref)
556{ 561{
557 int retval; 562 int retval;
558 struct zfcp_adapter *adapter = port->adapter; 563 struct zfcp_adapter *adapter = port->adapter;
@@ -578,7 +583,7 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask)
578 } 583 }
579 584
580 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT, 585 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT,
581 port->adapter, port, NULL); 586 port->adapter, port, NULL, id, ref);
582 587
583 out: 588 out:
584 return retval; 589 return retval;
@@ -594,8 +599,7 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask)
594 * correct locking. An error recovery task is initiated to do the reopen. 599 * correct locking. An error recovery task is initiated to do the reopen.
595 * To wait for the completion of the reopen zfcp_erp_wait should be used. 600 * To wait for the completion of the reopen zfcp_erp_wait should be used.
596 */ 601 */
597int 602int zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask, u8 id, u64 ref)
598zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
599{ 603{
600 int retval; 604 int retval;
601 unsigned long flags; 605 unsigned long flags;
@@ -603,7 +607,7 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
603 607
604 read_lock_irqsave(&zfcp_data.config_lock, flags); 608 read_lock_irqsave(&zfcp_data.config_lock, flags);
605 write_lock(&adapter->erp_lock); 609 write_lock(&adapter->erp_lock);
606 retval = zfcp_erp_port_reopen_internal(port, clear_mask); 610 retval = zfcp_erp_port_reopen_internal(port, clear_mask, id, ref);
607 write_unlock(&adapter->erp_lock); 611 write_unlock(&adapter->erp_lock);
608 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 612 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
609 613
@@ -620,8 +624,8 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
620 * returns: 0 - initiated action successfully 624 * returns: 0 - initiated action successfully
621 * <0 - failed to initiate action 625 * <0 - failed to initiate action
622 */ 626 */
623static int 627static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask,
624zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask) 628 u8 id, u64 ref)
625{ 629{
626 int retval; 630 int retval;
627 struct zfcp_adapter *adapter = unit->port->adapter; 631 struct zfcp_adapter *adapter = unit->port->adapter;
@@ -647,7 +651,7 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask)
647 } 651 }
648 652
649 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT, 653 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT,
650 unit->port->adapter, unit->port, unit); 654 adapter, unit->port, unit, id, ref);
651 out: 655 out:
652 return retval; 656 return retval;
653} 657}
@@ -662,8 +666,7 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask)
662 * locking. An error recovery task is initiated to do the reopen. 666 * locking. An error recovery task is initiated to do the reopen.
663 * To wait for the completion of the reopen zfcp_erp_wait should be used. 667 * To wait for the completion of the reopen zfcp_erp_wait should be used.
664 */ 668 */
665int 669int zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask, u8 id, u64 ref)
666zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask)
667{ 670{
668 int retval; 671 int retval;
669 unsigned long flags; 672 unsigned long flags;
@@ -675,7 +678,7 @@ zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask)
675 678
676 read_lock_irqsave(&zfcp_data.config_lock, flags); 679 read_lock_irqsave(&zfcp_data.config_lock, flags);
677 write_lock(&adapter->erp_lock); 680 write_lock(&adapter->erp_lock);
678 retval = zfcp_erp_unit_reopen_internal(unit, clear_mask); 681 retval = zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref);
679 write_unlock(&adapter->erp_lock); 682 write_unlock(&adapter->erp_lock);
680 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 683 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
681 684
@@ -1215,7 +1218,7 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
1215 "restarting I/O on adapter %s " 1218 "restarting I/O on adapter %s "
1216 "to free mempool\n", 1219 "to free mempool\n",
1217 zfcp_get_busid_by_adapter(adapter)); 1220 zfcp_get_busid_by_adapter(adapter));
1218 zfcp_erp_adapter_reopen_internal(adapter, 0); 1221 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, 0);
1219 } else { 1222 } else {
1220 debug_text_event(adapter->erp_dbf, 2, "a_st_memw"); 1223 debug_text_event(adapter->erp_dbf, 2, "a_st_memw");
1221 retval = zfcp_erp_strategy_memwait(erp_action); 1224 retval = zfcp_erp_strategy_memwait(erp_action);
@@ -1499,7 +1502,9 @@ zfcp_erp_strategy_statechange(int action,
1499 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 1502 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
1500 if (zfcp_erp_strategy_statechange_detected(&adapter->status, 1503 if (zfcp_erp_strategy_statechange_detected(&adapter->status,
1501 status)) { 1504 status)) {
1502 zfcp_erp_adapter_reopen_internal(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); 1505 zfcp_erp_adapter_reopen_internal(adapter,
1506 ZFCP_STATUS_COMMON_ERP_FAILED,
1507 67, 0);
1503 retval = ZFCP_ERP_EXIT; 1508 retval = ZFCP_ERP_EXIT;
1504 } 1509 }
1505 break; 1510 break;
@@ -1508,7 +1513,9 @@ zfcp_erp_strategy_statechange(int action,
1508 case ZFCP_ERP_ACTION_REOPEN_PORT: 1513 case ZFCP_ERP_ACTION_REOPEN_PORT:
1509 if (zfcp_erp_strategy_statechange_detected(&port->status, 1514 if (zfcp_erp_strategy_statechange_detected(&port->status,
1510 status)) { 1515 status)) {
1511 zfcp_erp_port_reopen_internal(port, ZFCP_STATUS_COMMON_ERP_FAILED); 1516 zfcp_erp_port_reopen_internal(port,
1517 ZFCP_STATUS_COMMON_ERP_FAILED,
1518 68, 0);
1512 retval = ZFCP_ERP_EXIT; 1519 retval = ZFCP_ERP_EXIT;
1513 } 1520 }
1514 break; 1521 break;
@@ -1516,7 +1523,9 @@ zfcp_erp_strategy_statechange(int action,
1516 case ZFCP_ERP_ACTION_REOPEN_UNIT: 1523 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1517 if (zfcp_erp_strategy_statechange_detected(&unit->status, 1524 if (zfcp_erp_strategy_statechange_detected(&unit->status,
1518 status)) { 1525 status)) {
1519 zfcp_erp_unit_reopen_internal(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 1526 zfcp_erp_unit_reopen_internal(unit,
1527 ZFCP_STATUS_COMMON_ERP_FAILED,
1528 69, 0);
1520 retval = ZFCP_ERP_EXIT; 1529 retval = ZFCP_ERP_EXIT;
1521 } 1530 }
1522 break; 1531 break;
@@ -1700,29 +1709,29 @@ zfcp_erp_strategy_followup_actions(int action,
1700 1709
1701 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 1710 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
1702 if (status == ZFCP_ERP_SUCCEEDED) 1711 if (status == ZFCP_ERP_SUCCEEDED)
1703 zfcp_erp_port_reopen_all_internal(adapter, 0); 1712 zfcp_erp_port_reopen_all_internal(adapter, 0, 70, 0);
1704 else 1713 else
1705 zfcp_erp_adapter_reopen_internal(adapter, 0); 1714 zfcp_erp_adapter_reopen_internal(adapter, 0, 71, 0);
1706 break; 1715 break;
1707 1716
1708 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: 1717 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
1709 if (status == ZFCP_ERP_SUCCEEDED) 1718 if (status == ZFCP_ERP_SUCCEEDED)
1710 zfcp_erp_port_reopen_internal(port, 0); 1719 zfcp_erp_port_reopen_internal(port, 0, 72, 0);
1711 else 1720 else
1712 zfcp_erp_adapter_reopen_internal(adapter, 0); 1721 zfcp_erp_adapter_reopen_internal(adapter, 0, 73, 0);
1713 break; 1722 break;
1714 1723
1715 case ZFCP_ERP_ACTION_REOPEN_PORT: 1724 case ZFCP_ERP_ACTION_REOPEN_PORT:
1716 if (status == ZFCP_ERP_SUCCEEDED) 1725 if (status == ZFCP_ERP_SUCCEEDED)
1717 zfcp_erp_unit_reopen_all_internal(port, 0); 1726 zfcp_erp_unit_reopen_all_internal(port, 0, 74, 0);
1718 else 1727 else
1719 zfcp_erp_port_forced_reopen_internal(port, 0); 1728 zfcp_erp_port_forced_reopen_internal(port, 0, 75, 0);
1720 break; 1729 break;
1721 1730
1722 case ZFCP_ERP_ACTION_REOPEN_UNIT: 1731 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1723 /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */ 1732 /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */
1724 if (status != ZFCP_ERP_SUCCEEDED) 1733 if (status != ZFCP_ERP_SUCCEEDED)
1725 zfcp_erp_port_reopen_internal(unit->port, 0); 1734 zfcp_erp_port_reopen_internal(unit->port, 0, 76, 0);
1726 break; 1735 break;
1727 } 1736 }
1728 1737
@@ -1863,30 +1872,32 @@ void zfcp_erp_modify_unit_status(struct zfcp_unit *unit, u8 id, u64 ref,
1863 * returns: 0 - initiated action successfully 1872 * returns: 0 - initiated action successfully
1864 * <0 - failed to initiate action 1873 * <0 - failed to initiate action
1865 */ 1874 */
1866int 1875int zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask,
1867zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask) 1876 u8 id, u64 ref)
1868{ 1877{
1869 int retval; 1878 int retval;
1870 unsigned long flags; 1879 unsigned long flags;
1871 1880
1872 read_lock_irqsave(&zfcp_data.config_lock, flags); 1881 read_lock_irqsave(&zfcp_data.config_lock, flags);
1873 write_lock(&adapter->erp_lock); 1882 write_lock(&adapter->erp_lock);
1874 retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask); 1883 retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask, id,
1884 ref);
1875 write_unlock(&adapter->erp_lock); 1885 write_unlock(&adapter->erp_lock);
1876 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 1886 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
1877 1887
1878 return retval; 1888 return retval;
1879} 1889}
1880 1890
1881static int 1891static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter,
1882zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask) 1892 int clear_mask, u8 id, u64 ref)
1883{ 1893{
1884 int retval = 0; 1894 int retval = 0;
1885 struct zfcp_port *port; 1895 struct zfcp_port *port;
1886 1896
1887 list_for_each_entry(port, &adapter->port_list_head, list) 1897 list_for_each_entry(port, &adapter->port_list_head, list)
1888 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 1898 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
1889 zfcp_erp_port_reopen_internal(port, clear_mask); 1899 zfcp_erp_port_reopen_internal(port, clear_mask, id,
1900 ref);
1890 1901
1891 return retval; 1902 return retval;
1892} 1903}
@@ -1898,14 +1909,14 @@ zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask)
1898 * 1909 *
1899 * returns: FIXME 1910 * returns: FIXME
1900 */ 1911 */
1901static int 1912static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port,
1902zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port, int clear_mask) 1913 int clear_mask, u8 id, u64 ref)
1903{ 1914{
1904 int retval = 0; 1915 int retval = 0;
1905 struct zfcp_unit *unit; 1916 struct zfcp_unit *unit;
1906 1917
1907 list_for_each_entry(unit, &port->unit_list_head, list) 1918 list_for_each_entry(unit, &port->unit_list_head, list)
1908 zfcp_erp_unit_reopen_internal(unit, clear_mask); 1919 zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref);
1909 1920
1910 return retval; 1921 return retval;
1911} 1922}
@@ -2466,8 +2477,8 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2466 /* nameserver port may live again */ 2477 /* nameserver port may live again */
2467 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, 2478 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
2468 &adapter->nameserver_port->status); 2479 &adapter->nameserver_port->status);
2469 if (zfcp_erp_port_reopen(adapter->nameserver_port, 0) 2480 if (zfcp_erp_port_reopen(adapter->nameserver_port, 0,
2470 >= 0) { 2481 77, (u64)erp_action) >= 0) {
2471 erp_action->step = 2482 erp_action->step =
2472 ZFCP_ERP_STEP_NAMESERVER_OPEN; 2483 ZFCP_ERP_STEP_NAMESERVER_OPEN;
2473 retval = ZFCP_ERP_CONTINUES; 2484 retval = ZFCP_ERP_CONTINUES;
@@ -2963,14 +2974,12 @@ void zfcp_erp_start_timer(struct zfcp_fsf_req *fsf_req)
2963 * 2974 *
2964 * returns: 2975 * returns:
2965 */ 2976 */
2966static int 2977static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2967zfcp_erp_action_enqueue(int action, 2978 struct zfcp_port *port,
2968 struct zfcp_adapter *adapter, 2979 struct zfcp_unit *unit, u8 id, u64 ref)
2969 struct zfcp_port *port, struct zfcp_unit *unit)
2970{ 2980{
2971 int retval = 1; 2981 int retval = 1, need = want;
2972 struct zfcp_erp_action *erp_action = NULL; 2982 struct zfcp_erp_action *erp_action = NULL;
2973 int stronger_action = 0;
2974 u32 status = 0; 2983 u32 status = 0;
2975 2984
2976 /* 2985 /*
@@ -2989,9 +2998,9 @@ zfcp_erp_action_enqueue(int action,
2989 &adapter->status)) 2998 &adapter->status))
2990 return -EIO; 2999 return -EIO;
2991 3000
2992 debug_event(adapter->erp_dbf, 4, &action, sizeof (int)); 3001 debug_event(adapter->erp_dbf, 4, &want, sizeof (int));
2993 /* check whether we really need this */ 3002 /* check whether we really need this */
2994 switch (action) { 3003 switch (want) {
2995 case ZFCP_ERP_ACTION_REOPEN_UNIT: 3004 case ZFCP_ERP_ACTION_REOPEN_UNIT:
2996 if (atomic_test_mask 3005 if (atomic_test_mask
2997 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) { 3006 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) {
@@ -3009,10 +3018,8 @@ zfcp_erp_action_enqueue(int action,
3009 goto out; 3018 goto out;
3010 } 3019 }
3011 if (!atomic_test_mask 3020 if (!atomic_test_mask
3012 (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) { 3021 (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status))
3013 stronger_action = ZFCP_ERP_ACTION_REOPEN_PORT; 3022 need = ZFCP_ERP_ACTION_REOPEN_PORT;
3014 unit = NULL;
3015 }
3016 /* fall through !!! */ 3023 /* fall through !!! */
3017 3024
3018 case ZFCP_ERP_ACTION_REOPEN_PORT: 3025 case ZFCP_ERP_ACTION_REOPEN_PORT:
@@ -3032,7 +3039,7 @@ zfcp_erp_action_enqueue(int action,
3032 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) { 3039 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) {
3033 ZFCP_LOG_INFO("dropped erp action %i (port " 3040 ZFCP_LOG_INFO("dropped erp action %i (port "
3034 "0x%016Lx, action in use: %i)\n", 3041 "0x%016Lx, action in use: %i)\n",
3035 action, port->wwpn, 3042 want, port->wwpn,
3036 port->erp_action.action); 3043 port->erp_action.action);
3037 debug_text_event(adapter->erp_dbf, 4, 3044 debug_text_event(adapter->erp_dbf, 4,
3038 "pf_actenq_drp"); 3045 "pf_actenq_drp");
@@ -3050,10 +3057,8 @@ zfcp_erp_action_enqueue(int action,
3050 goto out; 3057 goto out;
3051 } 3058 }
3052 if (!atomic_test_mask 3059 if (!atomic_test_mask
3053 (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) { 3060 (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status))
3054 stronger_action = ZFCP_ERP_ACTION_REOPEN_ADAPTER; 3061 need = ZFCP_ERP_ACTION_REOPEN_ADAPTER;
3055 port = NULL;
3056 }
3057 /* fall through !!! */ 3062 /* fall through !!! */
3058 3063
3059 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 3064 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
@@ -3066,30 +3071,28 @@ zfcp_erp_action_enqueue(int action,
3066 3071
3067 default: 3072 default:
3068 debug_text_exception(adapter->erp_dbf, 1, "a_actenq_bug"); 3073 debug_text_exception(adapter->erp_dbf, 1, "a_actenq_bug");
3069 debug_event(adapter->erp_dbf, 1, &action, sizeof (int)); 3074 debug_event(adapter->erp_dbf, 1, &want, sizeof (int));
3070 ZFCP_LOG_NORMAL("bug: unknown erp action requested " 3075 ZFCP_LOG_NORMAL("bug: unknown erp action requested "
3071 "on adapter %s (action=%d)\n", 3076 "on adapter %s (action=%d)\n",
3072 zfcp_get_busid_by_adapter(adapter), action); 3077 zfcp_get_busid_by_adapter(adapter), want);
3073 goto out; 3078 goto out;
3074 } 3079 }
3075 3080
3076 /* check whether we need something stronger first */ 3081 /* check whether we need something stronger first */
3077 if (stronger_action) { 3082 if (need) {
3078 debug_text_event(adapter->erp_dbf, 4, "a_actenq_str"); 3083 debug_text_event(adapter->erp_dbf, 4, "a_actenq_str");
3079 debug_event(adapter->erp_dbf, 4, &stronger_action, 3084 debug_event(adapter->erp_dbf, 4, &need,
3080 sizeof (int)); 3085 sizeof (int));
3081 ZFCP_LOG_DEBUG("stronger erp action %d needed before " 3086 ZFCP_LOG_DEBUG("stronger erp action %d needed before "
3082 "erp action %d on adapter %s\n", 3087 "erp action %d on adapter %s\n",
3083 stronger_action, action, 3088 need, want, zfcp_get_busid_by_adapter(adapter));
3084 zfcp_get_busid_by_adapter(adapter));
3085 action = stronger_action;
3086 } 3089 }
3087 3090
3088 /* mark adapter to have some error recovery pending */ 3091 /* mark adapter to have some error recovery pending */
3089 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); 3092 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
3090 3093
3091 /* setup error recovery action */ 3094 /* setup error recovery action */
3092 switch (action) { 3095 switch (need) {
3093 3096
3094 case ZFCP_ERP_ACTION_REOPEN_UNIT: 3097 case ZFCP_ERP_ACTION_REOPEN_UNIT:
3095 zfcp_unit_get(unit); 3098 zfcp_unit_get(unit);
@@ -3128,7 +3131,7 @@ zfcp_erp_action_enqueue(int action,
3128 erp_action->adapter = adapter; 3131 erp_action->adapter = adapter;
3129 erp_action->port = port; 3132 erp_action->port = port;
3130 erp_action->unit = unit; 3133 erp_action->unit = unit;
3131 erp_action->action = action; 3134 erp_action->action = need;
3132 erp_action->status = status; 3135 erp_action->status = status;
3133 3136
3134 ++adapter->erp_total_count; 3137 ++adapter->erp_total_count;
@@ -3139,6 +3142,8 @@ zfcp_erp_action_enqueue(int action,
3139 zfcp_rec_dbf_event_thread(1, adapter, 0); 3142 zfcp_rec_dbf_event_thread(1, adapter, 0);
3140 retval = 0; 3143 retval = 0;
3141 out: 3144 out:
3145 zfcp_rec_dbf_event_trigger(id, ref, want, need, (u64)erp_action,
3146 adapter, port, unit);
3142 return retval; 3147 return retval;
3143} 3148}
3144 3149
@@ -3322,7 +3327,7 @@ void zfcp_erp_port_boxed(struct zfcp_port *port, u8 id, u64 ref)
3322 zfcp_erp_modify_port_status(port, id, ref, 3327 zfcp_erp_modify_port_status(port, id, ref,
3323 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 3328 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
3324 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3329 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3325 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); 3330 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
3326} 3331}
3327 3332
3328void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref) 3333void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref)
@@ -3333,7 +3338,7 @@ void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref)
3333 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3338 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
3334 zfcp_erp_modify_unit_status(unit, id, ref, 3339 zfcp_erp_modify_unit_status(unit, id, ref,
3335 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 3340 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
3336 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 3341 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
3337} 3342}
3338 3343
3339void zfcp_erp_port_access_denied(struct zfcp_port *port, u8 id, u64 ref) 3344void zfcp_erp_port_access_denied(struct zfcp_port *port, u8 id, u64 ref)
@@ -3361,8 +3366,8 @@ void zfcp_erp_unit_access_denied(struct zfcp_unit *unit, u8 id, u64 ref)
3361 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3366 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
3362} 3367}
3363 3368
3364void 3369void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id,
3365zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) 3370 u64 ref)
3366{ 3371{
3367 struct zfcp_port *port; 3372 struct zfcp_port *port;
3368 unsigned long flags; 3373 unsigned long flags;
@@ -3375,15 +3380,14 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
3375 3380
3376 read_lock_irqsave(&zfcp_data.config_lock, flags); 3381 read_lock_irqsave(&zfcp_data.config_lock, flags);
3377 if (adapter->nameserver_port) 3382 if (adapter->nameserver_port)
3378 zfcp_erp_port_access_changed(adapter->nameserver_port); 3383 zfcp_erp_port_access_changed(adapter->nameserver_port, id, ref);
3379 list_for_each_entry(port, &adapter->port_list_head, list) 3384 list_for_each_entry(port, &adapter->port_list_head, list)
3380 if (port != adapter->nameserver_port) 3385 if (port != adapter->nameserver_port)
3381 zfcp_erp_port_access_changed(port); 3386 zfcp_erp_port_access_changed(port, id, ref);
3382 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3387 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3383} 3388}
3384 3389
3385void 3390void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, u64 ref)
3386zfcp_erp_port_access_changed(struct zfcp_port *port)
3387{ 3391{
3388 struct zfcp_adapter *adapter = port->adapter; 3392 struct zfcp_adapter *adapter = port->adapter;
3389 struct zfcp_unit *unit; 3393 struct zfcp_unit *unit;
@@ -3397,21 +3401,20 @@ zfcp_erp_port_access_changed(struct zfcp_port *port)
3397 &port->status)) { 3401 &port->status)) {
3398 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 3402 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
3399 list_for_each_entry(unit, &port->unit_list_head, list) 3403 list_for_each_entry(unit, &port->unit_list_head, list)
3400 zfcp_erp_unit_access_changed(unit); 3404 zfcp_erp_unit_access_changed(unit, id, ref);
3401 return; 3405 return;
3402 } 3406 }
3403 3407
3404 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " 3408 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
3405 "(due to ACT update)\n", 3409 "(due to ACT update)\n",
3406 port->wwpn, zfcp_get_busid_by_adapter(adapter)); 3410 port->wwpn, zfcp_get_busid_by_adapter(adapter));
3407 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) 3411 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
3408 ZFCP_LOG_NORMAL("failed reopen of port" 3412 ZFCP_LOG_NORMAL("failed reopen of port"
3409 "(adapter %s, wwpn=0x%016Lx)\n", 3413 "(adapter %s, wwpn=0x%016Lx)\n",
3410 zfcp_get_busid_by_adapter(adapter), port->wwpn); 3414 zfcp_get_busid_by_adapter(adapter), port->wwpn);
3411} 3415}
3412 3416
3413void 3417void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, u64 ref)
3414zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
3415{ 3418{
3416 struct zfcp_adapter *adapter = unit->port->adapter; 3419 struct zfcp_adapter *adapter = unit->port->adapter;
3417 3420
@@ -3428,7 +3431,7 @@ zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
3428 " on adapter %s (due to ACT update)\n", 3431 " on adapter %s (due to ACT update)\n",
3429 unit->fcp_lun, unit->port->wwpn, 3432 unit->fcp_lun, unit->port->wwpn,
3430 zfcp_get_busid_by_adapter(adapter)); 3433 zfcp_get_busid_by_adapter(adapter));
3431 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) 3434 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
3432 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, " 3435 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
3433 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", 3436 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
3434 zfcp_get_busid_by_adapter(adapter), 3437 zfcp_get_busid_by_adapter(adapter),