All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools libmultipath/devmapper.c libmu ...
@ 2009-04-03 15:09 bmarzins
  0 siblings, 0 replies; 4+ messages in thread
From: bmarzins @ 2009-04-03 15:09 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2009-04-03 15:09:03

Modified files:
	libmultipath   : devmapper.c dmparser.c hwtable.c pgpolicies.c 
	                 waiter.c waiter.h 
	multipathd     : main.c 

Log message:
	Fix for bz #459629.  Multipathd needs to wait for the waiter threads to finish
	before freeing the vecs locks.  This bug has already been fixed upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.6&r2=1.22.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dmparser.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.13&r2=1.13.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.20.2.16&r2=1.20.2.17
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/pgpolicies.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.7&r2=1.7.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/waiter.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/waiter.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.16&r2=1.69.2.17

--- multipath-tools/libmultipath/devmapper.c	2008/09/19 03:27:08	1.22.2.6
+++ multipath-tools/libmultipath/devmapper.c	2009/04/03 15:09:02	1.22.2.7
@@ -716,6 +716,7 @@
 	vector vec;
 	struct multipath *mpp;
 	int i;
+	int ret = 0;
 
 	vec = vector_alloc();
 
@@ -723,20 +724,20 @@
 		return 0;
 
 	if (dm_get_maps(vec, type)) {
-		vector_free(vec);
+		free_multipathvec(vec, FREE_PATHS);
 		return 0;
 	}
 
 	vector_foreach_slot(vec, mpp, i) {
 		if (!strcmp(uuid, mpp->wwid)) {
-			vector_free(vec);
 			strcpy(name, mpp->alias);
-			return 1;
+			ret = 1;
+			break;
 		}
 	}
 
-	vector_free(vec);
-	return 0;
+	free_multipathvec(vec, FREE_PATHS);
+	return ret;
 }
 
 int
--- multipath-tools/libmultipath/dmparser.c	2006/11/30 23:25:13	1.13
+++ multipath-tools/libmultipath/dmparser.c	2009/04/03 15:09:02	1.13.2.1
@@ -329,6 +329,7 @@
 	FREE(word);
 out:
 	free_pgvec(mpp->pg, KEEP_PATHS);
+	mpp->pg=NULL;
 	return 1;
 }
 
--- multipath-tools/libmultipath/hwtable.c	2008/12/02 20:24:24	1.20.2.16
+++ multipath-tools/libmultipath/hwtable.c	2009/04/03 15:09:02	1.20.2.17
@@ -169,7 +169,7 @@
                 .no_path_retry = 12,
                 .minio         = 100,
                 .checker_name  = TUR,
-	}
+	},
 	{
 		.vendor        = "HP",
 		.product       = "A6189A",
--- multipath-tools/libmultipath/pgpolicies.c	2006/06/06 18:32:43	1.7
+++ multipath-tools/libmultipath/pgpolicies.c	2009/04/03 15:09:02	1.7.2.1
@@ -127,6 +127,7 @@
 	FREE(bitmap);
 out:
 	free_pgvec(mp->pg, KEEP_PATHS);
+	mp->pg = NULL;
 	return 1;
 }
 
@@ -198,6 +199,7 @@
 	FREE(bitmap);
 out:
 	free_pgvec(mp->pg, KEEP_PATHS);
+	mp->pg = NULL;
 	return 1;
 }
 
@@ -232,6 +234,7 @@
 	return 0;
 out:
 	free_pgvec(mp->pg, KEEP_PATHS);
+	mp->pg = NULL;
 	return 1;
 }
 
@@ -264,6 +267,7 @@
 	return 0;
 out:
 	free_pgvec(mp->pg, KEEP_PATHS);
+	mp->pg = NULL;
 	return 1;
 }
 
@@ -338,6 +342,7 @@
 	return 0;
 out:
 	free_pgvec(mp->pg, KEEP_PATHS);
+	mp->pg = NULL;
 	return 1;
 
 }
