Skip to contentSkip to conversation

s390: zfcp read-only lun sharing.

PATCH New Martin Schwidefsky 1 participant 1 message Nov 11, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/10 s390: zfcp read-only lun sharing.

[patch 9/10] s390: zfcp read-only lun sharing.

From: Volker Sameske <[email protected]>

zfcp host adapter:
- Add read-only lun sharing feature.

diffstat:

 drivers/s390/scsi/zfcp_def.h        |    8 ++
 drivers/s390/scsi/zfcp_erp.c        |    8 +-
 drivers/s390/scsi/zfcp_fsf.c        |  118 ++++++++++++++++++++++++++++++------
 drivers/s390/scsi/zfcp_fsf.h        |   14 +++-
 drivers/s390/scsi/zfcp_sysfs_port.c |    4 +
 drivers/s390/scsi/zfcp_sysfs_unit.c |   10 +++
 6 files changed, 140 insertions(+), 22 deletions(-)
drivers/s390/scsi/zfcp_def.h +8 -0
diff -urN linux-2.6/drivers/s390/scsi/zfcp_def.h linux-2.6-patched/drivers/s390/scsi/zfcp_def.h
@@ -13,6 +13,7 @@
  *            Stefan Bader <[email protected]> 
  *            Heiko Carstens <[email protected]> 
  *            Andreas Herrmann <[email protected]>
+ *            Volker Sameske <[email protected]>
  * 
  * This program is free software; you can redistribute it and/or modify 
  * it under the terms of the GNU General Public License as published by 
@@ -378,6 +379,9 @@
 
 #define ZFCP_NAME               "zfcp"
 
+/* read-only LUN sharing switch initial value */
+#define ZFCP_RO_LUN_SHARING_DEFAULTS 0
+
 /* independent log areas */
 #define ZFCP_LOG_AREA_OTHER	0
 #define ZFCP_LOG_AREA_SCSI	1
@@ -528,6 +532,7 @@
 #define ZFCP_STATUS_PORT_NO_WWPN		0x00000008
 #define ZFCP_STATUS_PORT_NO_SCSI_ID		0x00000010
 #define ZFCP_STATUS_PORT_INVALID_WWPN		0x00000020
+#define ZFCP_STATUS_PORT_ACCESS_DENIED		0x00000040
 
 /* for ports with well known addresses */
 #define ZFCP_STATUS_PORT_WKA \
@@ -536,6 +541,9 @@
 
 /* logical unit status */
 #define ZFCP_STATUS_UNIT_NOTSUPPUNITRESET       0x00000001
+#define ZFCP_STATUS_UNIT_ACCESS_DENIED          0x00000002
+#define ZFCP_STATUS_UNIT_ACCESS_SHARED          0x00000004
+#define ZFCP_STATUS_UNIT_ACCESS_READONLY        0x00000008
 #define ZFCP_STATUS_UNIT_TEMPORARY		0x00000010
 
 
drivers/s390/scsi/zfcp_erp.c +6 -2
diff -urN linux-2.6/drivers/s390/scsi/zfcp_erp.c linux-2.6-patched/drivers/s390/scsi/zfcp_erp.c
@@ -2810,7 +2810,8 @@
 			  ZFCP_STATUS_COMMON_CLOSING |
 			  ZFCP_STATUS_PORT_DID_DID |
 			  ZFCP_STATUS_PORT_PHYS_CLOSING |
-			  ZFCP_STATUS_PORT_INVALID_WWPN, &port->status);
+			  ZFCP_STATUS_PORT_INVALID_WWPN |
+			  ZFCP_STATUS_PORT_ACCESS_DENIED, &port->status);
 	return retval;
 }
 
@@ -3014,7 +3015,10 @@
 	debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t));
 
 	atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING |
-			  ZFCP_STATUS_COMMON_CLOSING, &unit->status);
+			  ZFCP_STATUS_COMMON_CLOSING |
+			  ZFCP_STATUS_UNIT_ACCESS_DENIED |
+			  ZFCP_STATUS_UNIT_ACCESS_SHARED |
+			  ZFCP_STATUS_UNIT_ACCESS_READONLY, &unit->status);
 
 	return retval;
 }
drivers/s390/scsi/zfcp_fsf.c +100 -18

214 lines not on this page · raw message

drivers/s390/scsi/zfcp_fsf.h +12 -2
diff -urN linux-2.6/drivers/s390/scsi/zfcp_fsf.h linux-2.6-patched/drivers/s390/scsi/zfcp_fsf.h
@@ -11,8 +11,9 @@
  *            Aron Zeh
  *            Wolfgang Taphorn
  *            Stefan Bader <[email protected]> 
- *            Heiko Carstens <[email protected]> 
+ *            Heiko Carstens <[email protected]>
  *            Andreas Herrmann <[email protected]>
+ *            Volker Sameske <[email protected]>
  * 
  * This program is free software; you can redistribute it and/or modify 
  * it under the terms of the GNU General Public License as published by 
