More patches from SLES
cover More patches from SLES
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(-)
Signature · 1 line
1.7.4.2
PATCH 1/13 Fixup .gitignore
Only exclude the binaries, not the entire directories ... And the nfs link, too.
--- .gitignore | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
.gitignore +5 -3
@@ -5,6 +5,8 @@ *.so.0 *.a *.gz -kpartx -multipath -multipathd +kpartx/kpartx +multipath/multipath +multipathd/multipathd +mpathpersist/mpathpersist +.nfs*
Signature · 1 line
1.7.4.2
PATCH 2/13 Check for !SUSPENDED in kpartx rules
In reply to Hannes ReineckeRead-only devices appear as DM_STATE=READONLY, so we should invert the check in kpartx rules to have kpartx run on readonly devices, too.
--- kpartx/kpartx.rules | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kpartx/kpartx.rules +1 -1
@@ -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"
Signature · 1 line
1.7.4.2
PATCH 3/13 kpartx.rules: Check for accessible device-mapper device
In reply to Hannes ReineckeWe need to check for accessible device-mapper devices right at the start, otherwise kpartx would be run on inactive devices.
--- kpartx/kpartx.rules | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kpartx/kpartx.rules +2 -0
@@ -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}"
Signature · 1 line
1.7.4.2
PATCH 4/13 Correct persistent symlink for cciss
In reply to Hannes Reineckecciss devices have the prefix 'cciss', so we should generate the correct one from kpartx_id, too.
--- kpartx/kpartx_id | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
kpartx/kpartx_id +3 -0
@@ -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" ;;
Signature · 1 line
1.7.4.2
PATCH 5/13 Add hardware entry for Intel Multi-Flex
In reply to Hannes Reinecke--- libmultipath/hwtable.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
libmultipath/hwtable.c +13 -0
@@ -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 */
Signature · 1 line
1.7.4.2
PATCH 6/13 Add Datacore SANSymphony to hwtable
In reply to Hannes Reinecke--- libmultipath/hwtable.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
libmultipath/hwtable.c +13 -0
@@ -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 */
Signature · 1 line
1.7.4.2
Re: [PATCH 06/13] Add Datacore SANSymphony to hwtable
Quoted 5 lines · Hannes Reinecke
Signed-off-by Hannes Reinecke <[email protected]>--- 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.
Quoted 24 lines
libmultipath/hwtable.c +13
-0@@ -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 */
PATCH 7/13 Add SUN STK6580 to hardware table
In reply to Hannes Reinecke--- libmultipath/hwtable.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
libmultipath/hwtable.c +13 -0
@@ -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,
Signature · 1 line
1.7.4.2
PATCH 8/13 Remove unused structures
In reply to Hannes Reineckestructs scsi_dev and scsi_idlun are unused.
--- libmultipath/structs.h | 13 ------------- 1 files changed, 0 insertions(+), 13 deletions(-)
libmultipath/structs.h +0 -13
@@ -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 ];
Signature · 1 line
1.7.4.2
PATCH 9/13 Use transport identifiers when detecting devices
In reply to Hannes ReineckeThis patch stores the transport identifiers, allowing for a simplified dev_loss_tmo setting.
--- libmultipath/discovery.c | 59 ++++++++++++++++++++++++++------------------- libmultipath/structs.h | 17 +++++++++++- 2 files changed, 49 insertions(+), 27 deletions(-)
libmultipath/discovery.c +34 -25
@@ -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 ; }
libmultipath/structs.h +15 -2
@@ -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
Signature · 1 line
1.7.4.2
PATCH 10/13 Discover target ids for ATA
In reply to Hannes Reineckelibata devices now have a separate sysfs entry, so we should be discovering them properly, too.
--- libmultipath/discovery.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-)
libmultipath/discovery.c +18 -1
@@ -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 ; }
Signature · 1 line
1.7.4.2
PATCH 11/13 Set recovery_tmo for iSCSI devices
In reply to Hannes ReineckeiSCSI 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.
--- libmultipath/discovery.c | 59 +++++++++++++++++++++++++++++++++++++++------ 1 files changed, 51 insertions(+), 8 deletions(-)
libmultipath/discovery.c +51 -8
@@ -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 ; }
Signature · 1 line
1.7.4.2
PATCH 12/13 Set I_T_nexus_loss_timeout on SAS devices
In reply to Hannes ReineckeSome 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.
--- libmultipath/discovery.c | 51 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 48 insertions(+), 3 deletions(-)
libmultipath/discovery.c +48 -3
@@ -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 ; }
Signature · 1 line
1.7.4.2
PATCH 13/13 Rename variables in sysfs_get_tgt_nodename
In reply to Hannes ReineckeFor consistency.
--- libmultipath/discovery.c | 54 +++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 27 deletions(-)
libmultipath/discovery.c +27 -27
@@ -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 ;
Signature · 1 line
1.7.4.2
Quoted 9 lines · Hannes Reinecke
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
Quoted 23 lines
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
Setrecovery_tmofor iSCSI devices
SetI_T_nexus_loss_timeouton SAS devices Rename variables insysfs_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(-)