aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2010-09-08 08:40:01 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-09-16 22:54:23 -0400
commitedaed859e63aac174fcc3fed81886b91bb124661 (patch)
treeb79ef611b8cf2bfe9e819ae130eff326ee553234 /drivers/s390/scsi
parentc9ff5d0315231b133a43e5af842bc01fb474f0d7 (diff)
[SCSI] zfcp: Replace status modifier functions.
Replace the zfcp_modify_<xxx>_status functions and its accompanying wrappers with dedicated status modifier functions. This eases code readability and maintenance. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c8
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c22
-rw-r--r--drivers/s390/scsi/zfcp_def.h5
-rw-r--r--drivers/s390/scsi/zfcp_erp.c258
-rw-r--r--drivers/s390/scsi/zfcp_ext.h17
-rw-r--r--drivers/s390/scsi/zfcp_fc.c2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c72
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c3
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c10
9 files changed, 189 insertions, 208 deletions
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index bdf2f38e4b13..0833c2b51e39 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -46,8 +46,7 @@ static int zfcp_ccw_activate(struct ccw_device *cdev)
46 if (!adapter) 46 if (!adapter)
47 return 0; 47 return 0;
48 48
49 zfcp_erp_modify_adapter_status(adapter, "ccresu1", NULL, 49 zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING);
50 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
51 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 50 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
52 "ccresu2", NULL); 51 "ccresu2", NULL);
53 zfcp_erp_wait(adapter); 52 zfcp_erp_wait(adapter);
@@ -217,9 +216,8 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event)
217 break; 216 break;
218 case CIO_OPER: 217 case CIO_OPER:
219 dev_info(&cdev->dev, "The FCP device is operational again\n"); 218 dev_info(&cdev->dev, "The FCP device is operational again\n");
220 zfcp_erp_modify_adapter_status(adapter, "ccnoti3", NULL, 219 zfcp_erp_set_adapter_status(adapter,
221 ZFCP_STATUS_COMMON_RUNNING, 220 ZFCP_STATUS_COMMON_RUNNING);
222 ZFCP_SET);
223 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 221 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
224 "ccnoti4", NULL); 222 "ccnoti4", NULL);
225 break; 223 break;
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index f952b89b108a..a56d14166c99 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -328,9 +328,9 @@ void zfcp_cfdc_port_denied(struct zfcp_port *port,
328 328
329 zfcp_act_eval_err(port->adapter, qual->halfword[0]); 329 zfcp_act_eval_err(port->adapter, qual->halfword[0]);
330 zfcp_act_eval_err(port->adapter, qual->halfword[1]); 330 zfcp_act_eval_err(port->adapter, qual->halfword[1]);
331 zfcp_erp_modify_port_status(port, "cfadp_1", NULL, 331 zfcp_erp_set_port_status(port,
332 ZFCP_STATUS_COMMON_ERP_FAILED | 332 ZFCP_STATUS_COMMON_ERP_FAILED |
333 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 333 ZFCP_STATUS_COMMON_ACCESS_DENIED);
334} 334}
335 335
336/** 336/**
@@ -349,9 +349,9 @@ void zfcp_cfdc_lun_denied(struct scsi_device *sdev,
349 (unsigned long long)zfcp_sdev->port->wwpn); 349 (unsigned long long)zfcp_sdev->port->wwpn);
350 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[0]); 350 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[0]);
351 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[1]); 351 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[1]);
352 zfcp_erp_modify_lun_status(sdev, "cfadl_1", NULL, 352 zfcp_erp_set_lun_status(sdev,
353 ZFCP_STATUS_COMMON_ERP_FAILED | 353 ZFCP_STATUS_COMMON_ERP_FAILED |
354 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 354 ZFCP_STATUS_COMMON_ACCESS_DENIED);
355 355
356 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); 356 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
357 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); 357 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
@@ -378,9 +378,9 @@ void zfcp_cfdc_lun_shrng_vltn(struct scsi_device *sdev,
378 else 378 else
379 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->word[2]); 379 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->word[2]);
380 380
381 zfcp_erp_modify_lun_status(sdev, "fsosh_3", NULL, 381 zfcp_erp_set_lun_status(sdev,
382 ZFCP_STATUS_COMMON_ERP_FAILED | 382 ZFCP_STATUS_COMMON_ERP_FAILED |
383 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 383 ZFCP_STATUS_COMMON_ACCESS_DENIED);
384 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); 384 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
385 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); 385 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
386} 386}
@@ -424,7 +424,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev,
424 "not supported (LUN 0x%016Lx, port 0x%016Lx)\n", 424 "not supported (LUN 0x%016Lx, port 0x%016Lx)\n",
425 zfcp_scsi_dev_lun(sdev), 425 zfcp_scsi_dev_lun(sdev),
426 (unsigned long long)zfcp_sdev->port->wwpn); 426 (unsigned long long)zfcp_sdev->port->wwpn);
427 zfcp_erp_lun_failed(sdev, "fsosh_5", NULL); 427 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
428 zfcp_erp_lun_shutdown(sdev, 0, "fsouh_6", NULL); 428 zfcp_erp_lun_shutdown(sdev, 0, "fsouh_6", NULL);
429 return -EACCES; 429 return -EACCES;
430 } 430 }
@@ -435,7 +435,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev,
435 "(LUN 0x%016Lx, port 0x%016Lx)\n", 435 "(LUN 0x%016Lx, port 0x%016Lx)\n",
436 zfcp_scsi_dev_lun(sdev), 436 zfcp_scsi_dev_lun(sdev),
437 (unsigned long long)zfcp_sdev->port->wwpn); 437 (unsigned long long)zfcp_sdev->port->wwpn);
438 zfcp_erp_lun_failed(sdev, "fsosh_7", NULL); 438 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
439 zfcp_erp_lun_shutdown(sdev, 0, "fsosh_8", NULL); 439 zfcp_erp_lun_shutdown(sdev, 0, "fsosh_8", NULL);
440 return -EACCES; 440 return -EACCES;
441 } 441 }
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 6dfae7091aa4..9ae1d0a6f627 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -325,9 +325,4 @@ struct zfcp_data {
325 struct kmem_cache *adisc_cache; 325 struct kmem_cache *adisc_cache;
326}; 326};
327 327
328/********************** ZFCP SPECIFIC DEFINES ********************************/
329
330#define ZFCP_SET 0x00000100
331#define ZFCP_CLEAR 0x00000200
332
333#endif /* ZFCP_DEF_H */ 328#endif /* ZFCP_DEF_H */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 9e7d029ac7a2..d37c7331f244 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -57,9 +57,8 @@ enum zfcp_erp_act_result {
57 57
58static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask) 58static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask)
59{ 59{
60 zfcp_erp_modify_adapter_status(adapter, "erablk1", NULL, 60 zfcp_erp_clear_adapter_status(adapter,
61 ZFCP_STATUS_COMMON_UNBLOCKED | mask, 61 ZFCP_STATUS_COMMON_UNBLOCKED | mask);
62 ZFCP_CLEAR);
63} 62}
64 63
65static int zfcp_erp_action_exists(struct zfcp_erp_action *act) 64static int zfcp_erp_action_exists(struct zfcp_erp_action *act)
@@ -266,7 +265,8 @@ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
266 265
267 /* ensure propagation of failed status to new devices */ 266 /* ensure propagation of failed status to new devices */
268 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { 267 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
269 zfcp_erp_adapter_failed(adapter, "erareo1", NULL); 268 zfcp_erp_set_adapter_status(adapter,
269 ZFCP_STATUS_COMMON_ERP_FAILED);
270 return -EIO; 270 return -EIO;
271 } 271 }
272 return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, 272 return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
@@ -290,7 +290,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear,
290 290
291 write_lock_irqsave(&adapter->erp_lock, flags); 291 write_lock_irqsave(&adapter->erp_lock, flags);
292 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) 292 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
293 zfcp_erp_adapter_failed(adapter, "erareo1", NULL); 293 zfcp_erp_set_adapter_status(adapter,
294 ZFCP_STATUS_COMMON_ERP_FAILED);
294 else 295 else
295 zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter, 296 zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
296 NULL, NULL, id, ref, 0); 297 NULL, NULL, id, ref, 0);
@@ -327,9 +328,8 @@ void zfcp_erp_port_shutdown(struct zfcp_port *port, int clear, char *id,
327 328
328static void zfcp_erp_port_block(struct zfcp_port *port, int clear) 329static void zfcp_erp_port_block(struct zfcp_port *port, int clear)
329{ 330{
330 zfcp_erp_modify_port_status(port, "erpblk1", NULL, 331 zfcp_erp_clear_port_status(port,
331 ZFCP_STATUS_COMMON_UNBLOCKED | clear, 332 ZFCP_STATUS_COMMON_UNBLOCKED | clear);
332 ZFCP_CLEAR);
333} 333}
334 334
335static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, 335static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port,
@@ -370,7 +370,7 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id,
370 370
371 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { 371 if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
372 /* ensure propagation of failed status to new devices */ 372 /* ensure propagation of failed status to new devices */
373 zfcp_erp_port_failed(port, "erpreo1", NULL); 373 zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
374 return -EIO; 374 return -EIO;
375 } 375 }
376 376
@@ -400,9 +400,8 @@ int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref)
400 400
401static void zfcp_erp_lun_block(struct scsi_device *sdev, int clear_mask) 401static void zfcp_erp_lun_block(struct scsi_device *sdev, int clear_mask)
402{ 402{
403 zfcp_erp_modify_lun_status(sdev, "erlblk1", NULL, 403 zfcp_erp_clear_lun_status(sdev,
404 ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, 404 ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask);
405 ZFCP_CLEAR);
406} 405}
407 406
408static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id, 407static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
@@ -483,11 +482,6 @@ static int status_change_set(unsigned long mask, atomic_t *status)
483 return (atomic_read(status) ^ mask) & mask; 482 return (atomic_read(status) ^ mask) & mask;
484} 483}
485 484
486static int status_change_clear(unsigned long mask, atomic_t *status)
487{
488 return atomic_read(status) & mask;
489}
490
491static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) 485static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter)
492{ 486{
493 if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) 487 if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status))
@@ -779,8 +773,7 @@ static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act)
779 adapter->fsf_req_seq_no = 0; 773 adapter->fsf_req_seq_no = 0;
780 zfcp_fc_wka_ports_force_offline(adapter->gs); 774 zfcp_fc_wka_ports_force_offline(adapter->gs);
781 /* all ports and LUNs are closed */ 775 /* all ports and LUNs are closed */
782 zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL, 776 zfcp_erp_clear_adapter_status(adapter, ZFCP_STATUS_COMMON_OPEN);
783 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
784 777
785 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK | 778 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK |
786 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); 779 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status);
@@ -897,7 +890,7 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act)
897 struct zfcp_port *port = act->port; 890 struct zfcp_port *port = act->port;
898 891
899 if (port->wwpn != adapter->peer_wwpn) { 892 if (port->wwpn != adapter->peer_wwpn) {
900 zfcp_erp_port_failed(port, "eroptp1", NULL); 893 zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
901 return ZFCP_ERP_FAILED; 894 return ZFCP_ERP_FAILED;
902 } 895 }
903 port->d_id = adapter->peer_d_id; 896 port->d_id = adapter->peer_d_id;
@@ -1042,7 +1035,8 @@ static int zfcp_erp_strategy_check_lun(struct scsi_device *sdev, int result)
1042 "port 0x%016Lx\n", 1035 "port 0x%016Lx\n",
1043 (unsigned long long)zfcp_scsi_dev_lun(sdev), 1036 (unsigned long long)zfcp_scsi_dev_lun(sdev),
1044 (unsigned long long)zfcp_sdev->port->wwpn); 1037 (unsigned long long)zfcp_sdev->port->wwpn);
1045 zfcp_erp_lun_failed(sdev, "ersckl1", NULL); 1038 zfcp_erp_set_lun_status(sdev,
1039 ZFCP_STATUS_COMMON_ERP_FAILED);
1046 } 1040 }
1047 break; 1041 break;
1048 } 1042 }
@@ -1072,7 +1066,8 @@ static int zfcp_erp_strategy_check_port(struct zfcp_port *port, int result)
1072 dev_err(&port->adapter->ccw_device->dev, 1066 dev_err(&port->adapter->ccw_device->dev,
1073 "ERP failed for remote port 0x%016Lx\n", 1067 "ERP failed for remote port 0x%016Lx\n",
1074 (unsigned long long)port->wwpn); 1068 (unsigned long long)port->wwpn);
1075 zfcp_erp_port_failed(port, "erpsck1", NULL); 1069 zfcp_erp_set_port_status(port,
1070 ZFCP_STATUS_COMMON_ERP_FAILED);
1076 } 1071 }
1077 break; 1072 break;
1078 } 1073 }
@@ -1099,7 +1094,8 @@ static int zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter,
1099 dev_err(&adapter->ccw_device->dev, 1094 dev_err(&adapter->ccw_device->dev,
1100 "ERP cannot recover an error " 1095 "ERP cannot recover an error "
1101 "on the FCP device\n"); 1096 "on the FCP device\n");
1102 zfcp_erp_adapter_failed(adapter, "erasck1", NULL); 1097 zfcp_erp_set_adapter_status(adapter,
1098 ZFCP_STATUS_COMMON_ERP_FAILED);
1103 } 1099 }
1104 break; 1100 break;
1105 } 1101 }
@@ -1421,175 +1417,159 @@ void zfcp_erp_thread_kill(struct zfcp_adapter *adapter)
1421} 1417}
1422 1418
1423/** 1419/**
1424 * zfcp_erp_adapter_failed - Set adapter status to failed. 1420 * zfcp_erp_wait - wait for completion of error recovery on an adapter
1425 * @adapter: Failed adapter. 1421 * @adapter: adapter for which to wait for completion of its error recovery
1426 * @id: Event id for debug trace.
1427 * @ref: Reference for debug trace.
1428 */ 1422 */
1429void zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, char *id, void *ref) 1423void zfcp_erp_wait(struct zfcp_adapter *adapter)
1430{ 1424{
1431 zfcp_erp_modify_adapter_status(adapter, id, ref, 1425 wait_event(adapter->erp_done_wqh,
1432 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1426 !(atomic_read(&adapter->status) &
1427 ZFCP_STATUS_ADAPTER_ERP_PENDING));
1433} 1428}
1434 1429
1435/** 1430/**
1436 * zfcp_erp_port_failed - Set port status to failed. 1431 * zfcp_erp_set_adapter_status - set adapter status bits
1437 * @port: Failed port. 1432 * @adapter: adapter to change the status
1438 * @id: Event id for debug trace. 1433 * @mask: status bits to change
1439 * @ref: Reference for debug trace. 1434 *
1435 * Changes in common status bits are propagated to attached ports and LUNs.
1440 */ 1436 */
1441void zfcp_erp_port_failed(struct zfcp_port *port, char *id, void *ref) 1437void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask)
1442{ 1438{
1443 zfcp_erp_modify_port_status(port, id, ref, 1439 struct zfcp_port *port;
1444 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1440 struct scsi_device *sdev;
1445} 1441 unsigned long flags;
1442 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
1446 1443
1447/** 1444 atomic_set_mask(mask, &adapter->status);
1448 * zfcp_erp_lun_failed - Set LUN status to failed.
1449 * @sdev: Failed SCSI device / LUN
1450 * @id: Event id for debug trace.
1451 * @ref: Reference for debug trace.
1452 */
1453void zfcp_erp_lun_failed(struct scsi_device *sdev, char *id, void *ref)
1454{
1455 zfcp_erp_modify_lun_status(sdev, id, ref,
1456 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1457}
1458 1445
1459/** 1446 if (!common_mask)
1460 * zfcp_erp_wait - wait for completion of error recovery on an adapter 1447 return;
1461 * @adapter: adapter for which to wait for completion of its error recovery 1448
1462 */ 1449 read_lock_irqsave(&adapter->port_list_lock, flags);
1463void zfcp_erp_wait(struct zfcp_adapter *adapter) 1450 list_for_each_entry(port, &adapter->port_list, list)
1464{ 1451 atomic_set_mask(common_mask, &port->status);
1465 wait_event(adapter->erp_done_wqh, 1452 read_unlock_irqrestore(&adapter->port_list_lock, flags);
1466 !(atomic_read(&adapter->status) & 1453
1467 ZFCP_STATUS_ADAPTER_ERP_PENDING)); 1454 shost_for_each_device(sdev, adapter->scsi_host)
1455 atomic_set_mask(common_mask, &sdev_to_zfcp(sdev)->status);
1468} 1456}
1469 1457
1470/** 1458/**
1471 * zfcp_erp_modify_adapter_status - change adapter status bits 1459 * zfcp_erp_clear_adapter_status - clear adapter status bits
1472 * @adapter: adapter to change the status 1460 * @adapter: adapter to change the status
1473 * @id: id for the debug trace
1474 * @ref: reference for the debug trace
1475 * @mask: status bits to change 1461 * @mask: status bits to change
1476 * @set_or_clear: ZFCP_SET or ZFCP_CLEAR
1477 * 1462 *
1478 * Changes in common status bits are propagated to attached ports and LUNs. 1463 * Changes in common status bits are propagated to attached ports and LUNs.
1479 */ 1464 */
1480void zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, char *id, 1465void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask)
1481 void *ref, u32 mask, int set_or_clear)
1482{ 1466{
1483 struct zfcp_port *port; 1467 struct zfcp_port *port;
1468 struct scsi_device *sdev;
1484 unsigned long flags; 1469 unsigned long flags;
1485 u32 common_mask = mask & ZFCP_COMMON_FLAGS; 1470 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
1471 u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
1486 1472
1487 if (set_or_clear == ZFCP_SET) { 1473 atomic_clear_mask(mask, &adapter->status);
1488 if (status_change_set(mask, &adapter->status)) 1474
1489 zfcp_dbf_rec_adapter(id, ref, adapter->dbf); 1475 if (!common_mask)
1490 atomic_set_mask(mask, &adapter->status); 1476 return;
1491 } else { 1477
1492 if (status_change_clear(mask, &adapter->status)) 1478 if (clear_counter)
1493 zfcp_dbf_rec_adapter(id, ref, adapter->dbf); 1479 atomic_set(&adapter->erp_counter, 0);
1494 atomic_clear_mask(mask, &adapter->status); 1480
1495 if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) 1481 read_lock_irqsave(&adapter->port_list_lock, flags);
1496 atomic_set(&adapter->erp_counter, 0); 1482 list_for_each_entry(port, &adapter->port_list, list) {
1483 atomic_clear_mask(common_mask, &port->status);
1484 if (clear_counter)
1485 atomic_set(&port->erp_counter, 0);
1497 } 1486 }
1487 read_unlock_irqrestore(&adapter->port_list_lock, flags);
1498 1488
1499 if (common_mask) { 1489 shost_for_each_device(sdev, adapter->scsi_host) {
1500 read_lock_irqsave(&adapter->port_list_lock, flags); 1490 atomic_clear_mask(common_mask, &sdev_to_zfcp(sdev)->status);
1501 list_for_each_entry(port, &adapter->port_list, list) 1491 if (clear_counter)
1502 zfcp_erp_modify_port_status(port, id, ref, common_mask, 1492 atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
1503 set_or_clear);
1504 read_unlock_irqrestore(&adapter->port_list_lock, flags);
1505 } 1493 }
1506} 1494}
1507 1495
1508/** 1496/**
1509 * zfcp_erp_modify_port_status - change port status bits 1497 * zfcp_erp_set_port_status - set port status bits
1510 * @port: port to change the status bits 1498 * @port: port to change the status
1511 * @id: id for the debug trace
1512 * @ref: reference for the debug trace
1513 * @mask: status bits to change 1499 * @mask: status bits to change
1514 * @set_or_clear: ZFCP_SET or ZFCP_CLEAR
1515 * 1500 *
1516 * Changes in common status bits are propagated to attached LUNs. 1501 * Changes in common status bits are propagated to attached LUNs.
1517 */ 1502 */
1518void zfcp_erp_modify_port_status(struct zfcp_port *port, char *id, void *ref, 1503void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask)
1519 u32 mask, int set_or_clear)
1520{ 1504{
1521 struct scsi_device *sdev; 1505 struct scsi_device *sdev;
1522 u32 common_mask = mask & ZFCP_COMMON_FLAGS; 1506 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
1523 1507
1524 if (set_or_clear == ZFCP_SET) { 1508 atomic_set_mask(mask, &port->status);
1525 if (status_change_set(mask, &port->status))
1526 zfcp_dbf_rec_port(id, ref, port);
1527 atomic_set_mask(mask, &port->status);
1528 } else {
1529 if (status_change_clear(mask, &port->status))
1530 zfcp_dbf_rec_port(id, ref, port);
1531 atomic_clear_mask(mask, &port->status);
1532 if (mask & ZFCP_STATUS_COMMON_ERP_FAILED)
1533 atomic_set(&port->erp_counter, 0);
1534 }
1535 1509
1536 if (common_mask) 1510 if (!common_mask)
1537 shost_for_each_device(sdev, port->adapter->scsi_host) 1511 return;
1538 if (sdev_to_zfcp(sdev)->port == port) 1512
1539 zfcp_erp_modify_lun_status(sdev, id, ref, 1513 shost_for_each_device(sdev, port->adapter->scsi_host)
1540 common_mask, 1514 if (sdev_to_zfcp(sdev)->port == port)
1541 set_or_clear); 1515 atomic_set_mask(common_mask,
1516 &sdev_to_zfcp(sdev)->status);
1542} 1517}
1543 1518
1544/** 1519/**
1545 * zfcp_erp_modify_lun_status - change LUN status bits 1520 * zfcp_erp_clear_port_status - clear port status bits
1546 * @sdev: SCSI device / LUN where to change the status bits 1521 * @port: adapter to change the status
1547 * @id: id for the debug trace
1548 * @ref: reference for the debug trace
1549 * @mask: status bits to change 1522 * @mask: status bits to change
1550 * @set_or_clear: ZFCP_SET or ZFCP_CLEAR 1523 *
1524 * Changes in common status bits are propagated to attached LUNs.
1551 */ 1525 */
1552void zfcp_erp_modify_lun_status(struct scsi_device *sdev, char *id, void *ref, 1526void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)
1553 u32 mask, int set_or_clear)
1554{ 1527{
1555 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); 1528 struct scsi_device *sdev;
1529 u32 common_mask = mask & ZFCP_COMMON_FLAGS;
1530 u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
1531
1532 atomic_clear_mask(mask, &port->status);
1533
1534 if (!common_mask)
1535 return;
1556 1536
1557 if (set_or_clear == ZFCP_SET) { 1537 if (clear_counter)
1558 if (status_change_set(mask, &zfcp_sdev->status)) 1538 atomic_set(&port->erp_counter, 0);
1559 zfcp_dbf_rec_lun(id, ref, sdev); 1539
1560 atomic_set_mask(mask, &zfcp_sdev->status); 1540 shost_for_each_device(sdev, port->adapter->scsi_host)
1561 } else { 1541 if (sdev_to_zfcp(sdev)->port == port) {
1562 if (status_change_clear(mask, &zfcp_sdev->status)) 1542 atomic_clear_mask(common_mask,
1563 zfcp_dbf_rec_lun(id, ref, sdev); 1543 &sdev_to_zfcp(sdev)->status);
1564 atomic_clear_mask(mask, &zfcp_sdev->status); 1544 if (clear_counter)
1565 if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) { 1545 atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
1566 atomic_set(&zfcp_sdev->erp_counter, 0);
1567 } 1546 }
1568 }
1569} 1547}
1570 1548
1571/** 1549/**
1572 * zfcp_erp_port_boxed - Mark port as "boxed" and start ERP 1550 * zfcp_erp_set_lun_status - set lun status bits
1573 * @port: The "boxed" port. 1551 * @sdev: SCSI device / lun to set the status bits
1574 * @id: The debug trace id. 1552 * @mask: status bits to change
1575 * @id: Reference for the debug trace.
1576 */ 1553 */
1577void zfcp_erp_port_boxed(struct zfcp_port *port, char *id, void *ref) 1554void zfcp_erp_set_lun_status(struct scsi_device *sdev, u32 mask)
1578{ 1555{
1579 zfcp_erp_modify_port_status(port, id, ref, 1556 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
1580 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 1557
1581 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); 1558 atomic_set_mask(mask, &zfcp_sdev->status);
1582} 1559}
1583 1560
1584/** 1561/**
1585 * zfcp_erp_lun_boxed - Mark LUN as "boxed" and start ERP 1562 * zfcp_erp_clear_lun_status - clear lun status bits
1586 * @sdev: The "boxed" SCSI device / LUN. 1563 * @sdev: SCSi device / lun to clear the status bits
1587 * @id: The debug trace id. 1564 * @mask: status bits to change
1588 * @ref: Reference for the debug trace.
1589 */ 1565 */
1590void zfcp_erp_lun_boxed(struct scsi_device *sdev, char *id, void *ref) 1566void zfcp_erp_clear_lun_status(struct scsi_device *sdev, u32 mask)
1591{ 1567{
1592 zfcp_erp_modify_lun_status(sdev, id, ref, 1568 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
1593 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 1569
1594 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); 1570 atomic_clear_mask(mask, &zfcp_sdev->status);
1571
1572 if (mask & ZFCP_STATUS_COMMON_ERP_FAILED)
1573 atomic_set(&zfcp_sdev->erp_counter, 0);
1595} 1574}
1575
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 7320132a430c..bf8f3e514839 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -71,31 +71,26 @@ extern void _zfcp_dbf_scsi(const char *, const char *, int, struct zfcp_dbf *,
71 unsigned long); 71 unsigned long);
72 72
73/* zfcp_erp.c */ 73/* zfcp_erp.c */
74extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, char *, 74extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
75 void *, u32, int); 75extern void zfcp_erp_clear_adapter_status(struct zfcp_adapter *, u32);
76extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *, void *); 76extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *, void *);
77extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *, 77extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *,
78 void *); 78 void *);
79extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, char *, void *); 79extern void zfcp_erp_set_port_status(struct zfcp_port *, u32);
80extern void zfcp_erp_modify_port_status(struct zfcp_port *, char *, void *, u32, 80extern void zfcp_erp_clear_port_status(struct zfcp_port *, u32);
81 int);
82extern int zfcp_erp_port_reopen(struct zfcp_port *, int, char *, void *); 81extern int zfcp_erp_port_reopen(struct zfcp_port *, int, char *, void *);
83extern void zfcp_erp_port_shutdown(struct zfcp_port *, int, char *, void *); 82extern void zfcp_erp_port_shutdown(struct zfcp_port *, int, char *, void *);
84extern void zfcp_erp_port_forced_reopen(struct zfcp_port *, int, char *, 83extern void zfcp_erp_port_forced_reopen(struct zfcp_port *, int, char *,
85 void *); 84 void *);
86extern void zfcp_erp_port_failed(struct zfcp_port *, char *, void *); 85extern void zfcp_erp_set_lun_status(struct scsi_device *, u32);
87extern void zfcp_erp_modify_lun_status(struct scsi_device *, char *, void *, 86extern void zfcp_erp_clear_lun_status(struct scsi_device *, u32);
88 u32, int);
89extern void zfcp_erp_lun_reopen(struct scsi_device *, int, char *, void *); 87extern void zfcp_erp_lun_reopen(struct scsi_device *, int, char *, void *);
90extern void zfcp_erp_lun_shutdown(struct scsi_device *, int, char *, void *); 88extern void zfcp_erp_lun_shutdown(struct scsi_device *, int, char *, void *);
91extern void zfcp_erp_lun_shutdown_wait(struct scsi_device *, char *); 89extern void zfcp_erp_lun_shutdown_wait(struct scsi_device *, char *);
92extern void zfcp_erp_lun_failed(struct scsi_device *, char *, void *);
93extern int zfcp_erp_thread_setup(struct zfcp_adapter *); 90extern int zfcp_erp_thread_setup(struct zfcp_adapter *);
94extern void zfcp_erp_thread_kill(struct zfcp_adapter *); 91extern void zfcp_erp_thread_kill(struct zfcp_adapter *);
95extern void zfcp_erp_wait(struct zfcp_adapter *); 92extern void zfcp_erp_wait(struct zfcp_adapter *);
96extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long); 93extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long);
97extern void zfcp_erp_port_boxed(struct zfcp_port *, char *, void *);
98extern void zfcp_erp_lun_boxed(struct scsi_device *, char *, void *);
99extern void zfcp_erp_timeout_handler(unsigned long); 94extern void zfcp_erp_timeout_handler(unsigned long);
100 95
101/* zfcp_fc.c */ 96/* zfcp_fc.c */
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 6f3ed2b9a349..86fd905df48b 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -365,7 +365,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
365 } 365 }
366 366
367 if (!port->d_id) { 367 if (!port->d_id) {
368 zfcp_erp_port_failed(port, "fcgpn_2", NULL); 368 zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
369 goto out; 369 goto out;
370 } 370 }
371 371
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 813c5b22565b..beaf0916ceab 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -104,7 +104,7 @@ static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req)
104 read_unlock_irqrestore(&adapter->port_list_lock, flags); 104 read_unlock_irqrestore(&adapter->port_list_lock, flags);
105} 105}
106 106
107static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id, 107static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req,
108 struct fsf_link_down_info *link_down) 108 struct fsf_link_down_info *link_down)
109{ 109{
110 struct zfcp_adapter *adapter = req->adapter; 110 struct zfcp_adapter *adapter = req->adapter;
@@ -184,7 +184,7 @@ static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id,
184 "the FC fabric is down\n"); 184 "the FC fabric is down\n");
185 } 185 }
186out: 186out:
187 zfcp_erp_adapter_failed(adapter, id, req); 187 zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
188} 188}
189 189
190static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) 190static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
@@ -195,13 +195,13 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
195 195
196 switch (sr_buf->status_subtype) { 196 switch (sr_buf->status_subtype) {
197 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: 197 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
198 zfcp_fsf_link_down_info_eval(req, "fssrld1", ldi); 198 zfcp_fsf_link_down_info_eval(req, ldi);
199 break; 199 break;
200 case FSF_STATUS_READ_SUB_FDISC_FAILED: 200 case FSF_STATUS_READ_SUB_FDISC_FAILED:
201 zfcp_fsf_link_down_info_eval(req, "fssrld2", ldi); 201 zfcp_fsf_link_down_info_eval(req, ldi);
202 break; 202 break;
203 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: 203 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
204 zfcp_fsf_link_down_info_eval(req, "fssrld3", NULL); 204 zfcp_fsf_link_down_info_eval(req, NULL);
205 }; 205 };
206} 206}
207 207
@@ -242,9 +242,8 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
242 dev_info(&adapter->ccw_device->dev, 242 dev_info(&adapter->ccw_device->dev,
243 "The local link has been restored\n"); 243 "The local link has been restored\n");
244 /* All ports should be marked as ready to run again */ 244 /* All ports should be marked as ready to run again */
245 zfcp_erp_modify_adapter_status(adapter, "fssrh_1", NULL, 245 zfcp_erp_set_adapter_status(adapter,
246 ZFCP_STATUS_COMMON_RUNNING, 246 ZFCP_STATUS_COMMON_RUNNING);
247 ZFCP_SET);
248 zfcp_erp_adapter_reopen(adapter, 247 zfcp_erp_adapter_reopen(adapter,
249 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | 248 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
250 ZFCP_STATUS_COMMON_ERP_FAILED, 249 ZFCP_STATUS_COMMON_ERP_FAILED,
@@ -359,16 +358,14 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
359 zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4", req); 358 zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4", req);
360 break; 359 break;
361 case FSF_PROT_LINK_DOWN: 360 case FSF_PROT_LINK_DOWN:
362 zfcp_fsf_link_down_info_eval(req, "fspse_5", 361 zfcp_fsf_link_down_info_eval(req, &psq->link_down_info);
363 &psq->link_down_info);
364 /* go through reopen to flush pending requests */ 362 /* go through reopen to flush pending requests */
365 zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req); 363 zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req);
366 break; 364 break;
367 case FSF_PROT_REEST_QUEUE: 365 case FSF_PROT_REEST_QUEUE:
368 /* All ports should be marked as ready to run again */ 366 /* All ports should be marked as ready to run again */
369 zfcp_erp_modify_adapter_status(adapter, "fspse_7", NULL, 367 zfcp_erp_set_adapter_status(adapter,
370 ZFCP_STATUS_COMMON_RUNNING, 368 ZFCP_STATUS_COMMON_RUNNING);
371 ZFCP_SET);
372 zfcp_erp_adapter_reopen(adapter, 369 zfcp_erp_adapter_reopen(adapter,
373 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | 370 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
374 ZFCP_STATUS_COMMON_ERP_FAILED, 371 ZFCP_STATUS_COMMON_ERP_FAILED,
@@ -538,7 +535,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
538 atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, 535 atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
539 &adapter->status); 536 &adapter->status);
540 537
541 zfcp_fsf_link_down_info_eval(req, "fsecdh2", 538 zfcp_fsf_link_down_info_eval(req,
542 &qtcb->header.fsf_status_qual.link_down_info); 539 &qtcb->header.fsf_status_qual.link_down_info);
543 break; 540 break;
544 default: 541 default:
@@ -604,7 +601,7 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
604 break; 601 break;
605 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: 602 case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
606 zfcp_fsf_exchange_port_evaluate(req); 603 zfcp_fsf_exchange_port_evaluate(req);
607 zfcp_fsf_link_down_info_eval(req, "fsepdh1", 604 zfcp_fsf_link_down_info_eval(req,
608 &qtcb->header.fsf_status_qual.link_down_info); 605 &qtcb->header.fsf_status_qual.link_down_info);
609 break; 606 break;
610 } 607 }
@@ -797,11 +794,17 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
797 req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; 794 req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED;
798 break; 795 break;
799 case FSF_PORT_BOXED: 796 case FSF_PORT_BOXED:
800 zfcp_erp_port_boxed(zfcp_sdev->port, "fsafch3", req); 797 zfcp_erp_set_port_status(zfcp_sdev->port,
798 ZFCP_STATUS_COMMON_ACCESS_BOXED);
799 zfcp_erp_port_reopen(zfcp_sdev->port,
800 ZFCP_STATUS_COMMON_ERP_FAILED, "fsafch3",
801 req);
801 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 802 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
802 break; 803 break;
803 case FSF_LUN_BOXED: 804 case FSF_LUN_BOXED:
804 zfcp_erp_lun_boxed(sdev, "fsafch4", req); 805 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED);
806 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
807 "fsafch4", req);
805 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 808 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
806 break; 809 break;
807 case FSF_ADAPTER_STATUS_AVAILABLE: 810 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1343,7 +1346,8 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1343 "Not enough FCP adapter resources to open " 1346 "Not enough FCP adapter resources to open "
1344 "remote port 0x%016Lx\n", 1347 "remote port 0x%016Lx\n",
1345 (unsigned long long)port->wwpn); 1348 (unsigned long long)port->wwpn);
1346 zfcp_erp_port_failed(port, "fsoph_1", req); 1349 zfcp_erp_set_port_status(port,
1350 ZFCP_STATUS_COMMON_ERP_FAILED);
1347 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1351 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1348 break; 1352 break;
1349 case FSF_ADAPTER_STATUS_AVAILABLE: 1353 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1453,9 +1457,7 @@ static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req)
1453 case FSF_ADAPTER_STATUS_AVAILABLE: 1457 case FSF_ADAPTER_STATUS_AVAILABLE:
1454 break; 1458 break;
1455 case FSF_GOOD: 1459 case FSF_GOOD:
1456 zfcp_erp_modify_port_status(port, "fscph_2", req, 1460 zfcp_erp_clear_port_status(port, ZFCP_STATUS_COMMON_OPEN);
1457 ZFCP_STATUS_COMMON_OPEN,
1458 ZFCP_CLEAR);
1459 break; 1461 break;
1460 } 1462 }
1461} 1463}
@@ -1653,7 +1655,9 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req)
1653 if (sdev_to_zfcp(sdev)->port == port) 1655 if (sdev_to_zfcp(sdev)->port == port)
1654 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, 1656 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN,
1655 &sdev_to_zfcp(sdev)->status); 1657 &sdev_to_zfcp(sdev)->status);
1656 zfcp_erp_port_boxed(port, "fscpph2", req); 1658 zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ACCESS_BOXED);
1659 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED,
1660 "fscpph2", req);
1657 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1661 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1658 break; 1662 break;
1659 case FSF_ADAPTER_STATUS_AVAILABLE: 1663 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1751,7 +1755,11 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
1751 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1755 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1752 break; 1756 break;
1753 case FSF_PORT_BOXED: 1757 case FSF_PORT_BOXED:
1754 zfcp_erp_port_boxed(zfcp_sdev->port, "fsouh_2", req); 1758 zfcp_erp_set_port_status(zfcp_sdev->port,
1759 ZFCP_STATUS_COMMON_ACCESS_BOXED);
1760 zfcp_erp_port_reopen(zfcp_sdev->port,
1761 ZFCP_STATUS_COMMON_ERP_FAILED, "fsouh_2",
1762 req);
1755 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1763 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1756 break; 1764 break;
1757 case FSF_LUN_SHARING_VIOLATION: 1765 case FSF_LUN_SHARING_VIOLATION:
@@ -1764,7 +1772,7 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
1764 "0x%016Lx on port 0x%016Lx\n", 1772 "0x%016Lx on port 0x%016Lx\n",
1765 (unsigned long long)zfcp_scsi_dev_lun(sdev), 1773 (unsigned long long)zfcp_scsi_dev_lun(sdev),
1766 (unsigned long long)zfcp_sdev->port->wwpn); 1774 (unsigned long long)zfcp_sdev->port->wwpn);
1767 zfcp_erp_lun_failed(sdev, "fsolh_4", req); 1775 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
1768 /* fall through */ 1776 /* fall through */
1769 case FSF_INVALID_COMMAND_OPTION: 1777 case FSF_INVALID_COMMAND_OPTION:
1770 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1778 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
@@ -1856,7 +1864,11 @@ static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req)
1856 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1864 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1857 break; 1865 break;
1858 case FSF_PORT_BOXED: 1866 case FSF_PORT_BOXED:
1859 zfcp_erp_port_boxed(zfcp_sdev->port, "fscuh_3", req); 1867 zfcp_erp_set_port_status(zfcp_sdev->port,
1868 ZFCP_STATUS_COMMON_ACCESS_BOXED);
1869 zfcp_erp_port_reopen(zfcp_sdev->port,
1870 ZFCP_STATUS_COMMON_ERP_FAILED, "fscuh_3",
1871 req);
1860 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1872 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1861 break; 1873 break;
1862 case FSF_ADAPTER_STATUS_AVAILABLE: 1874 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -2032,11 +2044,17 @@ static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req)
2032 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2044 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2033 break; 2045 break;
2034 case FSF_PORT_BOXED: 2046 case FSF_PORT_BOXED:
2035 zfcp_erp_port_boxed(zfcp_sdev->port, "fssfch5", req); 2047 zfcp_erp_set_port_status(zfcp_sdev->port,
2048 ZFCP_STATUS_COMMON_ACCESS_BOXED);
2049 zfcp_erp_port_reopen(zfcp_sdev->port,
2050 ZFCP_STATUS_COMMON_ERP_FAILED, "fssfch5",
2051 req);
2036 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2052 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2037 break; 2053 break;
2038 case FSF_LUN_BOXED: 2054 case FSF_LUN_BOXED:
2039 zfcp_erp_lun_boxed(sdev, "fssfch6", req); 2055 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED);
2056 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
2057 "fssfch6", req);
2040 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2058 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2041 break; 2059 break;
2042 case FSF_ADAPTER_STATUS_AVAILABLE: 2060 case FSF_ADAPTER_STATUS_AVAILABLE:
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 1e8d0cc7e1df..ae10883a5b28 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -158,8 +158,7 @@ static int zfcp_scsi_slave_alloc(struct scsi_device *sdev)
158 zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF; 158 zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF;
159 spin_lock_init(&zfcp_sdev->latencies.lock); 159 spin_lock_init(&zfcp_sdev->latencies.lock);
160 160
161 zfcp_erp_modify_lun_status(sdev, "scsla_0", NULL, 161 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
162 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
163 zfcp_erp_lun_reopen(sdev, 0, "scsla_1", NULL); 162 zfcp_erp_lun_reopen(sdev, 0, "scsla_1", NULL);
164 zfcp_erp_wait(port->adapter); 163 zfcp_erp_wait(port->adapter);
165 164
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 4f59356b07bb..2f2c54f4718f 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -104,8 +104,7 @@ static ssize_t zfcp_sysfs_port_failed_store(struct device *dev,
104 if (strict_strtoul(buf, 0, &val) || val != 0) 104 if (strict_strtoul(buf, 0, &val) || val != 0)
105 return -EINVAL; 105 return -EINVAL;
106 106
107 zfcp_erp_modify_port_status(port, "sypfai1", NULL, 107 zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
108 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
109 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "sypfai2", 108 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "sypfai2",
110 NULL); 109 NULL);
111 zfcp_erp_wait(port->adapter); 110 zfcp_erp_wait(port->adapter);
@@ -147,9 +146,7 @@ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
147 146
148 sdev = zfcp_unit_sdev(unit); 147 sdev = zfcp_unit_sdev(unit);
149 if (sdev) { 148 if (sdev) {
150 zfcp_erp_modify_lun_status(sdev, "syufai1", NULL, 149 zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
151 ZFCP_STATUS_COMMON_RUNNING,
152 ZFCP_SET);
153 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, 150 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
154 "syufai2", NULL); 151 "syufai2", NULL);
155 zfcp_erp_wait(unit->port->adapter); 152 zfcp_erp_wait(unit->port->adapter);
@@ -199,8 +196,7 @@ static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
199 goto out; 196 goto out;
200 } 197 }
201 198
202 zfcp_erp_modify_adapter_status(adapter, "syafai1", NULL, 199 zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING);
203 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
204 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 200 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
205 "syafai2", NULL); 201 "syafai2", NULL);
206 zfcp_erp_wait(adapter); 202 zfcp_erp_wait(adapter);