diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2010-09-08 08:39:59 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-16 22:54:21 -0400 |
commit | a1ca48319a9aa1c5b57ce142f538e76050bb8972 (patch) | |
tree | 0cfaec3fddadd2de778f721d6dd98aa34f19ff2d /drivers/s390/scsi/zfcp_fsf.c | |
parent | c61b536c97f225a74cf430716fdb243dfafe9d48 (diff) |
[SCSI] zfcp: Move ACL/CFDC code to zfcp_cfdc.c
Move the code evaluating the ACL/CFDC specific errors to the file
zfcp_cfdc.c. With this change, all code related to the old access
control feature is kept in one file, not split across zfcp_erp.c and
zfcp_fsf.c.
Reviewed-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/zfcp_fsf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 129 |
1 files changed, 15 insertions, 114 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 2b9dfea9f254..813c5b22565b 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -61,47 +61,6 @@ static u32 fsf_qtcb_type[] = { | |||
61 | [FSF_QTCB_UPLOAD_CONTROL_FILE] = FSF_SUPPORT_COMMAND | 61 | [FSF_QTCB_UPLOAD_CONTROL_FILE] = FSF_SUPPORT_COMMAND |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static void zfcp_act_eval_err(struct zfcp_adapter *adapter, u32 table) | ||
65 | { | ||
66 | u16 subtable = table >> 16; | ||
67 | u16 rule = table & 0xffff; | ||
68 | const char *act_type[] = { "unknown", "OS", "WWPN", "DID", "LUN" }; | ||
69 | |||
70 | if (subtable && subtable < ARRAY_SIZE(act_type)) | ||
71 | dev_warn(&adapter->ccw_device->dev, | ||
72 | "Access denied according to ACT rule type %s, " | ||
73 | "rule %d\n", act_type[subtable], rule); | ||
74 | } | ||
75 | |||
76 | static void zfcp_fsf_access_denied_port(struct zfcp_fsf_req *req, | ||
77 | struct zfcp_port *port) | ||
78 | { | ||
79 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
80 | dev_warn(&req->adapter->ccw_device->dev, | ||
81 | "Access denied to port 0x%016Lx\n", | ||
82 | (unsigned long long)port->wwpn); | ||
83 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]); | ||
84 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]); | ||
85 | zfcp_erp_port_access_denied(port, "fspad_1", req); | ||
86 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
87 | } | ||
88 | |||
89 | static void zfcp_fsf_access_denied_lun(struct zfcp_fsf_req *req, | ||
90 | struct scsi_device *sdev) | ||
91 | { | ||
92 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
93 | |||
94 | struct fsf_qtcb_header *header = &req->qtcb->header; | ||
95 | dev_warn(&req->adapter->ccw_device->dev, | ||
96 | "Access denied to LUN 0x%016Lx on port 0x%016Lx\n", | ||
97 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
98 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
99 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]); | ||
100 | zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]); | ||
101 | zfcp_erp_lun_access_denied(sdev, "fsadl_1", req); | ||
102 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
103 | } | ||
104 | |||
105 | static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req) | 64 | static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req) |
106 | { | 65 | { |
107 | dev_err(&req->adapter->ccw_device->dev, "FCP device not " | 66 | dev_err(&req->adapter->ccw_device->dev, "FCP device not " |
@@ -295,13 +254,12 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
295 | break; | 254 | break; |
296 | case FSF_STATUS_READ_NOTIFICATION_LOST: | 255 | case FSF_STATUS_READ_NOTIFICATION_LOST: |
297 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_ACT_UPDATED) | 256 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_ACT_UPDATED) |
298 | zfcp_erp_adapter_access_changed(adapter, "fssrh_3", | 257 | zfcp_cfdc_adapter_access_changed(adapter); |
299 | req); | ||
300 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS) | 258 | if (sr_buf->status_subtype & FSF_STATUS_READ_SUB_INCOMING_ELS) |
301 | queue_work(adapter->work_queue, &adapter->scan_work); | 259 | queue_work(adapter->work_queue, &adapter->scan_work); |
302 | break; | 260 | break; |
303 | case FSF_STATUS_READ_CFDC_UPDATED: | 261 | case FSF_STATUS_READ_CFDC_UPDATED: |
304 | zfcp_erp_adapter_access_changed(adapter, "fssrh_4", req); | 262 | zfcp_cfdc_adapter_access_changed(adapter); |
305 | break; | 263 | break; |
306 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: | 264 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: |
307 | adapter->adapter_features = sr_buf->payload.word[0]; | 265 | adapter->adapter_features = sr_buf->payload.word[0]; |
@@ -1116,8 +1074,10 @@ static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req) | |||
1116 | case FSF_RESPONSE_SIZE_TOO_LARGE: | 1074 | case FSF_RESPONSE_SIZE_TOO_LARGE: |
1117 | break; | 1075 | break; |
1118 | case FSF_ACCESS_DENIED: | 1076 | case FSF_ACCESS_DENIED: |
1119 | if (port) | 1077 | if (port) { |
1120 | zfcp_fsf_access_denied_port(req, port); | 1078 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1079 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1080 | } | ||
1121 | break; | 1081 | break; |
1122 | case FSF_SBAL_MISMATCH: | 1082 | case FSF_SBAL_MISMATCH: |
1123 | /* should never occure, avoided in zfcp_fsf_send_els */ | 1083 | /* should never occure, avoided in zfcp_fsf_send_els */ |
@@ -1375,7 +1335,8 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) | |||
1375 | case FSF_PORT_ALREADY_OPEN: | 1335 | case FSF_PORT_ALREADY_OPEN: |
1376 | break; | 1336 | break; |
1377 | case FSF_ACCESS_DENIED: | 1337 | case FSF_ACCESS_DENIED: |
1378 | zfcp_fsf_access_denied_port(req, port); | 1338 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1339 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1379 | break; | 1340 | break; |
1380 | case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: | 1341 | case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: |
1381 | dev_warn(&req->adapter->ccw_device->dev, | 1342 | dev_warn(&req->adapter->ccw_device->dev, |
@@ -1682,7 +1643,7 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) | |||
1682 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1643 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1683 | break; | 1644 | break; |
1684 | case FSF_ACCESS_DENIED: | 1645 | case FSF_ACCESS_DENIED: |
1685 | zfcp_fsf_access_denied_port(req, port); | 1646 | zfcp_cfdc_port_denied(port, &header->fsf_status_qual); |
1686 | break; | 1647 | break; |
1687 | case FSF_PORT_BOXED: | 1648 | case FSF_PORT_BOXED: |
1688 | /* can't use generic zfcp_erp_modify_port_status because | 1649 | /* can't use generic zfcp_erp_modify_port_status because |
@@ -1768,9 +1729,6 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) | |||
1768 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | 1729 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); |
1769 | struct fsf_qtcb_header *header = &req->qtcb->header; | 1730 | struct fsf_qtcb_header *header = &req->qtcb->header; |
1770 | struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support; | 1731 | struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support; |
1771 | struct fsf_queue_designator *queue_designator = | ||
1772 | &header->fsf_status_qual.fsf_queue_designator; | ||
1773 | int exclusive, readwrite; | ||
1774 | 1732 | ||
1775 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) | 1733 | if (req->status & ZFCP_STATUS_FSFREQ_ERROR) |
1776 | return; | 1734 | return; |
@@ -1789,29 +1747,15 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) | |||
1789 | case FSF_LUN_ALREADY_OPEN: | 1747 | case FSF_LUN_ALREADY_OPEN: |
1790 | break; | 1748 | break; |
1791 | case FSF_ACCESS_DENIED: | 1749 | case FSF_ACCESS_DENIED: |
1792 | zfcp_fsf_access_denied_lun(req, sdev); | 1750 | zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual); |
1793 | atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); | 1751 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1794 | atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); | ||
1795 | break; | 1752 | break; |
1796 | case FSF_PORT_BOXED: | 1753 | case FSF_PORT_BOXED: |
1797 | zfcp_erp_port_boxed(zfcp_sdev->port, "fsouh_2", req); | 1754 | zfcp_erp_port_boxed(zfcp_sdev->port, "fsouh_2", req); |
1798 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1755 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1799 | break; | 1756 | break; |
1800 | case FSF_LUN_SHARING_VIOLATION: | 1757 | case FSF_LUN_SHARING_VIOLATION: |
1801 | if (header->fsf_status_qual.word[0]) | 1758 | zfcp_cfdc_lun_shrng_vltn(sdev, &header->fsf_status_qual); |
1802 | dev_warn(&adapter->ccw_device->dev, | ||
1803 | "LUN 0x%Lx on port 0x%Lx is already in " | ||
1804 | "use by CSS%d, MIF Image ID %x\n", | ||
1805 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
1806 | (unsigned long long)zfcp_sdev->port->wwpn, | ||
1807 | queue_designator->cssid, | ||
1808 | queue_designator->hla); | ||
1809 | else | ||
1810 | zfcp_act_eval_err(adapter, | ||
1811 | header->fsf_status_qual.word[2]); | ||
1812 | zfcp_erp_lun_access_denied(sdev, "fsolh_3", req); | ||
1813 | atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); | ||
1814 | atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); | ||
1815 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1759 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1816 | break; | 1760 | break; |
1817 | case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: | 1761 | case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: |
@@ -1839,51 +1783,7 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) | |||
1839 | case FSF_GOOD: | 1783 | case FSF_GOOD: |
1840 | zfcp_sdev->lun_handle = header->lun_handle; | 1784 | zfcp_sdev->lun_handle = header->lun_handle; |
1841 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); | 1785 | atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &zfcp_sdev->status); |
1842 | 1786 | zfcp_cfdc_open_lun_eval(sdev, bottom); | |
1843 | if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE) && | ||
1844 | (adapter->adapter_features & FSF_FEATURE_LUN_SHARING) && | ||
1845 | !zfcp_ccw_priv_sch(adapter)) { | ||
1846 | exclusive = (bottom->lun_access_info & | ||
1847 | FSF_UNIT_ACCESS_EXCLUSIVE); | ||
1848 | readwrite = (bottom->lun_access_info & | ||
1849 | FSF_UNIT_ACCESS_OUTBOUND_TRANSFER); | ||
1850 | |||
1851 | if (!exclusive) | ||
1852 | atomic_set_mask(ZFCP_STATUS_LUN_SHARED, | ||
1853 | &zfcp_sdev->status); | ||
1854 | |||
1855 | if (!readwrite) { | ||
1856 | atomic_set_mask(ZFCP_STATUS_LUN_READONLY, | ||
1857 | &zfcp_sdev->status); | ||
1858 | dev_info(&adapter->ccw_device->dev, | ||
1859 | "SCSI device at LUN 0x%016Lx on port " | ||
1860 | "0x%016Lx opened read-only\n", | ||
1861 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
1862 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
1863 | } | ||
1864 | |||
1865 | if (exclusive && !readwrite) { | ||
1866 | dev_err(&adapter->ccw_device->dev, | ||
1867 | "Exclusive read-only access not " | ||
1868 | "supported (LUN 0x%016Lx, " | ||
1869 | "port 0x%016Lx)\n", | ||
1870 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
1871 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
1872 | zfcp_erp_lun_failed(sdev, "fsolh_5", req); | ||
1873 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1874 | zfcp_erp_lun_shutdown(sdev, 0, "fsolh_6", req); | ||
1875 | } else if (!exclusive && readwrite) { | ||
1876 | dev_err(&adapter->ccw_device->dev, | ||
1877 | "Shared read-write access not " | ||
1878 | "supported (LUN 0x%016Lx, port " | ||
1879 | "0x%016Lx)\n", | ||
1880 | (unsigned long long)zfcp_scsi_dev_lun(sdev), | ||
1881 | (unsigned long long)zfcp_sdev->port->wwpn); | ||
1882 | zfcp_erp_lun_failed(sdev, "fsolh_7", req); | ||
1883 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
1884 | zfcp_erp_lun_shutdown(sdev, 0, "fsolh_8", req); | ||
1885 | } | ||
1886 | } | ||
1887 | break; | 1787 | break; |
1888 | } | 1788 | } |
1889 | } | 1789 | } |
@@ -2106,7 +2006,8 @@ static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req) | |||
2106 | zfcp_fsf_class_not_supp(req); | 2006 | zfcp_fsf_class_not_supp(req); |
2107 | break; | 2007 | break; |
2108 | case FSF_ACCESS_DENIED: | 2008 | case FSF_ACCESS_DENIED: |
2109 | zfcp_fsf_access_denied_lun(req, sdev); | 2009 | zfcp_cfdc_lun_denied(sdev, &header->fsf_status_qual); |
2010 | req->status |= ZFCP_STATUS_FSFREQ_ERROR; | ||
2110 | break; | 2011 | break; |
2111 | case FSF_DIRECTION_INDICATOR_NOT_VALID: | 2012 | case FSF_DIRECTION_INDICATOR_NOT_VALID: |
2112 | dev_err(&req->adapter->ccw_device->dev, | 2013 | dev_err(&req->adapter->ccw_device->dev, |