All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools/multipath main.c
@ 2008-05-12 17:46 bmarzins
  0 siblings, 0 replies; 3+ messages in thread
From: bmarzins @ 2008-05-12 17:46 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2008-05-12 17:46:41

Modified files:
	multipath      : main.c 

Log message:
	fix config freeing.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.4&r2=1.44.2.5

--- multipath-tools/multipath/main.c	2007/11/10 00:01:59	1.44.2.4
+++ multipath-tools/multipath/main.c	2008/05/12 17:46:41	1.44.2.5
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.4 2007/11/10 00:01:59 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.5 2008/05/12 17:46:41 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -414,9 +414,17 @@
 		condlog(3, "restart multipath configuration process");
 	
 out:
-	free_config(conf);
 	dm_lib_release();
 	dm_lib_exit();
+
+	/*
+	 * Freeing config must be done after dm_lib_exit(), because
+	 * the logging function (dm_write_log()), which is called there,
+	 * references the config.
+	 */
+	free_config(conf);
+	conf = NULL;
+
 #ifdef _DEBUG_
 	dbg_free_final(NULL);
 #endif

^ permalink raw reply	[flat|nested] 3+ messages in thread
* multipath-tools/multipath main.c
@ 2011-10-24 13:44 bmarzins
  0 siblings, 0 replies; 3+ messages in thread
From: bmarzins @ 2011-10-24 13:44 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-24 13:44:25

Modified files:
	multipath      : main.c 

Log message:
	Fix for bz #740022. Do better type checking on the argument passed to multipath,
	to determine whether it's a path device name, dev_t, or a multipath device.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.10&r2=1.44.2.11

--- multipath-tools/multipath/main.c	2010/04/24 05:28:06	1.44.2.10
+++ multipath-tools/multipath/main.c	2011/10/24 13:44:25	1.44.2.11
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.10 2010/04/24 05:28:06 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.11 2011/10/24 13:44:25 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -21,7 +21,8 @@
  * Copyright (c) 2005 Patrick Caulfield, Redhat
  * Copyright (c) 2005 Edward Goggin, EMC
  */
-
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <ctype.h>
@@ -47,6 +48,7 @@
 #include <configure.h>
 #include <pgpolicies.h>
 #include <version.h>
+#include "dev_t.h"
 
 static int
 filter_pathvec (vector pathvec, char * refwwid)
@@ -302,13 +304,29 @@
 	return r;
 }
 
+static int
+get_dev_type(char *dev) {
+	struct stat buf;
+	int i;
+
+	if (stat(dev, &buf) == 0 && S_ISBLK(buf.st_mode)) {
+		if (dm_is_dm_major(MAJOR(buf.st_rdev)))
+			return DEV_DEVMAP;
+		return DEV_DEVNODE;
+	}
+	else if (sscanf(dev, "%d:%d", &i, &i) == 2)
+		return DEV_DEVT;
+	else
+		return DEV_DEVMAP;
+}
+
 int
 main (int argc, char *argv[])
 {
 	int arg;
 	extern char *optarg;
 	extern int optind;
-	int i, r = 1;
+	int r = 1;
 
 	if (getuid() != 0) {
 		fprintf(stderr, "need to be root\n");
@@ -396,13 +414,7 @@
 
 		strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
 
-		if (filepresent(conf->dev))
-			conf->dev_type = DEV_DEVNODE;
-		else if (sscanf(conf->dev, "%d:%d", &i, &i) == 2)
-			conf->dev_type = DEV_DEVT;
-		else
-			conf->dev_type = DEV_DEVMAP;
-
+		conf->dev_type = get_dev_type(conf->dev);
 	}
 	dm_init();
 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* multipath-tools/multipath main.c
@ 2007-12-17 23:15 bmarzins
  0 siblings, 0 replies; 3+ messages in thread
From: bmarzins @ 2007-12-17 23:15 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2007-12-17 23:15:24

Modified files:
	multipath      : main.c 

Log message:
	Applied patch from bz #425995.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.41.2.5&r2=1.41.2.6

--- multipath-tools/multipath/main.c	2007/07/24 20:35:24	1.41.2.5
+++ multipath-tools/multipath/main.c	2007/12/17 23:15:22	1.41.2.6
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.41.2.5 2007/07/24 20:35:24 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.41.2.6 2007/12/17 23:15:22 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -496,7 +496,7 @@
 
 	if (!find_mp_by_wwid(curmp, mpp->wwid)) {
 		condlog(2, "remove: %s (wwid changed)", cmpp->alias);
-		dm_flush_map(mpp->alias, NULL);
+		dm_flush_map(mpp->alias, DEFAULT_TARGET);
 		strncat(cmpp->wwid, mpp->wwid, WWID_SIZE);
 		drop_multipath(curmp, cmpp->wwid, KEEP_PATHS);
 		mpp->action = ACT_CREATE;
@@ -681,7 +681,7 @@
 			condlog(3, "%s: failed to load map "
 				   "(a path might be in use)",
 				   mpp->alias);
-			dm_flush_map(mpp->alias, NULL);
+			dm_flush_map(mpp->alias, DEFAULT_TARGET);
 		}
 
 		lock_multipath(mpp, 0);

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

end of thread, other threads:[~2011-10-24 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-12 17:46 multipath-tools/multipath main.c bmarzins
  -- strict thread matches above, loose matches on Subject: below --
2011-10-24 13:44 bmarzins
2007-12-17 23:15 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.