aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-09-08 08:39:59 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-09-16 22:54:21 -0400
commita1ca48319a9aa1c5b57ce142f538e76050bb8972 (patch)
tree0cfaec3fddadd2de778f721d6dd98aa34f19ff2d /drivers/s390
parentc61b536c97f225a74cf430716fdb243dfafe9d48 (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')
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c186
-rw-r--r--drivers/s390/scsi/zfcp_erp.c82
-rw-r--r--drivers/s390/scsi/zfcp_ext.h12
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c129
4 files changed, 207 insertions, 202 deletions
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index fcbd2b756da4..f952b89b108a 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -2,9 +2,10 @@
2 * zfcp device driver 2 * zfcp device driver
3 * 3 *
4 * Userspace interface for accessing the 4 * Userspace interface for accessing the
5 * Access Control Lists / Control File Data Channel 5 * Access Control Lists / Control File Data Channel;
6 * handling of response code and states for ports and LUNs.
6 * 7 *
7 * Copyright IBM Corporation 2008, 2009 8 * Copyright IBM Corporation 2008, 2010
8 */ 9 */
9 10
10#define KMSG_COMPONENT "zfcp" 11#define KMSG_COMPONENT "zfcp"
@@ -260,3 +261,184 @@ struct miscdevice zfcp_cfdc_misc = {
260 .name = "zfcp_cfdc", 261 .name = "zfcp_cfdc",
261 .fops = &zfcp_cfdc_fops, 262 .fops = &zfcp_cfdc_fops,
262}; 263};
264
265/**
266 * zfcp_cfdc_adapter_access_changed - Process change in adapter ACT
267 * @adapter: Adapter where the Access Control Table (ACT) changed
268 *
269 * After a change in the adapter ACT, check if access to any
270 * previously denied resources is now possible.
271 */
272void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *adapter)
273{
274 unsigned long flags;
275 struct zfcp_port *port;
276 struct scsi_device *sdev;
277 struct zfcp_scsi_dev *zfcp_sdev;
278 int status;
279
280 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
281 return;
282
283 read_lock_irqsave(&adapter->port_list_lock, flags);
284 list_for_each_entry(port, &adapter->port_list, list) {
285 status = atomic_read(&port->status);
286 if ((status & ZFCP_STATUS_COMMON_ACCESS_DENIED) ||
287 (status & ZFCP_STATUS_COMMON_ACCESS_BOXED))
288 zfcp_erp_port_reopen(port,
289 ZFCP_STATUS_COMMON_ERP_FAILED,
290 "cfaac_1", NULL);
291 }
292 read_unlock_irqrestore(&adapter->port_list_lock, flags);
293
294 shost_for_each_device(sdev, port->adapter->scsi_host) {
295 zfcp_sdev = sdev_to_zfcp(sdev);
296 status = atomic_read(&zfcp_sdev->status);
297 if ((status & ZFCP_STATUS_COMMON_ACCESS_DENIED) ||
298 (status & ZFCP_STATUS_COMMON_ACCESS_BOXED))
299 zfcp_erp_lun_reopen(sdev,
300 ZFCP_STATUS_COMMON_ERP_FAILED,
301 "cfaac_2", NULL);
302 }
303}
304
305static void zfcp_act_eval_err(struct zfcp_adapter *adapter, u32 table)
306{
307 u16 subtable = table >> 16;
308 u16 rule = table & 0xffff;
309 const char *act_type[] = { "unknown", "OS", "WWPN", "DID", "LUN" };
310
311 if (subtable && subtable < ARRAY_SIZE(act_type))
312 dev_warn(&adapter->ccw_device->dev,
313 "Access denied according to ACT rule type %s, "
314 "rule %d\n", act_type[subtable], rule);
315}
316
317/**
318 * zfcp_cfdc_port_denied - Process "access denied" for port
319 * @port: The port where the acces has been denied
320 * @qual: The FSF status qualifier for the access denied FSF status
321 */
322void zfcp_cfdc_port_denied(struct zfcp_port *port,
323 union fsf_status_qual *qual)
324{
325 dev_warn(&port->adapter->ccw_device->dev,
326 "Access denied to port 0x%016Lx\n",
327 (unsigned long long)port->wwpn);
328
329 zfcp_act_eval_err(port->adapter, qual->halfword[0]);
330 zfcp_act_eval_err(port->adapter, qual->halfword[1]);
331 zfcp_erp_modify_port_status(port, "cfadp_1", NULL,
332 ZFCP_STATUS_COMMON_ERP_FAILED |
333 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
334}
335
336/**
337 * zfcp_cfdc_lun_denied - Process "access denied" for LUN
338 * @sdev: The SCSI device / LUN where the access has been denied
339 * @qual: The FSF status qualifier for the access denied FSF status
340 */
341void zfcp_cfdc_lun_denied(struct scsi_device *sdev,
342 union fsf_status_qual *qual)
343{
344 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
345
346 dev_warn(&zfcp_sdev->port->adapter->ccw_device->dev,
347 "Access denied to LUN 0x%016Lx on port 0x%016Lx\n",
348 zfcp_scsi_dev_lun(sdev),
349 (unsigned long long)zfcp_sdev->port->wwpn);
350 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[0]);
351 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[1]);
352 zfcp_erp_modify_lun_status(sdev, "cfadl_1", NULL,
353 ZFCP_STATUS_COMMON_ERP_FAILED |
354 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
355
356 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
357 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
358}
359
360/**
361 * zfcp_cfdc_lun_shrng_vltn - Evaluate LUN sharing violation status
362 * @sdev: The LUN / SCSI device where sharing violation occurred
363 * @qual: The FSF status qualifier from the LUN sharing violation
364 */
365void zfcp_cfdc_lun_shrng_vltn(struct scsi_device *sdev,
366 union fsf_status_qual *qual)
367{
368 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
369
370 if (qual->word[0])
371 dev_warn(&zfcp_sdev->port->adapter->ccw_device->dev,
372 "LUN 0x%Lx on port 0x%Lx is already in "
373 "use by CSS%d, MIF Image ID %x\n",
374 zfcp_scsi_dev_lun(sdev),
375 (unsigned long long)zfcp_sdev->port->wwpn,
376 qual->fsf_queue_designator.cssid,
377 qual->fsf_queue_designator.hla);
378 else
379 zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->word[2]);
380
381 zfcp_erp_modify_lun_status(sdev, "fsosh_3", NULL,
382 ZFCP_STATUS_COMMON_ERP_FAILED |
383 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
384 atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
385 atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
386}
387
388/**
389 * zfcp_cfdc_open_lun_eval - Eval access ctrl. status for successful "open lun"
390 * @sdev: The SCSI device / LUN where to evaluate the status
391 * @bottom: The qtcb bottom with the status from the "open lun"
392 *
393 * Returns: 0 if LUN is usable, -EACCES if the access control table
394 * reports an unsupported configuration.
395 */
396int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev,
397 struct fsf_qtcb_bottom_support *bottom)
398{
399 int shared, rw;
400 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
401 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
402
403 if ((adapter->connection_features & FSF_FEATURE_NPIV_MODE) ||
404 !(adapter->adapter_features & FSF_FEATURE_LUN_SHARING) ||
405 zfcp_ccw_priv_sch(adapter))
406 return 0;
407
408 shared = !(bottom->lun_access_info & FSF_UNIT_ACCESS_EXCLUSIVE);
409 rw = (bottom->lun_access_info & FSF_UNIT_ACCESS_OUTBOUND_TRANSFER);
410
411 if (shared)
412 atomic_set_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
413
414 if (!rw) {
415 atomic_set_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
416 dev_info(&adapter->ccw_device->dev, "SCSI device at LUN "
417 "0x%016Lx on port 0x%016Lx opened read-only\n",
418 zfcp_scsi_dev_lun(sdev),
419 (unsigned long long)zfcp_sdev->port->wwpn);
420 }
421
422 if (!shared && !rw) {
423 dev_err(&adapter->ccw_device->dev, "Exclusive read-only access "
424 "not supported (LUN 0x%016Lx, port 0x%016Lx)\n",
425 zfcp_scsi_dev_lun(sdev),
426 (unsigned long long)zfcp_sdev->port->wwpn);
427 zfcp_erp_lun_failed(sdev, "fsosh_5", NULL);
428 zfcp_erp_lun_shutdown(sdev, 0, "fsouh_6", NULL);
429 return -EACCES;
430 }
431
432 if (shared && rw) {
433 dev_err(&adapter->ccw_device->dev,
434 "Shared read-write access not supported "
435 "(LUN 0x%016Lx, port 0x%016Lx)\n",
436 zfcp_scsi_dev_lun(sdev),
437 (unsigned long long)zfcp_sdev->port->wwpn);
438 zfcp_erp_lun_failed(sdev, "fsosh_7", NULL);
439 zfcp_erp_lun_shutdown(sdev, 0, "fsosh_8", NULL);
440 return -EACCES;
441 }
442
443 return 0;
444}
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 734fc838931f..9e7d029ac7a2 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1593,85 +1593,3 @@ void zfcp_erp_lun_boxed(struct scsi_device *sdev, char *id, void *ref)
1593 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 1593 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
1594 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); 1594 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
1595} 1595}
1596
1597/**
1598 * zfcp_erp_port_access_denied - Adapter denied access to port.
1599 * @port: port where access has been denied
1600 * @id: id for debug trace
1601 * @ref: reference for debug trace
1602 *
1603 * Since the adapter has denied access, stop using the port and the
1604 * attached LUNs.
1605 */
1606void zfcp_erp_port_access_denied(struct zfcp_port *port, char *id, void *ref)
1607{
1608 zfcp_erp_modify_port_status(port, id, ref,
1609 ZFCP_STATUS_COMMON_ERP_FAILED |
1610 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
1611}
1612
1613/**
1614 * zfcp_erp_lun_access_denied - Adapter denied access to LUN.
1615 * @sdev: SCSI device / LUN where access has been denied
1616 * @id: id for debug trace
1617 * @ref: reference for debug trace
1618 *
1619 * Since the adapter has denied access, stop using the LUN.
1620 */
1621void zfcp_erp_lun_access_denied(struct scsi_device *sdev, char *id, void *ref)
1622{
1623 zfcp_erp_modify_lun_status(sdev, id, ref,
1624 ZFCP_STATUS_COMMON_ERP_FAILED |
1625 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
1626}
1627
1628static void zfcp_erp_lun_access_changed(struct scsi_device *sdev, char *id,
1629 void *ref)
1630{
1631 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
1632 int status = atomic_read(&zfcp_sdev->status);
1633
1634 if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
1635 ZFCP_STATUS_COMMON_ACCESS_BOXED)))
1636 return;
1637
1638 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
1639}
1640
1641static void zfcp_erp_port_access_changed(struct zfcp_port *port, char *id,
1642 void *ref)
1643{
1644 struct scsi_device *sdev;
1645 int status = atomic_read(&port->status);
1646
1647 if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
1648 ZFCP_STATUS_COMMON_ACCESS_BOXED))) {
1649 shost_for_each_device(sdev, port->adapter->scsi_host)
1650 if (sdev_to_zfcp(sdev)->port == port)
1651 zfcp_erp_lun_access_changed(sdev, id, ref);
1652 return;
1653 }
1654
1655 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
1656}
1657
1658/**
1659 * zfcp_erp_adapter_access_changed - Process change in adapter ACT
1660 * @adapter: Adapter where the Access Control Table (ACT) changed
1661 * @id: Id for debug trace
1662 * @ref: Reference for debug trace
1663 */
1664void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, char *id,
1665 void *ref)
1666{
1667 unsigned long flags;
1668 struct zfcp_port *port;
1669
1670 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
1671 return;
1672
1673 read_lock_irqsave(&adapter->port_list_lock, flags);
1674 list_for_each_entry(port, &adapter->port_list, list)
1675 zfcp_erp_port_access_changed(port, id, ref);
1676 read_unlock_irqrestore(&adapter->port_list_lock, flags);
1677}
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 80714679f5d6..7320132a430c 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -34,6 +34,14 @@ extern void zfcp_ccw_adapter_put(struct zfcp_adapter *);
34 34
35/* zfcp_cfdc.c */ 35/* zfcp_cfdc.c */
36extern struct miscdevice zfcp_cfdc_misc; 36extern struct miscdevice zfcp_cfdc_misc;
37extern void zfcp_cfdc_port_denied(struct zfcp_port *, union fsf_status_qual *);
38extern void zfcp_cfdc_lun_denied(struct scsi_device *, union fsf_status_qual *);
39extern void zfcp_cfdc_lun_shrng_vltn(struct scsi_device *,
40 union fsf_status_qual *);
41extern int zfcp_cfdc_open_lun_eval(struct scsi_device *,
42 struct fsf_qtcb_bottom_support *);
43extern void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *);
44
37 45
38/* zfcp_dbf.c */ 46/* zfcp_dbf.c */
39extern int zfcp_dbf_adapter_register(struct zfcp_adapter *); 47extern int zfcp_dbf_adapter_register(struct zfcp_adapter *);
@@ -88,10 +96,6 @@ extern void zfcp_erp_wait(struct zfcp_adapter *);
88extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long); 96extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long);
89extern void zfcp_erp_port_boxed(struct zfcp_port *, char *, void *); 97extern void zfcp_erp_port_boxed(struct zfcp_port *, char *, void *);
90extern void zfcp_erp_lun_boxed(struct scsi_device *, char *, void *); 98extern void zfcp_erp_lun_boxed(struct scsi_device *, char *, void *);
91extern void zfcp_erp_port_access_denied(struct zfcp_port *, char *, void *);
92extern void zfcp_erp_lun_access_denied(struct scsi_device *, char *, void *);
93extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *, char *,
94 void *);
95extern void zfcp_erp_timeout_handler(unsigned long); 99extern void zfcp_erp_timeout_handler(unsigned long);
96 100
97/* zfcp_fc.c */ 101/* zfcp_fc.c */
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
64static 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
76static 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
89static 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
105static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req) 64static 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,