[dm-devel] In discovery.c, Sysfs attribute is not closed while collecting target node name...

A, Rajashekhar Rajashekhar.A at netapp.com
Sun Aug 5 18:03:01 UTC 2007


Hi,

Here is the code snippet from scsi_sysfs_pathinfo function.
attr is not closed when target node name is collected successfully. The
function just returns 0 at the end. 
Shouldn't it be sysfs_close_attribute(attr); and then return 0; ???

	/*
	 * target node name
	 */
	if(safe_sprintf(attr_path,
	
"%s/class/fc_transport/target%i:%i:%i/node_name",
			sysfs_path,
			pp->sg_id.host_no,
			pp->sg_id.channel,
			pp->sg_id.scsi_id)) {
		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);

	condlog(3, "%s: tgt_node_name = %s",
		pp->dev, pp->tgt_node_name);

	return 0;
err:
	sysfs_close_attribute(attr);
	return 1;

Best Regards,
Rajashekhar M A

-----Original Message-----
From: bmarzins at sourceware.org [mailto:bmarzins at sourceware.org] 
Sent: Friday, June 01, 2007 5:57 AM
To: dm-cvs at sourceware.org; dm-devel at redhat.com
Subject: [dm-devel] multipath-tools libmultipath/discovery.c libmu ...

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins at sourceware.org	2007-06-01 00:26:42

Modified files:
	libmultipath   : discovery.c switchgroup.c 
Added files:
	path_priority/pp_rdac: Makefile pp_rdac.c 

Log message:
	Reverting the earlier RDAC related path priority fixes, and
addning the new
	priority callout.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/di
scovery.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.32.2.3&r2=1.32.2.
4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/sw
itchgroup.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.1&r2=1.5.2.
2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/p
p_rdac/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.1.2
.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/p
p_rdac/pp_rdac.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.1.
2.1

--- multipath-tools/libmultipath/discovery.c	2007/05/02 00:16:36
1.32.2.3
+++ multipath-tools/libmultipath/discovery.c	2007/06/01 00:26:41
1.32.2.4
@@ -763,7 +763,7 @@
 	if (mask & DI_CHECKER && get_state(pp))
 		goto blank;
 	
-	if (mask & DI_PRIO && pp->state == PATH_UP)
+	if (mask & DI_PRIO && pp->state != PATH_DOWN)
 		get_prio(pp);
 
 	if (mask & DI_WWID && !strlen(pp->wwid))
--- multipath-tools/libmultipath/switchgroup.c	2007/04/24 18:49:16
1.5.2.1
+++ multipath-tools/libmultipath/switchgroup.c	2007/06/01 00:26:41
1.5.2.2
@@ -28,7 +28,7 @@
 		priority = 0;
 
 		vector_foreach_slot (pgp->paths, pp, j) {
-			if (pp->state == PATH_UP)
+			if (pp->state != PATH_DOWN)
 				priority += pp->priority;
 		}
 		pgp->priority = priority;

--
dm-devel mailing list
dm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel




More information about the dm-devel mailing list