@@ -150,6 +151,7 @@
 /* status types in status read buffer */
 #define FSF_STATUS_READ_PORT_CLOSED		0x00000001
 #define FSF_STATUS_READ_INCOMING_ELS		0x00000002
+#define FSF_STATUS_READ_SENSE_DATA_AVAIL        0x00000003
 #define FSF_STATUS_READ_BIT_ERROR_THRESHOLD	0x00000004
 #define FSF_STATUS_READ_LINK_DOWN		0x00000005 /* FIXME: really? */
 #define FSF_STATUS_READ_LINK_UP          	0x00000006
@@ -192,11 +194,13 @@
 /* channel features */
 #define FSF_FEATURE_QTCB_SUPPRESSION            0x00000001
 #define FSF_FEATURE_CFDC			0x00000002
+#define FSF_FEATURE_LUN_SHARING			0x00000004
 #define FSF_FEATURE_HBAAPI_MANAGEMENT           0x00000010
 #define FSF_FEATURE_ELS_CT_CHAINED_SBALS        0x00000020
 
 /* option */
 #define FSF_OPEN_LUN_SUPPRESS_BOXING		0x00000001
+#define FSF_OPEN_LUN_REPLICATE_SENSE		0x00000002
 
 /* adapter types */
 #define FSF_ADAPTER_TYPE_FICON                  0x00000001
@@ -228,6 +232,11 @@
 #define FSF_IOSTAT_FABRIC_RJT			0x00000005
 #define FSF_IOSTAT_LS_RJT			0x00000009
 
+/* open LUN access flags*/
+#define FSF_UNIT_ACCESS_OPEN_LUN_ALLOWED        0x01000000
+#define FSF_UNIT_ACCESS_EXCLUSIVE_ACCESS        0x02000000
+#define FSF_UNIT_ACCESS_OUTBOUND_TRANSFER       0x10000000
+
 struct fsf_queue_designator;
 struct fsf_status_read_buffer;
 struct fsf_port_closed_payload;
@@ -381,7 +390,8 @@
 	u32 service_class;
 	u8  res3[3];
 	u8  timeout;
-	u8  res4[184];
+        u32 lun_access_info;
+        u8  res4[180];
 	u32 els1_length;
 	u32 els2_length;
 	u32 req_buf_length;
drivers/s390/scsi/zfcp_sysfs_port.c +4 -0
diff -urN linux-2.6/drivers/s390/scsi/zfcp_sysfs_port.c linux-2.6-patched/drivers/s390/scsi/zfcp_sysfs_port.c
@@ -11,6 +11,7 @@
  *      Martin Peschke <[email protected]>
  *	Heiko Carstens <[email protected]>
  *      Andreas Herrmann <[email protected]>
+ *      Volker Sameske <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,6 +70,8 @@
 ZFCP_DEFINE_PORT_ATTR(scsi_id, "0x%x\n", port->scsi_id);
 ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask
 		      (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status));
+ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask
+		      (ZFCP_STATUS_PORT_ACCESS_DENIED, &port->status));
 
 /**
  * zfcp_sysfs_unit_add_store - add a unit to sysfs tree
@@ -245,6 +248,7 @@
 	&dev_attr_status.attr,
 	&dev_attr_wwnn.attr,
 	&dev_attr_d_id.attr,
+	&dev_attr_access_denied.attr,
 	NULL
 };
 
drivers/s390/scsi/zfcp_sysfs_unit.c +10 -0
diff -urN linux-2.6/drivers/s390/scsi/zfcp_sysfs_unit.c linux-2.6-patched/drivers/s390/scsi/zfcp_sysfs_unit.c
@@ -11,6 +11,7 @@
  *      Martin Peschke <[email protected]>
  *	Heiko Carstens <[email protected]>
  *      Andreas Herrmann <[email protected]>
+ *      Volker Sameske <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -67,6 +68,12 @@
 ZFCP_DEFINE_UNIT_ATTR(scsi_lun, "0x%x\n", unit->scsi_lun);
 ZFCP_DEFINE_UNIT_ATTR(in_recovery, "%d\n", atomic_test_mask
 		      (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status));
+ZFCP_DEFINE_UNIT_ATTR(access_denied, "%d\n", atomic_test_mask
+		      (ZFCP_STATUS_UNIT_ACCESS_DENIED, &unit->status));
+ZFCP_DEFINE_UNIT_ATTR(access_shared, "%d\n", atomic_test_mask
+		      (ZFCP_STATUS_UNIT_ACCESS_SHARED, &unit->status));
+ZFCP_DEFINE_UNIT_ATTR(access_readonly, "%d\n", atomic_test_mask
+		      (ZFCP_STATUS_UNIT_ACCESS_READONLY, &unit->status));
 
 /**
  * zfcp_sysfs_unit_failed_store - failed state of unit
@@ -135,6 +142,9 @@
 	&dev_attr_failed.attr,
 	&dev_attr_in_recovery.attr,
 	&dev_attr_status.attr,
+	&dev_attr_access_denied.attr,
+	&dev_attr_access_shared.attr,
+	&dev_attr_access_readonly.attr,
 	NULL
 };