All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools/libmultipath discovery.c structs.h
@ 2010-05-28  4:53 bmarzins
  0 siblings, 0 replies; 2+ messages in thread
From: bmarzins @ 2010-05-28  4:53 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2010-05-28 04:53:26

Modified files:
	libmultipath   : discovery.c structs.h 

Log message:
	Fix for 512065. Increase the tgt_node_name size to be able to handle IQNs,
	which can be up to 223 bytes long.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.28.2.8&r2=1.28.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.9&r2=1.17.2.10

--- multipath-tools/libmultipath/discovery.c	2010/05/25 23:23:07	1.28.2.8
+++ multipath-tools/libmultipath/discovery.c	2010/05/28 04:53:25	1.28.2.9
@@ -552,7 +552,7 @@
 	}
 	if (0 <= readattr(attr_path, attr_buff) && strlen(attr_buff) > 0)
 		strncpy(curpath->tgt_node_name, attr_buff,
-			strlen(attr_buff) - 1);
+			NODE_NAME_SIZE - 1);
 	else {
 		if(safe_sprintf(attr_path,
 			"%s/class/iscsi_transport/target%i:%i:%i/target_name",
@@ -566,8 +566,9 @@
 		if (0 <= readattr(attr_path, attr_buff) &&
 		    strlen(attr_buff) > 0)
 			strncpy(curpath->tgt_node_name, attr_buff,
-				strlen(attr_buff) - 1);
+				NODE_NAME_SIZE - 1);
 	}
+	curpath->tgt_node_name[NODE_NAME_SIZE - 1] = '\0';
 	condlog(3, "tgt_node_name = %s", curpath->tgt_node_name);
 
 	return 0;
--- multipath-tools/libmultipath/structs.h	2009/01/17 00:46:51	1.17.2.9
+++ multipath-tools/libmultipath/structs.h	2010/05/28 04:53:25	1.17.2.10
@@ -5,7 +5,7 @@
 
 #define WWID_SIZE		128
 #define SERIAL_SIZE		64
-#define NODE_NAME_SIZE		19
+#define NODE_NAME_SIZE		224
 #define PATH_STR_SIZE  		16
 #define PARAMS_SIZE		1024
 #define FILE_NAME_SIZE		256

^ permalink raw reply	[flat|nested] 2+ messages in thread

* multipath-tools/libmultipath discovery.c structs.h
@ 2011-10-10  3:03 bmarzins
  0 siblings, 0 replies; 2+ messages in thread
From: bmarzins @ 2011-10-10  3:03 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2011-10-10 03:03:18

Modified files:
	libmultipath   : discovery.c structs.h 

Log message:
	Fix for bz #650759. tgt_node_name wasn't working for iscsi devices.  multipath
	now tries
	devices/platform/host<x>/session<y>/iscsi_session:session<y>/targetname
	
	if
	
	class/fc_transport/target<x>:<y>:<z>/node_name
	
	fails.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.32.2.21&r2=1.32.2.22
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.9&r2=1.18.2.10

--- multipath-tools/libmultipath/discovery.c	2011/07/20 21:24:52	1.32.2.21
+++ multipath-tools/libmultipath/discovery.c	2011/10/10 03:03:17	1.32.2.22
@@ -733,15 +733,35 @@
 		condlog(0, "attr_path too small");
 		return 1;
 	}
-	if (!(attr = sysfs_open_attribute(attr_path)))
-		return 0;
-
-	if (sysfs_read_attribute(attr))
-		goto err;
-
+	if (!(attr = sysfs_open_attribute(attr_path)) ||
+	    sysfs_read_attribute(attr)) {
+		unsigned int checkhost, session;
+		if (attr)
+			goto err;
+		if (safe_sprintf(attr_path,
+				 "%s/devices/platform/host%%u/session%%u/",
+				 sysfs_path)) {
+			condlog(0, "attr_path too small");
+			return 1;
+		}
+		if (sscanf(attr_buff, attr_path, &checkhost, &session) != 2)
+			return 0;
+		if (checkhost != pp->sg_id.host_no)
+			return 0;
+		if (safe_sprintf(attr_path, "%s/devices/platform/host%u/session%u/iscsi_session:session%u/targetname", sysfs_path, checkhost, session, session)) {
+			condlog(0, "attr_path too small");
+			return 1;
+		}
+		if (!(attr = sysfs_open_attribute(attr_path)))
+			return 0;
+		if (sysfs_read_attribute(attr))
+			goto err;
+	}
 	if (attr->len > 0)
 		strncpy(pp->tgt_node_name, attr->value, attr->len - 1);
 
+	sysfs_close_attribute(attr);
+
 	condlog(3, "%s: tgt_node_name = %s",
 		pp->dev, pp->tgt_node_name);
 
--- multipath-tools/libmultipath/structs.h	2011/02/18 18:27:00	1.18.2.9
+++ multipath-tools/libmultipath/structs.h	2011/10/10 03:03:17	1.18.2.10
@@ -5,7 +5,7 @@
 
 #define WWID_SIZE		128
 #define SERIAL_SIZE		64
-#define NODE_NAME_SIZE		19
+#define NODE_NAME_SIZE		224
 #define PATH_STR_SIZE  		16
 #define PARAMS_SIZE		1024
 #define FILE_NAME_SIZE		256

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-10  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10  3:03 multipath-tools/libmultipath discovery.c structs.h bmarzins
  -- strict thread matches above, loose matches on Subject: below --
2010-05-28  4:53 bmarzins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.