Skip to contentSkip to conversation

dm-multipath [PATCH] "better" return codes.

PATCH Benjamin Marzinski 2 participants 2 messages Feb 27, 2006 – Mar 2, 2006 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

I think that these multipathd return codes make more sense (failing if the map is not a multipath map, and not failing if it has already been added).

-Ben

multipathd/main.c +2 -2
diff -urpN mp-devel-clean/multipathd/main.c mp-devel-patched/multipathd/main.c
@@ -569,7 +569,7 @@ ev_add_map (char * devname, struct vecto
 	if (map_present && dm_type(alias, DEFAULT_TARGET) <= 0) {
 		condlog(4, "%s: not a multipath map", alias);
 		FREE(alias);
-		return 0;
+		return 1;
 	}
 
 	mpp = find_mp_by_alias(vecs->mpvec, alias);
@@ -709,7 +709,7 @@ ev_add_path (char * devname, struct vect
 		/*
 		 * allow reconfig of orphaned path here
 		 */
-		if (pp->mpp) return 1;
+		if (pp->mpp) return 0;
 	}
 	else {
 		/*
#1 lore raw
Quoted 9 lines · Benjamin Marzinski

I think that these multipathd return codes make more sense (failing if the map is not a multipath map, and not failing if it has already been added).

-Ben

diff -urpN mp-devel-clean/multipathd/main.c mp-devel-patched/multipathd/main.c

multipathd/main.c ev_add_map (char * devname, struct vecto · line 574

Quoted 7 lines
multipathd/main.c +1 -1
@@ -569,7 +569,7 @@ ev_add_map (char * devname, struct vecto
 	if (map_present && dm_type(alias, DEFAULT_TARGET) <= 0) {
 		condlog(4, "%s: not a multipath map", alias);
 		FREE(alias);
-		return 0;
+		return 1;
 	}
 

Returning ok here means the event needs no treatment and it's ok. Seems right to me.

multipathd/main.c ev_add_path (char * devname, struct vect · line 715

Quoted 10 lines
multipathd/main.c +1 -1
 	mpp = find_mp_by_alias(vecs->mpvec, alias);
@@ -709,7 +709,7 @@ ev_add_path (char * devname, struct vect
 		/*
 		 * allow reconfig of orphaned path here
 		 */
-		if (pp->mpp) return 1;
+		if (pp->mpp) return 0;
 	}
 	else {
 		/*

Indeed, the comment looks wrong wrt actual code.

Regards,
cvaroqui