aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs.c')
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c66
1 files changed, 39 insertions, 27 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 6b43bc46bf97..4f59356b07bb 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -68,19 +68,19 @@ ZFCP_DEFINE_ATTR(zfcp_port, port, access_denied, "%d\n",
68 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0); 68 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
69 69
70ZFCP_DEFINE_ATTR(zfcp_unit, unit, status, "0x%08x\n", 70ZFCP_DEFINE_ATTR(zfcp_unit, unit, status, "0x%08x\n",
71 atomic_read(&unit->status)); 71 zfcp_unit_sdev_status(unit));
72ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_recovery, "%d\n", 72ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_recovery, "%d\n",
73 (atomic_read(&unit->status) & 73 (zfcp_unit_sdev_status(unit) &
74 ZFCP_STATUS_COMMON_ERP_INUSE) != 0); 74 ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
75ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n", 75ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
76 (atomic_read(&unit->status) & 76 (zfcp_unit_sdev_status(unit) &
77 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0); 77 ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
78ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_shared, "%d\n", 78ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_shared, "%d\n",
79 (atomic_read(&unit->status) & 79 (zfcp_unit_sdev_status(unit) &
80 ZFCP_STATUS_UNIT_SHARED) != 0); 80 ZFCP_STATUS_LUN_SHARED) != 0);
81ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_readonly, "%d\n", 81ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_readonly, "%d\n",
82 (atomic_read(&unit->status) & 82 (zfcp_unit_sdev_status(unit) &
83 ZFCP_STATUS_UNIT_READONLY) != 0); 83 ZFCP_STATUS_LUN_READONLY) != 0);
84 84
85static ssize_t zfcp_sysfs_port_failed_show(struct device *dev, 85static ssize_t zfcp_sysfs_port_failed_show(struct device *dev,
86 struct device_attribute *attr, 86 struct device_attribute *attr,
@@ -121,11 +121,17 @@ static ssize_t zfcp_sysfs_unit_failed_show(struct device *dev,
121 char *buf) 121 char *buf)
122{ 122{
123 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev); 123 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
124 struct scsi_device *sdev;
125 unsigned int status, failed = 1;
126
127 sdev = zfcp_unit_sdev(unit);
128 if (sdev) {
129 status = atomic_read(&sdev_to_zfcp(sdev)->status);
130 failed = status & ZFCP_STATUS_COMMON_ERP_FAILED ? 1 : 0;
131 scsi_device_put(sdev);
132 }
124 133
125 if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_ERP_FAILED) 134 return sprintf(buf, "%d\n", failed);
126 return sprintf(buf, "1\n");
127
128 return sprintf(buf, "0\n");
129} 135}
130 136
131static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev, 137static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
@@ -134,15 +140,21 @@ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
134{ 140{
135 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev); 141 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
136 unsigned long val; 142 unsigned long val;
143 struct scsi_device *sdev;
137 144
138 if (strict_strtoul(buf, 0, &val) || val != 0) 145 if (strict_strtoul(buf, 0, &val) || val != 0)
139 return -EINVAL; 146 return -EINVAL;
140 147
141 zfcp_erp_modify_unit_status(unit, "syufai1", NULL, 148 sdev = zfcp_unit_sdev(unit);
142 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); 149 if (sdev) {
143 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, 150 zfcp_erp_modify_lun_status(sdev, "syufai1", NULL,
144 "syufai2", NULL); 151 ZFCP_STATUS_COMMON_RUNNING,
145 zfcp_erp_wait(unit->port->adapter); 152 ZFCP_SET);
153 zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
154 "syufai2", NULL);
155 zfcp_erp_wait(unit->port->adapter);
156 } else
157 zfcp_unit_scsi_scan(unit);
146 158
147 return count; 159 return count;
148} 160}
@@ -347,9 +359,9 @@ zfcp_sysfs_unit_##_name##_latency_show(struct device *dev, \
347 struct device_attribute *attr, \ 359 struct device_attribute *attr, \
348 char *buf) { \ 360 char *buf) { \
349 struct scsi_device *sdev = to_scsi_device(dev); \ 361 struct scsi_device *sdev = to_scsi_device(dev); \
350 struct zfcp_unit *unit = sdev->hostdata; \ 362 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); \
351 struct zfcp_latencies *lat = &unit->latencies; \ 363 struct zfcp_latencies *lat = &zfcp_sdev->latencies; \
352 struct zfcp_adapter *adapter = unit->port->adapter; \ 364 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; \
353 unsigned long long fsum, fmin, fmax, csum, cmin, cmax, cc; \ 365 unsigned long long fsum, fmin, fmax, csum, cmin, cmax, cc; \
354 \ 366 \
355 spin_lock_bh(&lat->lock); \ 367 spin_lock_bh(&lat->lock); \
@@ -378,8 +390,8 @@ zfcp_sysfs_unit_##_name##_latency_store(struct device *dev, \
378 const char *buf, size_t count) \ 390 const char *buf, size_t count) \
379{ \ 391{ \
380 struct scsi_device *sdev = to_scsi_device(dev); \ 392 struct scsi_device *sdev = to_scsi_device(dev); \
381 struct zfcp_unit *unit = sdev->hostdata; \ 393 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); \
382 struct zfcp_latencies *lat = &unit->latencies; \ 394 struct zfcp_latencies *lat = &zfcp_sdev->latencies; \
383 unsigned long flags; \ 395 unsigned long flags; \
384 \ 396 \
385 spin_lock_irqsave(&lat->lock, flags); \ 397 spin_lock_irqsave(&lat->lock, flags); \
@@ -407,26 +419,26 @@ static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \
407 struct device_attribute *attr,\ 419 struct device_attribute *attr,\
408 char *buf) \ 420 char *buf) \
409{ \ 421{ \
410 struct scsi_device *sdev = to_scsi_device(dev); \ 422 struct scsi_device *sdev = to_scsi_device(dev); \
411 struct zfcp_unit *unit = sdev->hostdata; \ 423 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); \
424 struct zfcp_port *port = zfcp_sdev->port; \
412 \ 425 \
413 return sprintf(buf, _format, _value); \ 426 return sprintf(buf, _format, _value); \
414} \ 427} \
415static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL); 428static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
416 429
417ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n", 430ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n",
418 dev_name(&unit->port->adapter->ccw_device->dev)); 431 dev_name(&port->adapter->ccw_device->dev));
419ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n", 432ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n",
420 (unsigned long long) unit->port->wwpn); 433 (unsigned long long) port->wwpn);
421 434
422static ssize_t zfcp_sysfs_scsi_fcp_lun_show(struct device *dev, 435static ssize_t zfcp_sysfs_scsi_fcp_lun_show(struct device *dev,
423 struct device_attribute *attr, 436 struct device_attribute *attr,
424 char *buf) 437 char *buf)
425{ 438{
426 struct scsi_device *sdev = to_scsi_device(dev); 439 struct scsi_device *sdev = to_scsi_device(dev);
427 struct zfcp_unit *unit = sdev->hostdata;
428 440
429 return sprintf(buf, "0x%016llx\n", (unsigned long long) unit->fcp_lun); 441 return sprintf(buf, "0x%016llx\n", zfcp_scsi_dev_lun(sdev));
430} 442}
431static DEVICE_ATTR(fcp_lun, S_IRUGO, zfcp_sysfs_scsi_fcp_lun_show, NULL); 443static DEVICE_ATTR(fcp_lun, S_IRUGO, zfcp_sysfs_scsi_fcp_lun_show, NULL);
432 444