aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c293
1 files changed, 57 insertions, 236 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 4a6d08363d4b..c06156b288ea 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1,26 +1,11 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Error Recovery Procedures (ERP).
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
23
24#include "zfcp_ext.h" 9#include "zfcp_ext.h"
25 10
26static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8, 11static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8,
@@ -171,14 +156,9 @@ static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter,
171{ 156{
172 int retval; 157 int retval;
173 158
174 ZFCP_LOG_DEBUG("reopen adapter %s\n",
175 zfcp_get_busid_by_adapter(adapter));
176
177 zfcp_erp_adapter_block(adapter, clear_mask); 159 zfcp_erp_adapter_block(adapter, clear_mask);
178 160
179 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) { 161 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) {
180 ZFCP_LOG_DEBUG("skipped reopen of failed adapter %s\n",
181 zfcp_get_busid_by_adapter(adapter));
182 /* ensure propagation of failed status to new devices */ 162 /* ensure propagation of failed status to new devices */
183 zfcp_erp_adapter_failed(adapter, 13, NULL); 163 zfcp_erp_adapter_failed(adapter, 13, NULL);
184 retval = -EIO; 164 retval = -EIO;
@@ -270,15 +250,9 @@ static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port,
270{ 250{
271 int retval; 251 int retval;
272 252
273 ZFCP_LOG_DEBUG("forced reopen of port 0x%016Lx on adapter %s\n",
274 port->wwpn, zfcp_get_busid_by_port(port));
275
276 zfcp_erp_port_block(port, clear_mask); 253 zfcp_erp_port_block(port, clear_mask);
277 254
278 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) { 255 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
279 ZFCP_LOG_DEBUG("skipped forced reopen of failed port 0x%016Lx "
280 "on adapter %s\n", port->wwpn,
281 zfcp_get_busid_by_port(port));
282 retval = -EIO; 256 retval = -EIO;
283 goto out; 257 goto out;
284 } 258 }
@@ -332,15 +306,9 @@ static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask,
332{ 306{
333 int retval; 307 int retval;
334 308
335 ZFCP_LOG_DEBUG("reopen of port 0x%016Lx on adapter %s\n",
336 port->wwpn, zfcp_get_busid_by_port(port));
337
338 zfcp_erp_port_block(port, clear_mask); 309 zfcp_erp_port_block(port, clear_mask);
339 310
340 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) { 311 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
341 ZFCP_LOG_DEBUG("skipped reopen of failed port 0x%016Lx "
342 "on adapter %s\n", port->wwpn,
343 zfcp_get_busid_by_port(port));
344 /* ensure propagation of failed status to new devices */ 312 /* ensure propagation of failed status to new devices */
345 zfcp_erp_port_failed(port, 14, NULL); 313 zfcp_erp_port_failed(port, 14, NULL);
346 retval = -EIO; 314 retval = -EIO;
@@ -396,17 +364,9 @@ static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask,
396 int retval; 364 int retval;
397 struct zfcp_adapter *adapter = unit->port->adapter; 365 struct zfcp_adapter *adapter = unit->port->adapter;
398 366
399 ZFCP_LOG_DEBUG("reopen of unit 0x%016Lx on port 0x%016Lx "
400 "on adapter %s\n", unit->fcp_lun,
401 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
402
403 zfcp_erp_unit_block(unit, clear_mask); 367 zfcp_erp_unit_block(unit, clear_mask);
404 368
405 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status)) { 369 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status)) {
406 ZFCP_LOG_DEBUG("skipped reopen of failed unit 0x%016Lx "
407 "on port 0x%016Lx on adapter %s\n",
408 unit->fcp_lun, unit->port->wwpn,
409 zfcp_get_busid_by_unit(unit));
410 retval = -EIO; 370 retval = -EIO;
411 goto out; 371 goto out;
412 } 372 }
@@ -631,13 +591,8 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
631 ZFCP_STATUS_FSFREQ_DISMISSED; 591 ZFCP_STATUS_FSFREQ_DISMISSED;
632 zfcp_rec_dbf_event_action(142, erp_action); 592 zfcp_rec_dbf_event_action(142, erp_action);
633 } 593 }
634 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 594 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
635 zfcp_rec_dbf_event_action(143, erp_action); 595 zfcp_rec_dbf_event_action(143, erp_action);
636 ZFCP_LOG_NORMAL("error: erp step timed out "
637 "(action=%d, fsf_req=%p)\n ",
638 erp_action->action,
639 erp_action->fsf_req);
640 }
641 /* 596 /*
642 * If fsf_req is neither dismissed nor completed 597 * If fsf_req is neither dismissed nor completed
643 * then keep it running asynchronously and don't mess 598 * then keep it running asynchronously and don't mess
@@ -740,11 +695,10 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter)
740 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); 695 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
741 696
742 retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); 697 retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD);
743 if (retval < 0) { 698 if (retval < 0)
744 ZFCP_LOG_NORMAL("error: creation of erp thread failed for " 699 dev_err(&adapter->ccw_device->dev,
745 "adapter %s\n", 700 "Creation of ERP thread failed.\n");
746 zfcp_get_busid_by_adapter(adapter)); 701 else {
747 } else {
748 wait_event(adapter->erp_thread_wqh, 702 wait_event(adapter->erp_thread_wqh,
749 atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, 703 atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP,
750 &adapter->status)); 704 &adapter->status));
@@ -919,15 +873,10 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
919 This might happen if an erp_action that used a memory pool 873 This might happen if an erp_action that used a memory pool
920 element was timed out. 874 element was timed out.
921 */ 875 */
922 if (adapter->erp_total_count == adapter->erp_low_mem_count) { 876 if (adapter->erp_total_count == adapter->erp_low_mem_count)
923 ZFCP_LOG_NORMAL("error: no mempool elements available, "
924 "restarting I/O on adapter %s "
925 "to free mempool\n",
926 zfcp_get_busid_by_adapter(adapter));
927 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL); 877 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL);
928 } else { 878 else
929 retval = zfcp_erp_strategy_memwait(erp_action); 879 retval = zfcp_erp_strategy_memwait(erp_action);
930 }
931 goto unlock; 880 goto unlock;
932 case ZFCP_ERP_CONTINUES: 881 case ZFCP_ERP_CONTINUES:
933 /* leave since this action runs asynchronously */ 882 /* leave since this action runs asynchronously */
@@ -1039,12 +988,6 @@ zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action)
1039 case ZFCP_ERP_ACTION_REOPEN_UNIT: 988 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1040 retval = zfcp_erp_unit_strategy(erp_action); 989 retval = zfcp_erp_unit_strategy(erp_action);
1041 break; 990 break;
1042
1043 default:
1044 ZFCP_LOG_NORMAL("bug: unknown erp action requested on "
1045 "adapter %s (action=%d)\n",
1046 zfcp_get_busid_by_adapter(erp_action->adapter),
1047 erp_action->action);
1048 } 991 }
1049 992
1050 return retval; 993 return retval;
@@ -1083,8 +1026,7 @@ zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, u8 id, void *ref)
1083{ 1026{
1084 zfcp_erp_modify_adapter_status(adapter, id, ref, 1027 zfcp_erp_modify_adapter_status(adapter, id, ref,
1085 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1028 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1086 ZFCP_LOG_NORMAL("adapter erp failed on adapter %s\n", 1029 dev_err(&adapter->ccw_device->dev, "Adapter ERP failed.\n");
1087 zfcp_get_busid_by_adapter(adapter));
1088} 1030}
1089 1031
1090/* 1032/*
@@ -1100,12 +1042,13 @@ zfcp_erp_port_failed(struct zfcp_port *port, u8 id, void *ref)
1100 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1042 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1101 1043
1102 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 1044 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
1103 ZFCP_LOG_NORMAL("port erp failed (adapter %s, " 1045 dev_err(&port->adapter->ccw_device->dev,
1104 "port d_id=0x%06x)\n", 1046 "Port ERP failed for WKA port d_id=0x%06x.\n",
1105 zfcp_get_busid_by_port(port), port->d_id); 1047 port->d_id);
1106 else 1048 else
1107 ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", 1049 dev_err(&port->adapter->ccw_device->dev,
1108 zfcp_get_busid_by_port(port), port->wwpn); 1050 "Port ERP failed for port wwpn=0x%016Lx.\n",
1051 port->wwpn);
1109} 1052}
1110 1053
1111/* 1054/*
@@ -1120,9 +1063,9 @@ zfcp_erp_unit_failed(struct zfcp_unit *unit, u8 id, void *ref)
1120 zfcp_erp_modify_unit_status(unit, id, ref, 1063 zfcp_erp_modify_unit_status(unit, id, ref,
1121 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1064 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1122 1065
1123 ZFCP_LOG_NORMAL("unit erp failed on unit 0x%016Lx on port 0x%016Lx " 1066 dev_err(&unit->port->adapter->ccw_device->dev,
1124 " on adapter %s\n", unit->fcp_lun, 1067 "Unit ERP failed for unit 0x%016Lx on port 0x%016Lx.\n",
1125 unit->port->wwpn, zfcp_get_busid_by_unit(unit)); 1068 unit->fcp_lun, unit->port->wwpn);
1126} 1069}
1127 1070
1128/* 1071/*
@@ -1336,13 +1279,10 @@ zfcp_erp_schedule_work(struct zfcp_unit *unit)
1336 1279
1337 p = kzalloc(sizeof(*p), GFP_KERNEL); 1280 p = kzalloc(sizeof(*p), GFP_KERNEL);
1338 if (!p) { 1281 if (!p) {
1339 ZFCP_LOG_NORMAL("error: Out of resources. Could not register " 1282 dev_err(&unit->port->adapter->ccw_device->dev,
1340 "the FCP-LUN 0x%Lx connected to " 1283 "Out of resources. Could not register unit 0x%016Lx "
1341 "the port with WWPN 0x%Lx connected to " 1284 "on port 0x%016Lx with SCSI stack.\n",
1342 "the adapter %s with the SCSI stack.\n", 1285 unit->fcp_lun, unit->port->wwpn);
1343 unit->fcp_lun,
1344 unit->port->wwpn,
1345 zfcp_get_busid_by_unit(unit));
1346 return; 1286 return;
1347 } 1287 }
1348 1288
@@ -1585,7 +1525,6 @@ static int
1585zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action) 1525zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
1586{ 1526{
1587 int retval; 1527 int retval;
1588 struct zfcp_adapter *adapter = erp_action->adapter;
1589 1528
1590 retval = zfcp_erp_adapter_strategy_close(erp_action); 1529 retval = zfcp_erp_adapter_strategy_close(erp_action);
1591 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY) 1530 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
@@ -1593,12 +1532,8 @@ zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
1593 else 1532 else
1594 retval = zfcp_erp_adapter_strategy_open(erp_action); 1533 retval = zfcp_erp_adapter_strategy_open(erp_action);
1595 1534
1596 if (retval == ZFCP_ERP_FAILED) { 1535 if (retval == ZFCP_ERP_FAILED)
1597 ZFCP_LOG_INFO("Waiting to allow the adapter %s "
1598 "to recover itself\n",
1599 zfcp_get_busid_by_adapter(adapter));
1600 ssleep(ZFCP_TYPE2_RECOVERY_TIME); 1536 ssleep(ZFCP_TYPE2_RECOVERY_TIME);
1601 }
1602 1537
1603 return retval; 1538 return retval;
1604} 1539}
@@ -1743,19 +1678,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1743 for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) { 1678 for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) {
1744 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 1679 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
1745 &adapter->status); 1680 &adapter->status);
1746 ZFCP_LOG_DEBUG("Doing exchange config data\n");
1747 write_lock_irq(&adapter->erp_lock); 1681 write_lock_irq(&adapter->erp_lock);
1748 zfcp_erp_action_to_running(erp_action); 1682 zfcp_erp_action_to_running(erp_action);
1749 write_unlock_irq(&adapter->erp_lock); 1683 write_unlock_irq(&adapter->erp_lock);
1750 if (zfcp_fsf_exchange_config_data(erp_action)) { 1684 if (zfcp_fsf_exchange_config_data(erp_action)) {
1751 retval = ZFCP_ERP_FAILED; 1685 retval = ZFCP_ERP_FAILED;
1752 ZFCP_LOG_INFO("error: initiation of exchange of "
1753 "configuration data failed for "
1754 "adapter %s\n",
1755 zfcp_get_busid_by_adapter(adapter));
1756 break; 1686 break;
1757 } 1687 }
1758 ZFCP_LOG_DEBUG("Xchange underway\n");
1759 1688
1760 /* 1689 /*
1761 * Why this works: 1690 * Why this works:
@@ -1773,19 +1702,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1773 zfcp_rec_dbf_event_thread_lock(6, adapter); 1702 zfcp_rec_dbf_event_thread_lock(6, adapter);
1774 down(&adapter->erp_ready_sem); 1703 down(&adapter->erp_ready_sem);
1775 zfcp_rec_dbf_event_thread_lock(7, adapter); 1704 zfcp_rec_dbf_event_thread_lock(7, adapter);
1776 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 1705 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
1777 ZFCP_LOG_INFO("error: exchange of configuration data "
1778 "for adapter %s timed out\n",
1779 zfcp_get_busid_by_adapter(adapter));
1780 break; 1706 break;
1781 }
1782 1707
1783 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 1708 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
1784 &adapter->status)) 1709 &adapter->status))
1785 break; 1710 break;
1786 1711
1787 ZFCP_LOG_DEBUG("host connection still initialising... "
1788 "waiting and retrying...\n");
1789 /* sleep a little bit before retry */ 1712 /* sleep a little bit before retry */
1790 ssleep(sleep); 1713 ssleep(sleep);
1791 sleep *= 2; 1714 sleep *= 2;
@@ -1795,12 +1718,8 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1795 &adapter->status); 1718 &adapter->status);
1796 1719
1797 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, 1720 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
1798 &adapter->status)) { 1721 &adapter->status))
1799 ZFCP_LOG_INFO("error: exchange of configuration data for "
1800 "adapter %s failed\n",
1801 zfcp_get_busid_by_adapter(adapter));
1802 retval = ZFCP_ERP_FAILED; 1722 retval = ZFCP_ERP_FAILED;
1803 }
1804 1723
1805 return retval; 1724 return retval;
1806} 1725}
@@ -1829,16 +1748,8 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
1829 zfcp_rec_dbf_event_thread_lock(8, adapter); 1748 zfcp_rec_dbf_event_thread_lock(8, adapter);
1830 down(&adapter->erp_ready_sem); 1749 down(&adapter->erp_ready_sem);
1831 zfcp_rec_dbf_event_thread_lock(9, adapter); 1750 zfcp_rec_dbf_event_thread_lock(9, adapter);
1832 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 1751 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
1833 ZFCP_LOG_INFO("error: exchange port data timed out (adapter "
1834 "%s)\n", zfcp_get_busid_by_adapter(adapter));
1835 ret = ZFCP_ERP_FAILED; 1752 ret = ZFCP_ERP_FAILED;
1836 }
1837
1838 /* don't treat as error for the sake of compatibility */
1839 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status))
1840 ZFCP_LOG_INFO("warning: exchange port data failed (adapter "
1841 "%s\n", zfcp_get_busid_by_adapter(adapter));
1842 1753
1843 return ret; 1754 return ret;
1844} 1755}
@@ -1884,8 +1795,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
1884 if (atomic_test_mask((ZFCP_STATUS_PORT_PHYS_OPEN | 1795 if (atomic_test_mask((ZFCP_STATUS_PORT_PHYS_OPEN |
1885 ZFCP_STATUS_COMMON_OPEN), 1796 ZFCP_STATUS_COMMON_OPEN),
1886 &port->status)) { 1797 &port->status)) {
1887 ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
1888 "close physical\n", port->wwpn);
1889 retval = 1798 retval =
1890 zfcp_erp_port_forced_strategy_close(erp_action); 1799 zfcp_erp_port_forced_strategy_close(erp_action);
1891 } else 1800 } else
@@ -1895,8 +1804,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
1895 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 1804 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
1896 if (atomic_test_mask(ZFCP_STATUS_PORT_PHYS_OPEN, 1805 if (atomic_test_mask(ZFCP_STATUS_PORT_PHYS_OPEN,
1897 &port->status)) { 1806 &port->status)) {
1898 ZFCP_LOG_DEBUG("close physical failed for port "
1899 "0x%016Lx\n", port->wwpn);
1900 retval = ZFCP_ERP_FAILED; 1807 retval = ZFCP_ERP_FAILED;
1901 } else 1808 } else
1902 retval = ZFCP_ERP_SUCCEEDED; 1809 retval = ZFCP_ERP_SUCCEEDED;
@@ -1930,8 +1837,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
1930 case ZFCP_ERP_STEP_UNINITIALIZED: 1837 case ZFCP_ERP_STEP_UNINITIALIZED:
1931 zfcp_erp_port_strategy_clearstati(port); 1838 zfcp_erp_port_strategy_clearstati(port);
1932 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1839 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
1933 ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
1934 "close\n", port->wwpn);
1935 retval = zfcp_erp_port_strategy_close(erp_action); 1840 retval = zfcp_erp_port_strategy_close(erp_action);
1936 goto out; 1841 goto out;
1937 } /* else it's already closed, open it */ 1842 } /* else it's already closed, open it */
@@ -1939,8 +1844,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
1939 1844
1940 case ZFCP_ERP_STEP_PORT_CLOSING: 1845 case ZFCP_ERP_STEP_PORT_CLOSING:
1941 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1846 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
1942 ZFCP_LOG_DEBUG("close failed for port 0x%016Lx\n",
1943 port->wwpn);
1944 retval = ZFCP_ERP_FAILED; 1847 retval = ZFCP_ERP_FAILED;
1945 goto out; 1848 goto out;
1946 } /* else it's closed now, open it */ 1849 } /* else it's closed now, open it */
@@ -1983,12 +1886,10 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
1983 case ZFCP_ERP_STEP_PORT_CLOSING: 1886 case ZFCP_ERP_STEP_PORT_CLOSING:
1984 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) { 1887 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) {
1985 if (port->wwpn != adapter->peer_wwpn) { 1888 if (port->wwpn != adapter->peer_wwpn) {
1986 ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx " 1889 dev_err(&adapter->ccw_device->dev,
1987 "on adapter %s.\nPeer WWPN " 1890 "Failed to open port 0x%016Lx, "
1988 "0x%016Lx does not match\n", 1891 "Peer WWPN 0x%016Lx does not match.\n",
1989 port->wwpn, 1892 port->wwpn, adapter->peer_wwpn);
1990 zfcp_get_busid_by_adapter(adapter),
1991 adapter->peer_wwpn);
1992 zfcp_erp_port_failed(port, 25, NULL); 1893 zfcp_erp_port_failed(port, 25, NULL);
1993 retval = ZFCP_ERP_FAILED; 1894 retval = ZFCP_ERP_FAILED;
1994 break; 1895 break;
@@ -2001,17 +1902,14 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2001 if (!(adapter->nameserver_port)) { 1902 if (!(adapter->nameserver_port)) {
2002 retval = zfcp_nameserver_enqueue(adapter); 1903 retval = zfcp_nameserver_enqueue(adapter);
2003 if (retval != 0) { 1904 if (retval != 0) {
2004 ZFCP_LOG_NORMAL("error: nameserver port " 1905 dev_err(&adapter->ccw_device->dev,
2005 "unavailable for adapter %s\n", 1906 "Nameserver port unavailable.\n");
2006 zfcp_get_busid_by_adapter(adapter));
2007 retval = ZFCP_ERP_FAILED; 1907 retval = ZFCP_ERP_FAILED;
2008 break; 1908 break;
2009 } 1909 }
2010 } 1910 }
2011 if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 1911 if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
2012 &adapter->nameserver_port->status)) { 1912 &adapter->nameserver_port->status)) {
2013 ZFCP_LOG_DEBUG("nameserver port is not open -> open "
2014 "nameserver port\n");
2015 /* nameserver port may live again */ 1913 /* nameserver port may live again */
2016 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, 1914 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
2017 &adapter->nameserver_port->status); 1915 &adapter->nameserver_port->status);
@@ -2027,57 +1925,37 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2027 /* else nameserver port is already open, fall through */ 1925 /* else nameserver port is already open, fall through */
2028 case ZFCP_ERP_STEP_NAMESERVER_OPEN: 1926 case ZFCP_ERP_STEP_NAMESERVER_OPEN:
2029 if (!atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, 1927 if (!atomic_test_mask(ZFCP_STATUS_COMMON_OPEN,
2030 &adapter->nameserver_port->status)) { 1928 &adapter->nameserver_port->status))
2031 ZFCP_LOG_DEBUG("open failed for nameserver port\n");
2032 retval = ZFCP_ERP_FAILED; 1929 retval = ZFCP_ERP_FAILED;
2033 } else { 1930 else
2034 ZFCP_LOG_DEBUG("nameserver port is open -> "
2035 "nameserver look-up for port 0x%016Lx\n",
2036 port->wwpn);
2037 retval = zfcp_erp_port_strategy_open_common_lookup 1931 retval = zfcp_erp_port_strategy_open_common_lookup
2038 (erp_action); 1932 (erp_action);
2039 }
2040 break; 1933 break;
2041 1934
2042 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP: 1935 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP:
2043 if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) { 1936 if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) {
2044 if (atomic_test_mask 1937 if (atomic_test_mask
2045 (ZFCP_STATUS_PORT_INVALID_WWPN, &port->status)) { 1938 (ZFCP_STATUS_PORT_INVALID_WWPN, &port->status)) {
2046 ZFCP_LOG_DEBUG("nameserver look-up failed "
2047 "for port 0x%016Lx "
2048 "(misconfigured WWPN?)\n",
2049 port->wwpn);
2050 zfcp_erp_port_failed(port, 26, NULL); 1939 zfcp_erp_port_failed(port, 26, NULL);
2051 retval = ZFCP_ERP_EXIT; 1940 retval = ZFCP_ERP_EXIT;
2052 } else { 1941 } else
2053 ZFCP_LOG_DEBUG("nameserver look-up failed for "
2054 "port 0x%016Lx\n", port->wwpn);
2055 retval = ZFCP_ERP_FAILED; 1942 retval = ZFCP_ERP_FAILED;
2056 } 1943 } else
2057 } else {
2058 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> "
2059 "trying open\n", port->wwpn, port->d_id);
2060 retval = zfcp_erp_port_strategy_open_port(erp_action); 1944 retval = zfcp_erp_port_strategy_open_port(erp_action);
2061 }
2062 break; 1945 break;
2063 1946
2064 case ZFCP_ERP_STEP_PORT_OPENING: 1947 case ZFCP_ERP_STEP_PORT_OPENING:
2065 /* D_ID might have changed during open */ 1948 /* D_ID might have changed during open */
2066 if (atomic_test_mask((ZFCP_STATUS_COMMON_OPEN | 1949 if (atomic_test_mask((ZFCP_STATUS_COMMON_OPEN |
2067 ZFCP_STATUS_PORT_DID_DID), 1950 ZFCP_STATUS_PORT_DID_DID),
2068 &port->status)) { 1951 &port->status))
2069 ZFCP_LOG_DEBUG("port 0x%016Lx is open\n", port->wwpn);
2070 retval = ZFCP_ERP_SUCCEEDED; 1952 retval = ZFCP_ERP_SUCCEEDED;
2071 } else { 1953 else
2072 ZFCP_LOG_DEBUG("open failed for port 0x%016Lx\n",
2073 port->wwpn);
2074 retval = ZFCP_ERP_FAILED; 1954 retval = ZFCP_ERP_FAILED;
2075 }
2076 break; 1955 break;
2077 1956
2078 default: 1957 default:
2079 ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n", 1958 /* unknown erp step */
2080 erp_action->step);
2081 retval = ZFCP_ERP_FAILED; 1959 retval = ZFCP_ERP_FAILED;
2082 } 1960 }
2083 1961
@@ -2095,27 +1973,20 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action)
2095 case ZFCP_ERP_STEP_UNINITIALIZED: 1973 case ZFCP_ERP_STEP_UNINITIALIZED:
2096 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 1974 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
2097 case ZFCP_ERP_STEP_PORT_CLOSING: 1975 case ZFCP_ERP_STEP_PORT_CLOSING:
2098 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> trying open\n",
2099 port->wwpn, port->d_id);
2100 retval = zfcp_erp_port_strategy_open_port(erp_action); 1976 retval = zfcp_erp_port_strategy_open_port(erp_action);
2101 break; 1977 break;
2102 1978
2103 case ZFCP_ERP_STEP_PORT_OPENING: 1979 case ZFCP_ERP_STEP_PORT_OPENING:
2104 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1980 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status))
2105 ZFCP_LOG_DEBUG("WKA port is open\n");
2106 retval = ZFCP_ERP_SUCCEEDED; 1981 retval = ZFCP_ERP_SUCCEEDED;
2107 } else { 1982 else
2108 ZFCP_LOG_DEBUG("open failed for WKA port\n");
2109 retval = ZFCP_ERP_FAILED; 1983 retval = ZFCP_ERP_FAILED;
2110 }
2111 /* this is needed anyway (dont care for retval of wakeup) */ 1984 /* this is needed anyway (dont care for retval of wakeup) */
2112 ZFCP_LOG_DEBUG("continue other open port operations\n");
2113 zfcp_erp_port_strategy_open_nameserver_wakeup(erp_action); 1985 zfcp_erp_port_strategy_open_nameserver_wakeup(erp_action);
2114 break; 1986 break;
2115 1987
2116 default: 1988 default:
2117 ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n", 1989 /* unknown erp step */
2118 erp_action->step);
2119 retval = ZFCP_ERP_FAILED; 1990 retval = ZFCP_ERP_FAILED;
2120 } 1991 }
2121 1992
@@ -2313,39 +2184,26 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action)
2313 case ZFCP_ERP_STEP_UNINITIALIZED: 2184 case ZFCP_ERP_STEP_UNINITIALIZED:
2314 zfcp_erp_unit_strategy_clearstati(unit); 2185 zfcp_erp_unit_strategy_clearstati(unit);
2315 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2186 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) {
2316 ZFCP_LOG_DEBUG("unit 0x%016Lx is open -> "
2317 "trying close\n", unit->fcp_lun);
2318 retval = zfcp_erp_unit_strategy_close(erp_action); 2187 retval = zfcp_erp_unit_strategy_close(erp_action);
2319 break; 2188 break;
2320 } 2189 }
2321 /* else it's already closed, fall through */ 2190 /* else it's already closed, fall through */
2322 case ZFCP_ERP_STEP_UNIT_CLOSING: 2191 case ZFCP_ERP_STEP_UNIT_CLOSING:
2323 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2192 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
2324 ZFCP_LOG_DEBUG("close failed for unit 0x%016Lx\n",
2325 unit->fcp_lun);
2326 retval = ZFCP_ERP_FAILED; 2193 retval = ZFCP_ERP_FAILED;
2327 } else { 2194 else
2328 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY) 2195 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
2329 retval = ZFCP_ERP_EXIT; 2196 retval = ZFCP_ERP_EXIT;
2330 else { 2197 else
2331 ZFCP_LOG_DEBUG("unit 0x%016Lx is not open -> "
2332 "trying open\n", unit->fcp_lun);
2333 retval = 2198 retval =
2334 zfcp_erp_unit_strategy_open(erp_action); 2199 zfcp_erp_unit_strategy_open(erp_action);
2335 }
2336 }
2337 break; 2200 break;
2338 2201
2339 case ZFCP_ERP_STEP_UNIT_OPENING: 2202 case ZFCP_ERP_STEP_UNIT_OPENING:
2340 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2203 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
2341 ZFCP_LOG_DEBUG("unit 0x%016Lx is open\n",
2342 unit->fcp_lun);
2343 retval = ZFCP_ERP_SUCCEEDED; 2204 retval = ZFCP_ERP_SUCCEEDED;
2344 } else { 2205 else
2345 ZFCP_LOG_DEBUG("open failed for unit 0x%016Lx\n",
2346 unit->fcp_lun);
2347 retval = ZFCP_ERP_FAILED; 2206 retval = ZFCP_ERP_FAILED;
2348 }
2349 break; 2207 break;
2350 } 2208 }
2351 2209
@@ -2493,16 +2351,8 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2493 2351
2494 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: 2352 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
2495 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, 2353 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
2496 &port->status)) { 2354 &port->status))
2497 if (port->erp_action.action !=
2498 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) {
2499 ZFCP_LOG_INFO("dropped erp action %i (port "
2500 "0x%016Lx, action in use: %i)\n",
2501 want, port->wwpn,
2502 port->erp_action.action);
2503 }
2504 goto out; 2355 goto out;
2505 }
2506 if (!atomic_test_mask 2356 if (!atomic_test_mask
2507 (ZFCP_STATUS_COMMON_RUNNING, &adapter->status) || 2357 (ZFCP_STATUS_COMMON_RUNNING, &adapter->status) ||
2508 atomic_test_mask 2358 atomic_test_mask
@@ -2522,19 +2372,10 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2522 break; 2372 break;
2523 2373
2524 default: 2374 default:
2525 ZFCP_LOG_NORMAL("bug: unknown erp action requested " 2375 /* unknown erp action */
2526 "on adapter %s (action=%d)\n",
2527 zfcp_get_busid_by_adapter(adapter), want);
2528 goto out; 2376 goto out;
2529 } 2377 }
2530 2378
2531 /* check whether we need something stronger first */
2532 if (need) {
2533 ZFCP_LOG_DEBUG("stronger erp action %d needed before "
2534 "erp action %d on adapter %s\n",
2535 need, want, zfcp_get_busid_by_adapter(adapter));
2536 }
2537
2538 /* mark adapter to have some error recovery pending */ 2379 /* mark adapter to have some error recovery pending */
2539 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); 2380 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
2540 2381
@@ -2672,10 +2513,9 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
2672 port->rport = 2513 port->rport =
2673 fc_remote_port_add(adapter->scsi_host, 0, &ids); 2514 fc_remote_port_add(adapter->scsi_host, 0, &ids);
2674 if (!port->rport) 2515 if (!port->rport)
2675 ZFCP_LOG_NORMAL("failed registration of rport" 2516 dev_err(&adapter->ccw_device->dev,
2676 "(adapter %s, wwpn=0x%016Lx)\n", 2517 "Failed registration of rport "
2677 zfcp_get_busid_by_port(port), 2518 "0x%016Lx.\n", port->wwpn);
2678 port->wwpn);
2679 else { 2519 else {
2680 scsi_target_unblock(&port->rport->dev); 2520 scsi_target_unblock(&port->rport->dev);
2681 port->rport->maxframe_size = port->maxframe_size; 2521 port->rport->maxframe_size = port->maxframe_size;
@@ -2803,7 +2643,6 @@ void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id,
2803 2643
2804void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref) 2644void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
2805{ 2645{
2806 struct zfcp_adapter *adapter = port->adapter;
2807 struct zfcp_unit *unit; 2646 struct zfcp_unit *unit;
2808 2647
2809 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 2648 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
@@ -2816,34 +2655,16 @@ void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
2816 return; 2655 return;
2817 } 2656 }
2818 2657
2819 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " 2658 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
2820 "(due to ACT update)\n",
2821 port->wwpn, zfcp_get_busid_by_adapter(adapter));
2822 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
2823 ZFCP_LOG_NORMAL("failed reopen of port"
2824 "(adapter %s, wwpn=0x%016Lx)\n",
2825 zfcp_get_busid_by_adapter(adapter), port->wwpn);
2826} 2659}
2827 2660
2828void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref) 2661void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref)
2829{ 2662{
2830 struct zfcp_adapter *adapter = unit->port->adapter;
2831
2832 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 2663 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
2833 &unit->status) && 2664 &unit->status) &&
2834 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, 2665 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
2835 &unit->status)) 2666 &unit->status))
2836 return; 2667 return;
2837 2668
2838 ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx " 2669 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
2839 " on adapter %s (due to ACT update)\n",
2840 unit->fcp_lun, unit->port->wwpn,
2841 zfcp_get_busid_by_adapter(adapter));
2842 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
2843 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
2844 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
2845 zfcp_get_busid_by_adapter(adapter),
2846 unit->port->wwpn, unit->fcp_lun);
2847} 2670}
2848
2849#undef ZFCP_LOG_AREA