--- multipath-tools/libmultipath/waiter.c	2009/03/30 19:58:39	1.1.2.4
+++ multipath-tools/libmultipath/waiter.c	2009/04/03 15:09:02	1.1.2.5
@@ -20,6 +20,9 @@
 #include "lock.h"
 #include "waiter.h"
 
+pthread_cond_t waiter_cond = PTHREAD_COND_INITIALIZER;
+int num_waiters = 0; /* protected by the vecs lock */
+
 struct event_thread *alloc_waiter (void)
 {
 
@@ -49,6 +52,8 @@
 	else
 		condlog(3, "free_waiter, mpp freed before wp=%p,", wp);
 
+	num_waiters--;
+	pthread_cond_signal(&waiter_cond);
 	unlock(wp->vecs->lock);
 	pthread_sigmask(SIG_SETMASK, &old, NULL);
 
@@ -223,6 +228,7 @@
 	strncpy(wp->mapname, mpp->alias, WWID_SIZE);
 	wp->vecs = vecs;
 	wp->mpp = mpp;
+	num_waiters++;
 
 	if (pthread_create(&wp->thread, &attr, waitevent, wp)) {
 		condlog(0, "%s: cannot create event checker", wp->mapname);
@@ -232,7 +238,8 @@
 
 	return 0;
 out1:
-	free_waiter(wp);
+	num_waiters--;
+	FREE(wp);
 	mpp->waiter = NULL;
 out:
 	condlog(0, "failed to start waiter thread");
--- multipath-tools/libmultipath/waiter.h	2006/06/06 18:46:38	1.1
+++ multipath-tools/libmultipath/waiter.h	2009/04/03 15:09:02	1.1.2.1
@@ -3,6 +3,9 @@
 
 #if DAEMON
 
+extern pthread_cond_t waiter_cond;
+extern int num_waiters;
+
 struct event_thread {
 	struct dm_task *dmt;
 	pthread_t thread;
--- multipath-tools/multipathd/main.c	2009/03/30 19:58:40	1.69.2.16
+++ multipath-tools/multipathd/main.c	2009/04/03 15:09:03	1.69.2.17
@@ -440,7 +440,7 @@
 		/*
  		 * deal with asynchronous uevents :((
  		 */
-		if (mpp->action == ACT_RELOAD & retrys > 0) {
+		if (mpp->action == ACT_RELOAD && retrys > 0) {
 			condlog(0, "%s: uev_add_path sleep", mpp->alias);
 			sleep(1);
 			retrys--;
@@ -1524,7 +1524,7 @@
 	unsigned int new_ns = (unsigned long)param & NEW_NS;
 #endif
 	struct multipath * mpp;
-	int i;
+	int i, ret;
 
 	if (daemon)
 		setup_daemon();
@@ -1617,6 +1617,7 @@
 			dm_queue_if_no_path(mpp->alias, 0);
 	remove_maps(vecs, stop_waiter_thread);
 	free_pathvec(vecs->pathvec, FREE_PATHS);
+	vecs->pathvec=NULL;
 
 	pthread_cancel(check_thr);
 	pthread_cancel(uevent_thr);
@@ -1628,6 +1629,14 @@
 	handlers = NULL;
 	free_polls();
 
+	ret = 0;
+	while (num_waiters > 0 && ret == 0)
+		ret = pthread_cond_wait(&waiter_cond, vecs->lock);
+	if (ret) {
+		condlog(0, "error while waiting for event threads: %s",
+			strerror(errno));
+		exit(1);
+	}
 	unlock(vecs->lock);
 	pthread_mutex_destroy(vecs->lock);
 	FREE(vecs->lock);

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

* multipath-tools libmultipath/devmapper.c libmu ...
@ 2010-04-16 22:08 bmarzins
  2010-04-17 11:16 ` Christophe Varoqui
  0 siblings, 1 reply; 4+ messages in thread
From: bmarzins @ 2010-04-16 22:08 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2010-04-16 22:08:03

Modified files:
	libmultipath   : devmapper.c devmapper.h 
	multipath      : main.c 

Log message:
	Fix for bz #517951. Updated prereq testing code.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.8&r2=1.22.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.5&r2=1.11.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.8&r2=1.44.2.9

--- multipath-tools/libmultipath/devmapper.c	2009/05/04 18:12:06	1.22.2.8
+++ multipath-tools/libmultipath/devmapper.c	2010/04/16 22:08:02	1.22.2.9
@@ -82,13 +82,35 @@
 	dm_log_init_verbose(conf ? conf->verbosity + 3 : 0);
 }
 
-extern int
-dm_prereq (char * str, int x, int y, int z)
+static int
+dm_libprereq (void)
+{
+	char version[64];
+	int v[3];
+	int minv[3] = {1, 2, 11};
+
+	dm_get_library_version(version, sizeof(version));
+	condlog(3, "libdevmapper version %s", version);
+	sscanf(version, "%d.%d.%d ", &v[0], &v[1], &v[2]);
+
+	if ((v[0] > minv[0]) ||
+	    ((v[0] ==  minv[0]) && (v[1] > minv[1])) ||
+	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])))
+		return 0;
+	condlog(0, "libdevmapper version must be >= %d.%.2d.%.2d",
+		minv[0], minv[1], minv[2]);
+	return 1;
+}
+
+static int
+dm_drvprereq (char * str)
 {
 	int r = 2;
 	struct dm_task *dmt;
 	struct dm_versions *target;
 	struct dm_versions *last_target;
+	int minv[3] = {1, 0, 3};
+	unsigned int *v;
 
 	if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
 		return 3;
@@ -104,25 +126,26 @@
 
 	do {
 		last_target = target;
-
 		if (!strncmp(str, target->name, strlen(str))) {
-			r--;
-			
-			if (target->version[0] >= x &&
-			    target->version[1] >= y &&
-			    target->version[2] >= z)
-				r--;
-
+			r = 1;
 			break;
 		}
-
 		target = (void *) target + target->next;
 	} while (last_target != target);
 
-	if (r == 2)
+	if (r == 2) {
 		condlog(0, "DM multipath kernel driver not loaded");
-	else if (r == 1)
-		condlog(0, "DM multipath kernel driver version too old");
+		goto out;
+	}
+	v = target->version;
+	if ((v[0] > minv[0]) ||
+	    ((v[0] == minv[0]) && (v[1] > minv[1])) ||
+	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2]))) {
+		r = 0;
+		goto out;
+	}
+	condlog(0, "DM multipath kernel driver must be >= %u.%.2u.%.2u",
+		minv[0], minv[1], minv[2]);
 
 out:
 	dm_task_destroy(dmt);
@@ -130,6 +153,14 @@
 }
 
 extern int
+dm_prereq (char * str)
+{
+	if (dm_libprereq())
+		return 1;
+	return dm_drvprereq(str);
+}
+
+extern int
 dm_simplecmd (int task, const char *name, int no_flush) {
 	int r = 0;
 	struct dm_task *dmt;
--- multipath-tools/libmultipath/devmapper.h	2008/09/19 03:27:08	1.11.2.5
+++ multipath-tools/libmultipath/devmapper.h	2010/04/16 22:08:03	1.11.2.6
@@ -3,7 +3,7 @@
 #include "structs.h"
 
 void dm_init(void);
-int dm_prereq (char *, int, int, int);
+int dm_prereq (char *);
 int dm_simplecmd (int, const char *, int);
 int dm_addmap (int, const char *, struct multipath *, int, int); 
 int dm_map_present (char *);
--- multipath-tools/multipath/main.c	2010/04/08 19:31:49	1.44.2.8
+++ multipath-tools/multipath/main.c	2010/04/16 22:08:03	1.44.2.9
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.8 2010/04/08 19:31:49 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -315,7 +315,7 @@
 		exit(1);
 	}
 
-	if (dm_prereq(DEFAULT_TARGET, 1, 0, 3))
+	if (dm_prereq(DEFAULT_TARGET))
 		exit(1);
 
 	if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) {

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

* Re: multipath-tools libmultipath/devmapper.c libmu ...
  2010-04-16 22:08 bmarzins
@ 2010-04-17 11:16 ` Christophe Varoqui
  2010-04-26 16:50   ` Benjamin Marzinski
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Varoqui @ 2010-04-17 11:16 UTC (permalink / raw)
  To: device-mapper development

Ben,

upstream has 1.2.8 as a minimum lib version.
I see in this patch you chose 1.2.11 instead.

Should upstream also bump the min lib version ? If so, what's the
feature introduced between .8 and .11 that justifies the bump ?

Thanks,
cvaroqui

On ven., 2010-04-16 at 22:08 +0000, bmarzins@sourceware.org wrote:
> CVSROOT:	/cvs/dm
> Module name:	multipath-tools
> Branch: 	RHEL5_FC6
> Changes by:	bmarzins@sourceware.org	2010-04-16 22:08:03
> 
> Modified files:
> 	libmultipath   : devmapper.c devmapper.h 
> 	multipath      : main.c 
> 
> Log message:
> 	Fix for bz #517951. Updated prereq testing code.
> 
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.8&r2=1.22.2.9
> http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.5&r2=1.11.2.6
> http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.8&r2=1.44.2.9
> 
> --- multipath-tools/libmultipath/devmapper.c	2009/05/04 18:12:06	1.22.2.8
> +++ multipath-tools/libmultipath/devmapper.c	2010/04/16 22:08:02	1.22.2.9
> @@ -82,13 +82,35 @@
>  	dm_log_init_verbose(conf ? conf->verbosity + 3 : 0);
>  }
>  
> -extern int
> -dm_prereq (char * str, int x, int y, int z)
> +static int
> +dm_libprereq (void)
> +{
> +	char version[64];
> +	int v[3];
> +	int minv[3] = {1, 2, 11};
> +
> +	dm_get_library_version(version, sizeof(version));
> +	condlog(3, "libdevmapper version %s", version);
> +	sscanf(version, "%d.%d.%d ", &v[0], &v[1], &v[2]);
> +
> +	if ((v[0] > minv[0]) ||
> +	    ((v[0] ==  minv[0]) && (v[1] > minv[1])) ||
> +	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])))
> +		return 0;
> +	condlog(0, "libdevmapper version must be >= %d.%.2d.%.2d",
> +		minv[0], minv[1], minv[2]);
> +	return 1;
> +}
> +
> +static int
> +dm_drvprereq (char * str)
>  {
>  	int r = 2;
>  	struct dm_task *dmt;
>  	struct dm_versions *target;
>  	struct dm_versions *last_target;
> +	int minv[3] = {1, 0, 3};
> +	unsigned int *v;
>  
>  	if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
>  		return 3;
> @@ -104,25 +126,26 @@
>  
>  	do {
>  		last_target = target;
> -
>  		if (!strncmp(str, target->name, strlen(str))) {
> -			r--;
> -			
> -			if (target->version[0] >= x &&
> -			    target->version[1] >= y &&
> -			    target->version[2] >= z)
> -				r--;
> -
> +			r = 1;
>  			break;
>  		}
> -
>  		target = (void *) target + target->next;
>  	} while (last_target != target);
>  
> -	if (r == 2)
> +	if (r == 2) {
>  		condlog(0, "DM multipath kernel driver not loaded");
> -	else if (r == 1)
> -		condlog(0, "DM multipath kernel driver version too old");
> +		goto out;
> +	}
> +	v = target->version;
> +	if ((v[0] > minv[0]) ||
> +	    ((v[0] == minv[0]) && (v[1] > minv[1])) ||
> +	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2]))) {
> +		r = 0;
> +		goto out;
> +	}
> +	condlog(0, "DM multipath kernel driver must be >= %u.%.2u.%.2u",
> +		minv[0], minv[1], minv[2]);
>  
>  out:
>  	dm_task_destroy(dmt);
> @@ -130,6 +153,14 @@
>  }
>  
>  extern int
> +dm_prereq (char * str)
> +{
> +	if (dm_libprereq())
> +		return 1;
> +	return dm_drvprereq(str);
> +}
> +
> +extern int
>  dm_simplecmd (int task, const char *name, int no_flush) {
>  	int r = 0;
>  	struct dm_task *dmt;
> --- multipath-tools/libmultipath/devmapper.h	2008/09/19 03:27:08	1.11.2.5
> +++ multipath-tools/libmultipath/devmapper.h	2010/04/16 22:08:03	1.11.2.6
> @@ -3,7 +3,7 @@
>  #include "structs.h"
>  
>  void dm_init(void);
> -int dm_prereq (char *, int, int, int);
> +int dm_prereq (char *);
>  int dm_simplecmd (int, const char *, int);
>  int dm_addmap (int, const char *, struct multipath *, int, int); 
>  int dm_map_present (char *);
> --- multipath-tools/multipath/main.c	2010/04/08 19:31:49	1.44.2.8
> +++ multipath-tools/multipath/main.c	2010/04/16 22:08:03	1.44.2.9
> @@ -1,7 +1,7 @@
>  /*
>   * Soft:        multipath device mapper target autoconfig
>   *
> - * Version:     $Id: main.c,v 1.44.2.8 2010/04/08 19:31:49 bmarzins Exp $
> + * Version:     $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $
>   *
>   * Author:      Christophe Varoqui
>   *
> @@ -315,7 +315,7 @@
>  		exit(1);
>  	}
>  
> -	if (dm_prereq(DEFAULT_TARGET, 1, 0, 3))
> +	if (dm_prereq(DEFAULT_TARGET))
>  		exit(1);
>  
>  	if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) {
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

* Re: multipath-tools libmultipath/devmapper.c libmu ...
  2010-04-17 11:16 ` Christophe Varoqui
@ 2010-04-26 16:50   ` Benjamin Marzinski
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Marzinski @ 2010-04-26 16:50 UTC (permalink / raw)
  To: christophe.varoqui, device-mapper development

On Sat, Apr 17, 2010 at 01:16:31PM +0200, Christophe Varoqui wrote:
> Ben,
> 
> upstream has 1.2.8 as a minimum lib version.
> I see in this patch you chose 1.2.11 instead.
> 
> Should upstream also bump the min lib version ? If so, what's the
> feature introduced between .8 and .11 that justifies the bump ?

No, it's not necessary to bump it.

-Ben

> 
> Thanks,
> cvaroqui
> 
> On ven., 2010-04-16 at 22:08 +0000, bmarzins@sourceware.org wrote:
> > CVSROOT:	/cvs/dm
> > Module name:	multipath-tools
> > Branch: 	RHEL5_FC6
> > Changes by:	bmarzins@sourceware.org	2010-04-16 22:08:03
> > 
> > Modified files:
> > 	libmultipath   : devmapper.c devmapper.h 
> > 	multipath      : main.c 
> > 
> > Log message:
> > 	Fix for bz #517951. Updated prereq testing code.
> > 
> > Patches:
> > http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.8&r2=1.22.2.9
> > http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.5&r2=1.11.2.6
> > http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.8&r2=1.44.2.9
> > 
> > --- multipath-tools/libmultipath/devmapper.c	2009/05/04 18:12:06	1.22.2.8
> > +++ multipath-tools/libmultipath/devmapper.c	2010/04/16 22:08:02	1.22.2.9
> > @@ -82,13 +82,35 @@
> >  	dm_log_init_verbose(conf ? conf->verbosity + 3 : 0);
> >  }
> >  
> > -extern int
> > -dm_prereq (char * str, int x, int y, int z)
> > +static int
> > +dm_libprereq (void)
> > +{
> > +	char version[64];
> > +	int v[3];
> > +	int minv[3] = {1, 2, 11};
> > +
> > +	dm_get_library_version(version, sizeof(version));
> > +	condlog(3, "libdevmapper version %s", version);
> > +	sscanf(version, "%d.%d.%d ", &v[0], &v[1], &v[2]);
> > +
> > +	if ((v[0] > minv[0]) ||
> > +	    ((v[0] ==  minv[0]) && (v[1] > minv[1])) ||
> > +	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])))
> > +		return 0;
> > +	condlog(0, "libdevmapper version must be >= %d.%.2d.%.2d",
> > +		minv[0], minv[1], minv[2]);
> > +	return 1;
> > +}
> > +
> > +static int
> > +dm_drvprereq (char * str)
> >  {
> >  	int r = 2;
> >  	struct dm_task *dmt;
> >  	struct dm_versions *target;
> >  	struct dm_versions *last_target;
> > +	int minv[3] = {1, 0, 3};
> > +	unsigned int *v;
> >  
> >  	if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
> >  		return 3;
> > @@ -104,25 +126,26 @@
> >  
> >  	do {
> >  		last_target = target;
> > -
> >  		if (!strncmp(str, target->name, strlen(str))) {
> > -			r--;
> > -			
> > -			if (target->version[0] >= x &&
> > -			    target->version[1] >= y &&
> > -			    target->version[2] >= z)
> > -				r--;
> > -
> > +			r = 1;
> >  			break;
> >  		}
> > -
> >  		target = (void *) target + target->next;
> >  	} while (last_target != target);
> >  
> > -	if (r == 2)
> > +	if (r == 2) {
> >  		condlog(0, "DM multipath kernel driver not loaded");
> > -	else if (r == 1)
> > -		condlog(0, "DM multipath kernel driver version too old");
> > +		goto out;
> > +	}
> > +	v = target->version;
> > +	if ((v[0] > minv[0]) ||
> > +	    ((v[0] == minv[0]) && (v[1] > minv[1])) ||
> > +	    ((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2]))) {
> > +		r = 0;
> > +		goto out;
> > +	}
> > +	condlog(0, "DM multipath kernel driver must be >= %u.%.2u.%.2u",
> > +		minv[0], minv[1], minv[2]);
> >  
> >  out:
> >  	dm_task_destroy(dmt);
> > @@ -130,6 +153,14 @@
> >  }
> >  
> >  extern int
> > +dm_prereq (char * str)
> > +{
> > +	if (dm_libprereq())
> > +		return 1;
> > +	return dm_drvprereq(str);
> > +}
> > +
> > +extern int
> >  dm_simplecmd (int task, const char *name, int no_flush) {
> >  	int r = 0;
> >  	struct dm_task *dmt;
> > --- multipath-tools/libmultipath/devmapper.h	2008/09/19 03:27:08	1.11.2.5
> > +++ multipath-tools/libmultipath/devmapper.h	2010/04/16 22:08:03	1.11.2.6
> > @@ -3,7 +3,7 @@
> >  #include "structs.h"
> >  
> >  void dm_init(void);
> > -int dm_prereq (char *, int, int, int);
> > +int dm_prereq (char *);
> >  int dm_simplecmd (int, const char *, int);
> >  int dm_addmap (int, const char *, struct multipath *, int, int); 
> >  int dm_map_present (char *);
> > --- multipath-tools/multipath/main.c	2010/04/08 19:31:49	1.44.2.8
> > +++ multipath-tools/multipath/main.c	2010/04/16 22:08:03	1.44.2.9
> > @@ -1,7 +1,7 @@
> >  /*
> >   * Soft:        multipath device mapper target autoconfig
> >   *
> > - * Version:     $Id: main.c,v 1.44.2.8 2010/04/08 19:31:49 bmarzins Exp $
> > + * Version:     $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $
> >   *
> >   * Author:      Christophe Varoqui
> >   *
> > @@ -315,7 +315,7 @@
> >  		exit(1);
> >  	}
> >  
> > -	if (dm_prereq(DEFAULT_TARGET, 1, 0, 3))
> > +	if (dm_prereq(DEFAULT_TARGET))
> >  		exit(1);
> >  
> >  	if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) {
> > 
> > --
> > dm-devel mailing list
> > dm-devel@redhat.com
> > https://www.redhat.com/mailman/listinfo/dm-devel
> 
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

end of thread, other threads:[~2010-04-26 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-03 15:09 multipath-tools libmultipath/devmapper.c libmu bmarzins
  -- strict thread matches above, loose matches on Subject: below --
2010-04-16 22:08 bmarzins
2010-04-17 11:16 ` Christophe Varoqui
2010-04-26 16:50   ` Benjamin Marzinski

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.