* [PATCH 00/13] More patches from SLES
@ 2013-01-16 12:14 Hannes Reinecke
2013-01-16 12:14 ` [PATCH 01/13] Fixup .gitignore Hannes Reinecke
` (13 more replies)
0 siblings, 14 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Hi Christophe,
here are some more patches from SLES.
Most are missing patches from the initial resync;
however, the transport id stuff is a rework from
the SLES sources and has been enhanced to cover SAS.
Please apply.
Hannes Reinecke (13):
Fixup .gitignore
Check for !SUSPENDED in kpartx rules
kpartx.rules: Check for accessible device-mapper device
Correct persistent symlink for cciss
Add hardware entry for Intel Multi-Flex
Add Datacore SANSymphony to hwtable
Add SUN STK6580 to hardware table
Remove unused structures
Use transport identifiers when detecting devices
Discover target ids for ATA
Set recovery_tmo for iSCSI devices
Set I_T_nexus_loss_timeout on SAS devices
Rename variables in sysfs_get_tgt_nodename
.gitignore | 8 +-
kpartx/kpartx.rules | 4 +-
kpartx/kpartx_id | 3 +
libmultipath/discovery.c | 190 ++++++++++++++++++++++++++++++++++++---------
libmultipath/hwtable.c | 39 ++++++++++
libmultipath/structs.h | 26 +++---
6 files changed, 215 insertions(+), 55 deletions(-)
--
1.7.4.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 01/13] Fixup .gitignore
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 02/13] Check for !SUSPENDED in kpartx rules Hannes Reinecke
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Only exclude the binaries, not the entire directories ...
And the nfs link, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
.gitignore | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9b3f663..7f25d0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,8 @@
*.so.0
*.a
*.gz
-kpartx
-multipath
-multipathd
+kpartx/kpartx
+multipath/multipath
+multipathd/multipathd
+mpathpersist/mpathpersist
+.nfs*
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 02/13] Check for !SUSPENDED in kpartx rules
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
2013-01-16 12:14 ` [PATCH 01/13] Fixup .gitignore Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 03/13] kpartx.rules: Check for accessible device-mapper device Hannes Reinecke
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Read-only devices appear as DM_STATE=READONLY, so we should
invert the check in kpartx rules to have kpartx run on
readonly devices, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kpartx/kpartx.rules | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 64863a0..febac90 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -22,7 +22,7 @@ ENV{DM_PART}=="?*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
# Create dm tables for partitions
-ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
+ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
RUN+="/sbin/kpartx -u -p -part /dev/$name"
LABEL="kpartx_end"
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 03/13] kpartx.rules: Check for accessible device-mapper device
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
2013-01-16 12:14 ` [PATCH 01/13] Fixup .gitignore Hannes Reinecke
2013-01-16 12:14 ` [PATCH 02/13] Check for !SUSPENDED in kpartx rules Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 04/13] Correct persistent symlink for cciss Hannes Reinecke
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
We need to check for accessible device-mapper devices
right at the start, otherwise kpartx would be run on
inactive devices.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kpartx/kpartx.rules | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index febac90..ba5c6cb 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -8,6 +8,8 @@ KERNEL!="dm-*", GOTO="kpartx_end"
ACTION=="remove", GOTO="kpartx_end"
ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end"
+ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end"
+ENV{DM_DEPS}=="0", GOTO="kpartx_end"
ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 04/13] Correct persistent symlink for cciss
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (2 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 03/13] kpartx.rules: Check for accessible device-mapper device Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 05/13] Add hardware entry for Intel Multi-Flex Hannes Reinecke
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
cciss devices have the prefix 'cciss', so we should generate the
correct one from kpartx_id, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kpartx/kpartx_id | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id
index 81f32bf..fa21b5b 100644
--- a/kpartx/kpartx_id
+++ b/kpartx/kpartx_id
@@ -79,6 +79,9 @@ if [ -n "$dmdeps" ] ; then
*\(94,*)
echo "DM_TYPE=dasd"
;;
+ *\(104,* | *\(105,* | *\(106,* | *\(107,* | *\(108,* | *\(109,* | *\(110,* | *\(112,*)
+ echo "DM_TYPE=cciss"
+ ;;
*\(9*)
echo "DM_TYPE=raid"
;;
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 05/13] Add hardware entry for Intel Multi-Flex
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (3 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 04/13] Correct persistent symlink for cciss Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 06/13] Add Datacore SANSymphony to hwtable Hannes Reinecke
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 6924a61..174df7e 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -1062,6 +1062,19 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_RDAC,
.prio_args = NULL,
},
+ {
+ .vendor = "Intel",
+ .product = "Multi-Flex",
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 alua",
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .checker_name = TUR,
+ .prio_name = PRIO_ALUA,
+ .prio_args = NULL,
+ },
/*
* EOL
*/
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 06/13] Add Datacore SANSymphony to hwtable
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (4 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 05/13] Add hardware entry for Intel Multi-Flex Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 20:53 ` Christophe Varoqui
2013-01-16 12:14 ` [PATCH 07/13] Add SUN STK6580 to hardware table Hannes Reinecke
` (7 subsequent siblings)
13 siblings, 1 reply; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 174df7e..9ed3a82 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -1075,6 +1075,19 @@ static struct hwentry default_hw[] = {
.prio_name = PRIO_ALUA,
.prio_args = NULL,
},
+ {
+ .vendor = "DataCore",
+ .product = "SANmelody",
+ .features = DEFAULT_FEATURES,
+ .hwhandler = DEFAULT_HWHANDLER,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .checker_name = TUR,
+ .prio_name = PRIO_ALUA,
+ .prio_args = NULL,
+ },
/*
* EOL
*/
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 07/13] Add SUN STK6580 to hardware table
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (5 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 06/13] Add Datacore SANSymphony to hwtable Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 08/13] Remove unused structures Hannes Reinecke
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 9ed3a82..c5b4071 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -957,6 +957,19 @@ static struct hwentry default_hw[] = {
.prio_args = NULL,
},
{
+ .vendor = "SUN",
+ .product = "STK6580_6780",
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 rdac",
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .checker_name = TUR,
+ .prio_name = PRIO_RDAC,
+ .prio_args = NULL,
+ },
+ {
.vendor = "EUROLOGC",
.product = "FC2502",
.features = DEFAULT_FEATURES,
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 08/13] Remove unused structures
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (6 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 07/13] Add SUN STK6580 to hardware table Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 09/13] Use transport identifiers when detecting devices Hannes Reinecke
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
structs scsi_dev and scsi_idlun are unused.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/structs.h | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 2beccb3..4085900 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -113,12 +113,6 @@ enum detect_prio_states {
DETECT_PRIO_ON,
};
-struct scsi_idlun {
- int dev_id;
- int host_unique_id;
- int host_no;
-};
-
struct sg_id {
int host_no;
int channel;
@@ -130,12 +124,6 @@ struct sg_id {
int unused2;
};
-struct scsi_dev {
- char dev[FILE_NAME_SIZE];
- struct scsi_idlun scsi_id;
- int host_no;
-};
-
# ifndef HDIO_GETGEO
# define HDIO_GETGEO 0x0301 /* get device geometry */
@@ -151,7 +139,6 @@ struct path {
char dev[FILE_NAME_SIZE];
char dev_t[BLK_DEV_SIZE];
struct udev_device *udev;
- struct scsi_idlun scsi_id;
struct sg_id sg_id;
struct hd_geometry geom;
char wwid[WWID_SIZE];
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 09/13] Use transport identifiers when detecting devices
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (7 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 08/13] Remove unused structures Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 10/13] Discover target ids for ATA Hannes Reinecke
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
This patch stores the transport identifiers, allowing
for a simplified dev_loss_tmo setting.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 59 ++++++++++++++++++++++++++-------------------
libmultipath/structs.h | 17 +++++++++++-
2 files changed, 49 insertions(+), 27 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 8b6f74d..3fd33a3 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -207,6 +207,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
{
const char *targetid, *value;
struct udev_device *parent, *tgtdev;
+ int host, channel, rport_id = -1;
parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_device");
if (!parent)
@@ -214,6 +215,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
/* Check for SAS */
value = udev_device_get_sysattr_value(parent, "sas_address");
if (value) {
+ pp->sg_id.proto_id = SCSI_PROTOCOL_SAS;
strncpy(node, value, NODE_NAME_SIZE);
return 0;
}
@@ -221,19 +223,30 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_target");
if (!parent)
return 1;
- tgtdev = udev_device_new_from_subsystem_sysname(conf->udev, "fc_transport", udev_device_get_sysname(parent));
- /* Check if it's FibreChannel */
- if (tgtdev) {
- const char *value;
-
- value = udev_device_get_sysattr_value(tgtdev, "node_name");
- if (value) {
- strncpy(node, value, NODE_NAME_SIZE);
- udev_device_unref(tgtdev);
- return 0;
+ /* Check for FibreChannel */
+ tgtdev = udev_device_get_parent(parent);
+ value = udev_device_get_sysname(tgtdev);
+ if (sscanf(value, "rport-%d:%d-%d",
+ &host, &channel, &rport_id) == 3) {
+ tgtdev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "fc_remote_ports", value);
+ if (tgtdev) {
+ condlog(3, "SCSI target %d:%d:%d -> "
+ "FC rport %d:%d-%d",
+ pp->sg_id.host_no, pp->sg_id.channel,
+ pp->sg_id.scsi_id, host, channel,
+ rport_id);
+ value = udev_device_get_sysattr_value(tgtdev,
+ "node_name");
+ if (value) {
+ pp->sg_id.proto_id = SCSI_PROTOCOL_FCP;
+ pp->sg_id.transport_id = rport_id;
+ strncpy(node, value, NODE_NAME_SIZE);
+ udev_device_unref(tgtdev);
+ return 0;
+ } else
+ udev_device_unref(tgtdev);
}
- else
- udev_device_unref(tgtdev);
}
/* Check for iSCSI */
@@ -253,6 +266,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
value = udev_device_get_sysattr_value(tgtdev, "targetname");
if (value) {
+ pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI;
strncpy(node, value, NODE_NAME_SIZE);
udev_device_unref(tgtdev);
return 0;
@@ -267,25 +281,20 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
static void
sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
{
- struct udev_device *parent = pp->udev;
struct udev_device *rport_dev = NULL;
char value[11];
- const char *rport_id = NULL;
+ char rport_id[32];
- while (parent) {
- rport_id = udev_device_get_sysname(parent);
- if (!strncmp(rport_id, "rport-", 6))
- break;
- parent = udev_device_get_parent(parent);
- rport_id = NULL;
- }
- if (!parent || !rport_id) {
- condlog(0, "%s: rport id not found", pp->dev);
+ if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP) {
+ condlog(3, "%s: Not a FCP device", pp->dev);
return;
}
- rport_dev = udev_device_new_from_subsystem_sysname(conf->udev, "fc_remote_ports", rport_id);
+ sprintf(rport_id, "rport-%d:%d-%d",
+ pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
+ rport_dev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "fc_remote_ports", rport_id);
if (!rport_dev) {
- condlog(3, "%s: No fc_remote_port device for '%s'", pp->dev,
+ condlog(1, "%s: No fc_remote_port device for '%s'", pp->dev,
rport_id);
return;
}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 4085900..ab05a78 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -113,6 +113,19 @@ enum detect_prio_states {
DETECT_PRIO_ON,
};
+enum scsi_protocol {
+ SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
+ SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
+ SCSI_PROTOCOL_SSA = 2, /* Serial Storage Architecture - Obsolete */
+ SCSI_PROTOCOL_SBP = 3, /* firewire */
+ SCSI_PROTOCOL_SRP = 4, /* Infiniband RDMA */
+ SCSI_PROTOCOL_ISCSI = 5,
+ SCSI_PROTOCOL_SAS = 6,
+ SCSI_PROTOCOL_ADT = 7, /* Media Changers */
+ SCSI_PROTOCOL_ATA = 8,
+ SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
+};
+
struct sg_id {
int host_no;
int channel;
@@ -120,8 +133,8 @@ struct sg_id {
int lun;
short h_cmd_per_lun;
short d_queue_depth;
- int unused1;
- int unused2;
+ enum scsi_protocol proto_id;
+ int transport_id;
};
# ifndef HDIO_GETGEO
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 10/13] Discover target ids for ATA
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (8 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 09/13] Use transport identifiers when detecting devices Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 11/13] Set recovery_tmo for iSCSI devices Hannes Reinecke
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
libata devices now have a separate sysfs entry, so we should be
discovering them properly, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 3fd33a3..b6bce22 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -207,7 +207,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
{
const char *targetid, *value;
struct udev_device *parent, *tgtdev;
- int host, channel, rport_id = -1;
+ int host, channel, rport_id = -1, ata_id = -1;
parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_device");
if (!parent)
@@ -275,6 +275,23 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
udev_device_unref(tgtdev);
}
}
+ /* Check for libata */
+ parent = pp->udev;
+ targetid = NULL;
+ while (parent) {
+ targetid = udev_device_get_sysname(parent);
+ if (targetid && sscanf(targetid, "ata%d", &ata_id) == 1)
+ break;
+ parent = udev_device_get_parent(parent);
+ targetid = NULL;
+ }
+ if (targetid) {
+ pp->sg_id.proto_id = SCSI_PROTOCOL_ATA;
+ pp->sg_id.transport_id = ata_id;
+ snprintf(node, NODE_NAME_SIZE, "ata-%d.00", ata_id);
+ return 0;
+ }
+ pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
return 1;
}
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 11/13] Set recovery_tmo for iSCSI devices
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (9 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 10/13] Discover target ids for ATA Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 12/13] Set I_T_nexus_loss_timeout on SAS devices Hannes Reinecke
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
iSCSI has a 'recovery_tmo' value, which works similar to the
'fast_io_fail' mechanism on FibreChannel.
So we should be setting it from multipath, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 59 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index b6bce22..a099996 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -254,19 +254,22 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
targetid = NULL;
while (parent) {
targetid = udev_device_get_sysname(parent);
- if (!strncmp(targetid , "session", 6))
+ if (targetid && sscanf(targetid , "session%d", &rport_id) == 1)
break;
parent = udev_device_get_parent(parent);
targetid = NULL;
+ rport_id = -1;
}
- if (parent) {
- tgtdev = udev_device_new_from_subsystem_sysname(conf->udev, "iscsi_session", targetid);
+ if (parent && targetid) {
+ tgtdev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "iscsi_session", targetid);
if (tgtdev) {
const char *value;
value = udev_device_get_sysattr_value(tgtdev, "targetname");
if (value) {
pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI;
+ pp->sg_id.transport_id = rport_id;
strncpy(node, value, NODE_NAME_SIZE);
udev_device_unref(tgtdev);
return 0;
@@ -302,10 +305,6 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
char value[11];
char rport_id[32];
- if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP) {
- condlog(3, "%s: Not a FCP device", pp->dev);
- return;
- }
sprintf(rport_id, "rport-%d:%d-%d",
pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
rport_dev = udev_device_new_from_subsystem_sysname(conf->udev,
@@ -351,6 +350,47 @@ out:
udev_device_unref(rport_dev);
}
+static void
+sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
+{
+ struct udev_device *session_dev = NULL;
+ char session_id[64];
+ char value[11];
+
+ sprintf(session_id, "session%d", pp->sg_id.transport_id);
+ session_dev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "iscsi_session", session_id);
+ if (!session_dev) {
+ condlog(1, "%s: No iscsi session for '%s'", pp->dev,
+ session_id);
+ return;
+ }
+ condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
+ pp->sg_id.channel, pp->sg_id.scsi_id, session_id);
+
+ if (mpp->dev_loss) {
+ condlog(3, "%s: ignoring dev_loss_tmo on iSCSI", pp->dev);
+ }
+ if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
+ if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) {
+ condlog(3, "%s: can't switch off fast_io_fail_tmo "
+ "on iSCSI", pp->dev);
+ } else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) {
+ condlog(3, "%s: can't set fast_io_fail_tmo to '0'"
+ "on iSCSI", pp->dev);
+ } else {
+ snprintf(value, 11, "%u", mpp->fast_io_fail);
+ if (sysfs_attr_set_value(session_dev, "recovery_tmo",
+ value, 11)) {
+ condlog(3, "%s: Failed to set recovery_tmo, "
+ " error %d", pp->dev, errno);
+ }
+ }
+ }
+ udev_device_unref(session_dev);
+ return;
+}
+
int
sysfs_set_scsi_tmo (struct multipath *mpp)
{
@@ -382,7 +422,10 @@ sysfs_set_scsi_tmo (struct multipath *mpp)
return 0;
vector_foreach_slot(mpp->paths, pp, i) {
- sysfs_set_rport_tmo(mpp, pp);
+ if (pp->sg_id.proto_id == SCSI_PROTOCOL_FCP)
+ sysfs_set_rport_tmo(mpp, pp);
+ if (pp->sg_id.proto_id == SCSI_PROTOCOL_ISCSI)
+ sysfs_set_session_tmo(mpp, pp);
}
return 0;
}
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 12/13] Set I_T_nexus_loss_timeout on SAS devices
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (10 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 11/13] Set recovery_tmo for iSCSI devices Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 12:14 ` [PATCH 13/13] Rename variables in sysfs_get_tgt_nodename Hannes Reinecke
2013-01-16 21:06 ` [PATCH 00/13] More patches from SLES Christophe Varoqui
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
Some SAS driver have an I_T_nexus_loss setting, which works
similar to the 'dev_loss_tmo' setting on FibreChannel.
So update it with the current values, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 51 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a099996..65f9c57 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -215,9 +215,21 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
/* Check for SAS */
value = udev_device_get_sysattr_value(parent, "sas_address");
if (value) {
- pp->sg_id.proto_id = SCSI_PROTOCOL_SAS;
- strncpy(node, value, NODE_NAME_SIZE);
- return 0;
+ tgtdev = udev_device_get_parent(parent);
+ while (tgtdev) {
+ targetid = udev_device_get_sysname(tgtdev);
+ if (sscanf(targetid, "end_device-%d:%d",
+ &host, &rport_id) == 2)
+ break;
+ tgtdev = udev_device_get_parent(tgtdev);
+ rport_id = -1;
+ }
+ if (rport_id >= 0) {
+ pp->sg_id.proto_id = SCSI_PROTOCOL_SAS;
+ pp->sg_id.transport_id = rport_id;
+ strncpy(node, value, NODE_NAME_SIZE);
+ return 0;
+ }
}
parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_target");
@@ -391,6 +403,37 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
return;
}
+static void
+sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
+{
+ struct udev_device *sas_dev = NULL;
+ char end_dev_id[64];
+ char value[11];
+
+ sprintf(end_dev_id, "end_device-%d:%d",
+ pp->sg_id.host_no, pp->sg_id.transport_id);
+ sas_dev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "sas_end_device", end_dev_id);
+ if (!sas_dev) {
+ condlog(1, "%s: No SAS end device for '%s'", pp->dev,
+ end_dev_id);
+ return;
+ }
+ condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
+ pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id);
+
+ if (mpp->dev_loss) {
+ snprintf(value, 11, "%u", mpp->dev_loss);
+ if (sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout",
+ value, 11) <= 0)
+ condlog(3, "%s: failed to update "
+ "I_T Nexus loss timeout, error %d",
+ pp->dev, errno);
+ }
+ udev_device_unref(sas_dev);
+ return;
+}
+
int
sysfs_set_scsi_tmo (struct multipath *mpp)
{
@@ -426,6 +469,8 @@ sysfs_set_scsi_tmo (struct multipath *mpp)
sysfs_set_rport_tmo(mpp, pp);
if (pp->sg_id.proto_id == SCSI_PROTOCOL_ISCSI)
sysfs_set_session_tmo(mpp, pp);
+ if (pp->sg_id.proto_id == SCSI_PROTOCOL_SAS)
+ sysfs_set_nexus_loss_tmo(mpp, pp);
}
return 0;
}
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 13/13] Rename variables in sysfs_get_tgt_nodename
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (11 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 12/13] Set I_T_nexus_loss_timeout on SAS devices Hannes Reinecke
@ 2013-01-16 12:14 ` Hannes Reinecke
2013-01-16 21:06 ` [PATCH 00/13] More patches from SLES Christophe Varoqui
13 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-01-16 12:14 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: dm-devel
For consistency.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 54 +++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 65f9c57..3fbc181 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -205,9 +205,9 @@ sysfs_get_timeout(struct path *pp, unsigned int *timeout)
int
sysfs_get_tgt_nodename (struct path *pp, char * node)
{
- const char *targetid, *value;
+ const char *tgtname, *value;
struct udev_device *parent, *tgtdev;
- int host, channel, rport_id = -1, ata_id = -1;
+ int host, channel, tgtid = -1;
parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_device");
if (!parent)
@@ -217,16 +217,16 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
if (value) {
tgtdev = udev_device_get_parent(parent);
while (tgtdev) {
- targetid = udev_device_get_sysname(tgtdev);
- if (sscanf(targetid, "end_device-%d:%d",
- &host, &rport_id) == 2)
+ tgtname = udev_device_get_sysname(tgtdev);
+ if (sscanf(tgtname, "end_device-%d:%d",
+ &host, &tgtid) == 2)
break;
tgtdev = udev_device_get_parent(tgtdev);
- rport_id = -1;
+ tgtid = -1;
}
- if (rport_id >= 0) {
+ if (tgtid >= 0) {
pp->sg_id.proto_id = SCSI_PROTOCOL_SAS;
- pp->sg_id.transport_id = rport_id;
+ pp->sg_id.transport_id = tgtid;
strncpy(node, value, NODE_NAME_SIZE);
return 0;
}
@@ -239,7 +239,7 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
tgtdev = udev_device_get_parent(parent);
value = udev_device_get_sysname(tgtdev);
if (sscanf(value, "rport-%d:%d-%d",
- &host, &channel, &rport_id) == 3) {
+ &host, &channel, &tgtid) == 3) {
tgtdev = udev_device_new_from_subsystem_sysname(conf->udev,
"fc_remote_ports", value);
if (tgtdev) {
@@ -247,12 +247,12 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
"FC rport %d:%d-%d",
pp->sg_id.host_no, pp->sg_id.channel,
pp->sg_id.scsi_id, host, channel,
- rport_id);
+ tgtid);
value = udev_device_get_sysattr_value(tgtdev,
"node_name");
if (value) {
pp->sg_id.proto_id = SCSI_PROTOCOL_FCP;
- pp->sg_id.transport_id = rport_id;
+ pp->sg_id.transport_id = tgtid;
strncpy(node, value, NODE_NAME_SIZE);
udev_device_unref(tgtdev);
return 0;
@@ -263,25 +263,25 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
/* Check for iSCSI */
parent = pp->udev;
- targetid = NULL;
+ tgtname = NULL;
while (parent) {
- targetid = udev_device_get_sysname(parent);
- if (targetid && sscanf(targetid , "session%d", &rport_id) == 1)
+ tgtname = udev_device_get_sysname(parent);
+ if (tgtname && sscanf(tgtname , "session%d", &tgtid) == 1)
break;
parent = udev_device_get_parent(parent);
- targetid = NULL;
- rport_id = -1;
+ tgtname = NULL;
+ tgtid = -1;
}
- if (parent && targetid) {
+ if (parent && tgtname) {
tgtdev = udev_device_new_from_subsystem_sysname(conf->udev,
- "iscsi_session", targetid);
+ "iscsi_session", tgtname);
if (tgtdev) {
const char *value;
- value = udev_device_get_sysattr_value(tgtdev, "targetname");
+ value = udev_device_get_sysattr_value(tgtdev, "tgtname");
if (value) {
pp->sg_id.proto_id = SCSI_PROTOCOL_ISCSI;
- pp->sg_id.transport_id = rport_id;
+ pp->sg_id.transport_id = tgtid;
strncpy(node, value, NODE_NAME_SIZE);
udev_device_unref(tgtdev);
return 0;
@@ -292,18 +292,18 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
}
/* Check for libata */
parent = pp->udev;
- targetid = NULL;
+ tgtname = NULL;
while (parent) {
- targetid = udev_device_get_sysname(parent);
- if (targetid && sscanf(targetid, "ata%d", &ata_id) == 1)
+ tgtname = udev_device_get_sysname(parent);
+ if (tgtname && sscanf(tgtname, "ata%d", &tgtid) == 1)
break;
parent = udev_device_get_parent(parent);
- targetid = NULL;
+ tgtname = NULL;
}
- if (targetid) {
+ if (tgtname) {
pp->sg_id.proto_id = SCSI_PROTOCOL_ATA;
- pp->sg_id.transport_id = ata_id;
- snprintf(node, NODE_NAME_SIZE, "ata-%d.00", ata_id);
+ pp->sg_id.transport_id = tgtid;
+ snprintf(node, NODE_NAME_SIZE, "ata-%d.00", tgtid);
return 0;
}
pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
--
1.7.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 06/13] Add Datacore SANSymphony to hwtable
2013-01-16 12:14 ` [PATCH 06/13] Add Datacore SANSymphony to hwtable Hannes Reinecke
@ 2013-01-16 20:53 ` Christophe Varoqui
0 siblings, 0 replies; 16+ messages in thread
From: Christophe Varoqui @ 2013-01-16 20:53 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: dm-devel, Christophe Varoqui
On mer., 2013-01-16 at 13:14 +0100, Hannes Reinecke wrote:
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> libmultipath/hwtable.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
This configlet is for SANmelody, and the commit subject is
about SANsymphony.
I don't mind the subject being eroneous, but i'd like to be sure the
configlet is correct.
> diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
> index 174df7e..9ed3a82 100644
> --- a/libmultipath/hwtable.c
> +++ b/libmultipath/hwtable.c
> @@ -1075,6 +1075,19 @@ static struct hwentry default_hw[] = {
> .prio_name = PRIO_ALUA,
> .prio_args = NULL,
> },
> + {
> + .vendor = "DataCore",
> + .product = "SANmelody",
> + .features = DEFAULT_FEATURES,
> + .hwhandler = DEFAULT_HWHANDLER,
> + .pgpolicy = GROUP_BY_PRIO,
> + .pgfailback = -FAILBACK_IMMEDIATE,
> + .rr_weight = RR_WEIGHT_NONE,
> + .no_path_retry = NO_PATH_RETRY_QUEUE,
> + .checker_name = TUR,
> + .prio_name = PRIO_ALUA,
> + .prio_args = NULL,
> + },
> /*
> * EOL
> */
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/13] More patches from SLES
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
` (12 preceding siblings ...)
2013-01-16 12:14 ` [PATCH 13/13] Rename variables in sysfs_get_tgt_nodename Hannes Reinecke
@ 2013-01-16 21:06 ` Christophe Varoqui
13 siblings, 0 replies; 16+ messages in thread
From: Christophe Varoqui @ 2013-01-16 21:06 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: dm-devel
On mer., 2013-01-16 at 13:14 +0100, Hannes Reinecke wrote:
> Hi Christophe,
>
> here are some more patches from SLES.
> Most are missing patches from the initial resync;
> however, the transport id stuff is a rework from
> the SLES sources and has been enhanced to cover SAS.
>
> Please apply.
>
Nice indeed.
Applied.
Christophe Varoqui
www.opensvc.com
> Hannes Reinecke (13):
> Fixup .gitignore
> Check for !SUSPENDED in kpartx rules
> kpartx.rules: Check for accessible device-mapper device
> Correct persistent symlink for cciss
> Add hardware entry for Intel Multi-Flex
> Add Datacore SANSymphony to hwtable
> Add SUN STK6580 to hardware table
> Remove unused structures
> Use transport identifiers when detecting devices
> Discover target ids for ATA
> Set recovery_tmo for iSCSI devices
> Set I_T_nexus_loss_timeout on SAS devices
> Rename variables in sysfs_get_tgt_nodename
>
> .gitignore | 8 +-
> kpartx/kpartx.rules | 4 +-
> kpartx/kpartx_id | 3 +
> libmultipath/discovery.c | 190 ++++++++++++++++++++++++++++++++++++---------
> libmultipath/hwtable.c | 39 ++++++++++
> libmultipath/structs.h | 26 +++---
> 6 files changed, 215 insertions(+), 55 deletions(-)
>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2013-01-16 21:06 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 12:14 [PATCH 00/13] More patches from SLES Hannes Reinecke
2013-01-16 12:14 ` [PATCH 01/13] Fixup .gitignore Hannes Reinecke
2013-01-16 12:14 ` [PATCH 02/13] Check for !SUSPENDED in kpartx rules Hannes Reinecke
2013-01-16 12:14 ` [PATCH 03/13] kpartx.rules: Check for accessible device-mapper device Hannes Reinecke
2013-01-16 12:14 ` [PATCH 04/13] Correct persistent symlink for cciss Hannes Reinecke
2013-01-16 12:14 ` [PATCH 05/13] Add hardware entry for Intel Multi-Flex Hannes Reinecke
2013-01-16 12:14 ` [PATCH 06/13] Add Datacore SANSymphony to hwtable Hannes Reinecke
2013-01-16 20:53 ` Christophe Varoqui
2013-01-16 12:14 ` [PATCH 07/13] Add SUN STK6580 to hardware table Hannes Reinecke
2013-01-16 12:14 ` [PATCH 08/13] Remove unused structures Hannes Reinecke
2013-01-16 12:14 ` [PATCH 09/13] Use transport identifiers when detecting devices Hannes Reinecke
2013-01-16 12:14 ` [PATCH 10/13] Discover target ids for ATA Hannes Reinecke
2013-01-16 12:14 ` [PATCH 11/13] Set recovery_tmo for iSCSI devices Hannes Reinecke
2013-01-16 12:14 ` [PATCH 12/13] Set I_T_nexus_loss_timeout on SAS devices Hannes Reinecke
2013-01-16 12:14 ` [PATCH 13/13] Rename variables in sysfs_get_tgt_nodename Hannes Reinecke
2013-01-16 21:06 ` [PATCH 00/13] More patches from SLES Christophe Varoqui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox