All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-09-04 20:09 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-09-04 20:09 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2008-09-04 20:09:48

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : config.c config.h dict.c propsel.c propsel.h 
	                 structs.h structs_vec.c 
	multipathd     : cli.c cli.h cli_handlers.c cli_handlers.h 
	                 main.c 

Log message:
	Fix fox bz #238421.  You can now set flush_on_last_del in /etc/multipath.conf,
	which turns off queue_if_no_path when the last path is deleted from a multipath map.  You can also manually disable and restore queueing with the multipathd
	interactive disablequeueing and restorequeueing commands.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.7&r2=1.18.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.4&r2=1.11.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.6&r2=1.19.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.5&r2=1.18.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.6&r2=1.17.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.1&r2=1.11.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.h.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/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.4&r2=1.18.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs_vec.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.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/multipathd/cli.h.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/multipathd/cli_handlers.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.9&r2=1.69.2.10

--- multipath-tools/multipath.conf.annotated	2008/08/29 21:30:34	1.18.2.7
+++ multipath-tools/multipath.conf.annotated	2008/09/04 20:09:48	1.18.2.8
@@ -121,6 +121,15 @@
 #	#
 #	#no_path_retry  queue
 #
+#	# name    : flush_on_last_del
+#	# scope   : multipathd
+#	# desc    : If set to "yes", multipathd will disable queueing when the
+#	#           last path to a device has been deleted.
+#	# values  : yes|no
+#	# default : no
+#	#
+#	flush_on_last_del       yes
+#
 #	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
@@ -284,6 +293,16 @@
 #		#no_path_retry  queue
 #
 #		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#		flush_on_last_del       yes
+#
+#		#
 #		# name    : rr_min_io
 #		# scope   : multipath
 #		# desc    : the number of IO to route to a path before switching
@@ -422,6 +441,16 @@
 #		rr_min_io	100
 #
 #		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#              flush_on_last_del       yes
+#
+#		#
 #		# name    : product_blacklist
 #		# scope   : multipath & multipathd
 #		# desc    : product strings to blacklist for this vendor
--- multipath-tools/multipath.conf.synthetic	2008/08/25 20:59:05	1.11.2.4
+++ multipath-tools/multipath.conf.synthetic	2008/09/04 20:09:48	1.11.2.5
@@ -16,6 +16,7 @@
 #	failback		immediate
 #	no_path_retry		fail
 #	user_friendly_names	no
+#	flush_on_last_del	no
 #	mode			0666
 #	uid			0
 #	gid			0
--- multipath-tools/libmultipath/config.c	2008/08/25 20:59:06	1.19.2.6
+++ multipath-tools/libmultipath/config.c	2008/09/04 20:09:48	1.19.2.7
@@ -413,6 +413,7 @@
 	conf->minio = 1000;
 	conf->max_fds = 0;
 	conf->attribute_flags = 0;
+	conf->flush_on_last_del = 0;
 
 	/*
 	 * read the config file
--- multipath-tools/libmultipath/config.h	2008/08/25 20:59:06	1.18.2.5
+++ multipath-tools/libmultipath/config.h	2008/09/04 20:09:48	1.18.2.6
@@ -29,6 +29,7 @@
 	int no_path_retry;
 	int minio;
 	int pg_timeout;
+	int flush_on_last_del;
 	struct checker * checker;
 	char * bl_product;
 };
@@ -46,6 +47,7 @@
 	int minio;
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
@@ -72,6 +74,7 @@
 	int max_fds;
 	int force_reload;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/dict.c	2008/08/29 21:30:34	1.17.2.6
+++ multipath-tools/libmultipath/dict.c	2008/09/04 20:09:48	1.17.2.7
@@ -297,6 +297,26 @@
 }
 
 static int
+def_flush_on_last_del_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		conf->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		conf->flush_on_last_del = FLUSH_ENABLED;
+	else
+		conf->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 def_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -791,6 +811,30 @@
 }
 
 static int
+hw_flush_on_last_del_handler(vector strvec)
+{
+	struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
+	char * buff;
+
+	if (!hwe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		hwe->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		hwe->flush_on_last_del = FLUSH_ENABLED;
+	else
+		hwe->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 hw_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -1013,6 +1057,30 @@
 }
 
 static int
+mp_flush_on_last_del_handler(vector strvec)
+{
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+	char * buff;
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		mpe->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		mpe->flush_on_last_del = FLUSH_ENABLED;
+	else
+		mpe->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 mp_mode_handler(vector strvec)
 {
 	mode_t mode;
@@ -1272,6 +1340,20 @@
 }
 
 static int
+snprint_mp_flush_on_last_del (char * buff, int len, void * data)
+{
+	struct mpentry * mpe = (struct mpentry *)data;
+
+	switch (mpe->flush_on_last_del) {
+	case FLUSH_DISABLED:
+		return snprintf(buff, len, "no");
+	case FLUSH_ENABLED:
+		return snprintf(buff, len, "yes");
+	}
+	return 0;
+}
+
+static int
 snprint_mp_pg_timeout (char * buff, int len, void * data)
 {
 	struct mpentry * mpe = (struct mpentry *)data;
@@ -1489,6 +1571,20 @@
 }
 
 static int
+snprint_hw_flush_on_last_del (char * buff, int len, void * data)
+{
+	struct hwentry * hwe = (struct hwentry *)data;
+
+	switch (hwe->flush_on_last_del) {
+	case FLUSH_DISABLED:
+		return snprintf(buff, len, "no");
+	case FLUSH_ENABLED:
+		return snprintf(buff, len, "yes");
+	}
+	return 0;
+}
+
+static int
 snprint_hw_pg_timeout (char * buff, int len, void * data)
 {
 	struct hwentry * hwe = (struct hwentry *)data;
@@ -1716,6 +1812,18 @@
 }
 
 static int
+snprint_def_flush_on_last_del (char * buff, int len, void * data)
+{
+	switch (conf->flush_on_last_del) {
+	case FLUSH_DISABLED:
+		return snprintf(buff, len, "no");
+	case FLUSH_ENABLED:
+		return snprintf(buff, len, "yes");
+	}
+	return 0;
+}
+
+static int
 snprint_def_pg_timeout (char * buff, int len, void * data)
 {
 	if (conf->pg_timeout == DEFAULT_PGTIMEOUT)
@@ -1798,6 +1906,7 @@
 	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight);
 	install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
+	install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
 	install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
 	install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
 	install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
@@ -1856,6 +1965,7 @@
 	install_keyword("rr_weight", &hw_weight_handler, &snprint_hw_rr_weight);
 	install_keyword("no_path_retry", &hw_no_path_retry_handler, &snprint_hw_no_path_retry);
 	install_keyword("rr_min_io", &hw_minio_handler, &snprint_hw_rr_min_io);
+	install_keyword("flush_on_last_del", &hw_flush_on_last_del_handler, &snprint_hw_flush_on_last_del);
 	install_keyword("pg_timeout", &hw_pg_timeout_handler, &snprint_hw_pg_timeout);
 	install_sublevel_end();
 
@@ -1870,6 +1980,7 @@
 	install_keyword("rr_weight", &mp_weight_handler, &snprint_mp_rr_weight);
 	install_keyword("no_path_retry", &mp_no_path_retry_handler, &snprint_mp_no_path_retry);
 	install_keyword("rr_min_io", &mp_minio_handler, &snprint_mp_rr_min_io);
+	install_keyword("flush_on_last_del", &mp_flush_on_last_del_handler, &snprint_mp_flush_on_last_del);
 	install_keyword("pg_timeout", &mp_pg_timeout_handler, &snprint_mp_pg_timeout);
 	install_keyword("mode", &mp_mode_handler, &snprint_mp_mode);
 	install_keyword("uid", &mp_uid_handler, &snprint_mp_uid);
--- multipath-tools/libmultipath/propsel.c	2008/08/25 20:59:06	1.11.2.1
+++ multipath-tools/libmultipath/propsel.c	2008/09/04 20:09:48	1.11.2.2
@@ -279,6 +279,10 @@
 extern int
 select_no_path_retry(struct multipath *mp)
 {
+	if (mp->flush_on_last_del == FLUSH_IN_PROGRESS) {
+		condlog(0, "flush_on_last_del in progress");
+		mp->no_path_retry = NO_PATH_RETRY_FAIL;
+	}
 	if (mp->mpe && mp->mpe->no_path_retry != NO_PATH_RETRY_UNDEF) {
 		mp->no_path_retry = mp->mpe->no_path_retry;
 		condlog(3, "%s: no_path_retry = %i (multipath setting)",
@@ -385,6 +389,34 @@
 }
 
 extern int
+select_flush_on_last_del(struct multipath *mp)
+{
+	if (mp->flush_on_last_del == FLUSH_IN_PROGRESS)
+		return 0;
+	if (mp->mpe && mp->mpe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->mpe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (multipath setting)",
+				mp->flush_on_last_del);
+		return 0;
+	}
+	if (mp->hwe && mp->hwe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->hwe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (controler setting)",
+				mp->flush_on_last_del);
+		return 0;
+	}
+	if (conf->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = conf->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (config file default)",
+				mp->flush_on_last_del);
+		return 0;
+	}
+	mp->flush_on_last_del = FLUSH_UNDEF;
+	condlog(3, "flush_on_last_del = DISABLED (internal default)");
+	return 0;
+}
+
+extern int
 select_pg_timeout(struct multipath *mp)
 {
 	if (mp->mpe && mp->mpe->pg_timeout != PGTIMEOUT_UNDEF) {
--- multipath-tools/libmultipath/propsel.h	2008/08/25 20:59:06	1.5.2.1
+++ multipath-tools/libmultipath/propsel.h	2008/09/04 20:09:48	1.5.2.2
@@ -14,3 +14,4 @@
 int select_mode(struct multipath *mp);
 int select_uid(struct multipath *mp);
 int select_gid(struct multipath *mp);
+int select_flush_on_last_del(struct multipath *mp);
--- multipath-tools/libmultipath/structs.h	2008/08/29 21:30:34	1.18.2.4
+++ multipath-tools/libmultipath/structs.h	2008/09/04 20:09:48	1.18.2.5
@@ -71,6 +71,13 @@
 	ATTR_MODE,
 };
 
+enum flush_states {
+	FLUSH_UNDEF,
+	FLUSH_DISABLED,
+	FLUSH_ENABLED,
+	FLUSH_IN_PROGRESS,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -145,6 +152,7 @@
 	int minio;
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/structs_vec.c	2008/08/25 20:59:06	1.1.2.2
+++ multipath-tools/libmultipath/structs_vec.c	2008/09/04 20:09:48	1.1.2.3
@@ -290,6 +290,7 @@
 	select_pgfailback(mpp);
 	set_no_path_retry(mpp);
 	select_pg_timeout(mpp);
+	select_flush_on_last_del(mpp);
 
 	return 0;
 out:
--- multipath-tools/multipathd/cli.c	2007/01/10 20:08:09	1.5.2.1
+++ multipath-tools/multipathd/cli.c	2008/09/04 20:09:48	1.5.2.2
@@ -129,6 +129,8 @@
 	r += add_key(keys, "resume", RESUME, 0);
 	r += add_key(keys, "reinstate", REINSTATE, 0);
 	r += add_key(keys, "fail", FAIL, 0);
+	r += add_key(keys, "disablequeueing", DISABLEQ, 0);
+	r += add_key(keys, "restorequeueing", RESTOREQ, 0);
 	r += add_key(keys, "paths", PATHS, 0);
 	r += add_key(keys, "maps", MAPS, 0);
 	r += add_key(keys, "multipaths", MAPS, 0);
--- multipath-tools/multipathd/cli.h	2007/01/10 20:08:09	1.5.2.1
+++ multipath-tools/multipathd/cli.h	2008/09/04 20:09:48	1.5.2.2
@@ -7,6 +7,8 @@
 	__RESUME,
 	__REINSTATE,
 	__FAIL,
+	__DISABLEQ,
+	__RESTOREQ,
 	__PATHS,
 	__MAPS,
 	__PATH,
@@ -29,6 +31,8 @@
 #define RESUME		(1 << __RESUME)
 #define REINSTATE	(1 << __REINSTATE)
 #define FAIL		(1 << __FAIL)
+#define DISABLEQ	(1 << __DISABLEQ)
+#define RESTOREQ	(1 << __RESTOREQ)
 #define PATHS		(1 << __PATHS)
 #define MAPS		(1 << __MAPS)
 #define PATH		(1 << __PATH)
--- multipath-tools/multipathd/cli_handlers.c	2007/01/10 20:08:09	1.6.2.1
+++ multipath-tools/multipathd/cli_handlers.c	2008/09/04 20:09:48	1.6.2.2
@@ -336,6 +336,48 @@
 }
 
 int
+cli_restore_queueing(void *v, char **reply, int *len, void *data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	char * mapname = get_keyparam(v, MAP);
+	struct multipath *mpp;
+	int minor;
+
+	if (sscanf(mapname, "dm-%d", &minor) == 1)
+		mpp = find_mp_by_minor(vecs->mpvec, minor);
+	else
+		mpp = find_mp_by_alias(vecs->mpvec, mapname);
+
+	if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
+			mpp->no_path_retry != NO_PATH_RETRY_FAIL) {
+		dm_queue_if_no_path(mpp->alias, 1);
+		if (mpp->nr_active > 0)
+			mpp->retry_tick = 0;
+		else
+			mpp->retry_tick = mpp->no_path_retry * conf->checkint;
+	}
+	return 0;
+}
+
+int
+cli_disable_queueing(void *v, char **reply, int *len, void *data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	char * mapname = get_keyparam(v, MAP);
+	struct multipath *mpp;
+	int minor;
+
+	if (sscanf(mapname, "dm-%d", &minor) == 1)
+		mpp = find_mp_by_minor(vecs->mpvec, minor);
+	else
+		mpp = find_mp_by_alias(vecs->mpvec, mapname);
+
+	mpp->retry_tick = 0;
+	dm_queue_if_no_path(mpp->alias, 0);
+	return 0;
+}
+
+int
 cli_switch_group(void * v, char ** reply, int * len, void * data)
 {
 	char * mapname = get_keyparam(v, MAP);
--- multipath-tools/multipathd/cli_handlers.h	2007/01/10 20:08:09	1.3.2.1
+++ multipath-tools/multipathd/cli_handlers.h	2008/09/04 20:09:48	1.3.2.2
@@ -13,6 +13,8 @@
 int cli_del_map (void * v, char ** reply, int * len, void * data);
 int cli_switch_group(void * v, char ** reply, int * len, void * data);
 int cli_reconfigure(void * v, char ** reply, int * len, void * data);
+int cli_disable_queueing(void * v, char ** reply, int * len, void * data);
+int cli_restore_queueing(void * v, char ** reply, int * len, void * data);
 int cli_suspend(void * v, char ** reply, int * len, void * data);
 int cli_resume(void * v, char ** reply, int * len, void * data);
 int cli_reinstate(void * v, char ** reply, int * len, void * data);
--- multipath-tools/multipathd/main.c	2008/08/29 21:30:34	1.69.2.9
+++ multipath-tools/multipathd/main.c	2008/09/04 20:09:48	1.69.2.10
@@ -406,6 +406,7 @@
 			return 1; /* leave path added to pathvec */
 
 		verify_paths(mpp, vecs, NULL);
+		mpp->flush_on_last_del = FLUSH_UNDEF;
 		mpp->action = ACT_RELOAD;
 	}
 	else {
@@ -511,6 +512,13 @@
 				 * flush_map will fail if the device is open
 				 */
 				strncpy(alias, mpp->alias, WWID_SIZE);
+				if (mpp->flush_on_last_del == FLUSH_ENABLED) {
+					condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
+					mpp->retry_tick = 0;
+					mpp->no_path_retry = NO_PATH_RETRY_FAIL;
+					mpp->flush_on_last_del == FLUSH_IN_PROGRESS;
+					dm_queue_if_no_path(mpp->alias, 0);
+				}
 				if (flush_map(mpp, vecs))
 					rm_path = 0;
 				else
@@ -563,6 +571,13 @@
 			 * flush_map will fail if the device is open
 			 */
 			strncpy(alias, mpp->alias, WWID_SIZE);
+			if (mpp->flush_on_last_del == FLUSH_ENABLED) {
+				condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
+				mpp->retry_tick = 0;
+				mpp->no_path_retry = NO_PATH_RETRY_FAIL;
+				mpp->flush_on_last_del == FLUSH_IN_PROGRESS;
+				dm_queue_if_no_path(mpp->alias, 0);
+			}
 			if (flush_map(mpp, vecs))
 				rm_path = 0;
 			else
@@ -746,6 +761,8 @@
 	add_handler(RESUME+MAP, cli_resume);
 	add_handler(REINSTATE+PATH, cli_reinstate);
 	add_handler(FAIL+PATH, cli_fail);
+	add_handler(DISABLEQ+MAP, cli_disable_queueing);
+	add_handler(RESTOREQ+MAP, cli_restore_queueing);
 
 	uxsock_listen(&uxsock_trigger, ap);
 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2011-10-10  4:15 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2011-10-10  4:15 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 04:15:42

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	libmultipath   : dict.c 
	multipathd     : main.c 

Log message:
	Fix for BZs #702410, #711970, and #715524
	
	Various small cleanups.  Keep mutipath from complaining when it fails to add
	non-multipath devices. Allow "path_selector" or "selector" in the defaults
	section of multipath.conf. Document file_timeout option. Not applicable
	upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.18&r2=1.18.2.19
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.4.29&r2=1.5.4.30
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.19&r2=1.17.2.20
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.36&r2=1.69.2.37

--- multipath-tools/multipath.conf.annotated	2011/02/18 18:27:00	1.18.2.18
+++ multipath-tools/multipath.conf.annotated	2011/10/10 04:15:41	1.18.2.19
@@ -260,6 +260,16 @@
 #      # default : determined by the OS
 #      dev_loss_tmo 600
 #
+#      #
+#      # name    : file_timeout
+#      # scope   : multipath & multipathd
+#      # desc    : The number of seconds that multipath will wait for
+#      #           necessary files to appear while setting up a multipath
+#      #           devices.
+#      # values  : n > 0
+#      # default : 90
+#      file_timeout 30
+#
 #}
 #	
 ##
--- multipath-tools/multipath.conf.defaults	2011/03/07 05:19:36	1.5.4.29
+++ multipath-tools/multipath.conf.defaults	2011/10/10 04:15:41	1.5.4.30
@@ -16,6 +16,7 @@
 #	user_friendly_names	no
 #	pg_prio_calc		sum
 #	bindings_file           "/var/lib/multipath/bindings"
+#	file_timeout		90
 #}
 #
 #blacklist {
--- multipath-tools/libmultipath/dict.c	2011/04/05 18:41:45	1.17.2.19
+++ multipath-tools/libmultipath/dict.c	2011/10/10 04:15:41	1.17.2.20
@@ -2150,7 +2150,8 @@
 ;
 	install_keyword("polling_interval", &polling_interval_handler, &snprint_def_polling_interval);
 	install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir);
-	install_keyword("selector", &def_selector_handler, &snprint_def_selector);
+	install_keyword("selector", &def_selector_handler, NULL);
+	install_keyword("path_selector", &def_selector_handler, &snprint_def_selector);
 	install_keyword("path_grouping_policy", &def_pgpolicy_handler, &snprint_def_path_grouping_policy);
 	install_keyword("getuid_callout", &def_getuid_callout_handler, &snprint_def_getuid_callout);
 	install_keyword("prio_callout", &def_prio_callout_handler, &snprint_def_getprio_callout);
--- multipath-tools/multipathd/main.c	2011/10/10 03:47:07	1.69.2.36
+++ multipath-tools/multipathd/main.c	2011/10/10 04:15:41	1.69.2.37
@@ -227,7 +227,8 @@
 uev_add_map (char * devname, struct vectors * vecs)
 {
 	condlog(2, "%s: add map (uevent)", devname);
-	return ev_add_map(devname, vecs);
+	ev_add_map(devname, vecs);
+	return 0;
 }
 
 int

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2009-01-17  0:46 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2009-01-17  0:46 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2009-01-17 00:46:52

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	libmultipath   : dict.c hwtable.c structs.h 
	multipathd     : main.c 

Log message:
	Fixes for bz #214809 and #457228.  Added default configs for hp-sw hardware
	handler and changed max_fds to use max instead of unlimited, since the kernel
	doesn't allow a process to open unlimited fds.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.7&r2=1.16.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.5.2.11&r2=1.5.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.6&r2=1.16.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.15&r2=1.16.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.8&r2=1.17.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.66.2.5&r2=1.66.2.6

--- multipath-tools/multipath.conf.annotated	2009/01/16 21:30:42	1.16.2.7
+++ multipath-tools/multipath.conf.annotated	2009/01/17 00:46:51	1.16.2.8
@@ -113,7 +113,7 @@
 #	# scope   : multipathd
 #	# desc    : Sets the maximum number of open file descriptors for the
 #	#           multipathd process.
-#	# values  : unlimited|n > 0
+#	# values  : max|n > 0
 #	# default : None
 #	#
 #	max_fds		8192
--- multipath-tools/multipath.conf.defaults	2009/01/15 22:47:36	1.5.2.11
+++ multipath-tools/multipath.conf.defaults	2009/01/17 00:46:51	1.5.2.12
@@ -49,7 +49,7 @@
 #               product                 "MSA|HSV1.0.*"
 #               path_grouping_policy    group_by_prio
 #               prio_callout            "/sbin/mpath_prio_hp_sw /dev/%n"
-#               hardware_handler        "1 hp_sw"
+#               hardware_handler        "1 hp-sw"
 #               path_checker            "hp_sw"
 #               no_path_retry           12
 #		rr_min_io		100
@@ -127,8 +127,13 @@
 #       device {
 #               vendor                  "DEC"
 #               product                 "HSG80"
-#               path_grouping_policy    group_by_serial
-#               getuid_callout          "/sbin/scsi_id -g -u -s"
+#               path_grouping_policy    group_by_prio
+#               prio_callout		"/sbin/mpath_prio_hp_sw /dev/%n"
+#               hardware_handler	"1 hp-sw"
+#               features		"1 queue_if_no_path"
+#		path_checker		hp_sw
+#               no_path_retry           12
+#		rr_min_io		100
 #       }
 #       device {
 #               vendor                  "DGC"
--- multipath-tools/libmultipath/dict.c	2009/01/16 21:30:43	1.16.2.6
+++ multipath-tools/libmultipath/dict.c	2009/01/17 00:46:51	1.16.2.7
@@ -152,9 +152,9 @@
 	if (!buff)
 		return 1;
 
-	if (strlen(buff) == 9 &&
-	    !strcmp(buff, "unlimited"))
-		conf->max_fds = MAX_FDS_UNLIMITED;
+	if (strlen(buff) == 3 &&
+	    !strcmp(buff, "max"))
+		conf->max_fds = MAX_FDS_MAX;
 	else
 		conf->max_fds = atoi(buff);
 	FREE(buff);
--- multipath-tools/libmultipath/hwtable.c	2009/01/15 22:47:36	1.16.2.15
+++ multipath-tools/libmultipath/hwtable.c	2009/01/17 00:46:51	1.16.2.16
@@ -14,7 +14,6 @@
 	r += store_hwe(hw, "3PARdata", "VV", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "APPLE*", "Xserve RAID ", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "DDN", "SAN DataDirector", MULTIBUS, DEFAULT_GETUID);
-	r += store_hwe(hw, "DEC", "HSG80", GROUP_BY_SERIAL, DEFAULT_GETUID);
 	r += store_hwe(hw, "EMC", "SYMMETRIX", MULTIBUS,
 		       "/sbin/scsi_id -g -u -ppre-spc3-83 -s /block/%n");
 	r += store_hwe(hw, "FSC", "CentricStor", GROUP_BY_SERIAL, DEFAULT_GETUID);
@@ -25,7 +24,10 @@
 	r += store_hwe(hw, "STK", "OPENstorage D280", GROUP_BY_SERIAL, DEFAULT_GETUID);
 	r += store_hwe(hw, "SUN", "StorEdge 3510", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "SUN", "T4", MULTIBUS, DEFAULT_GETUID);
-
+	r += store_hwe_ext(hw, "DEC", "HSG80", GROUP_BY_PRIO,
+			   DEFAULT_GETUID, "/sbin/mpath_prio_hp_sw /dev/%n",
+			   "1 hp-sw", "1 queue_if_no_path", "hp_sw",
+			   FAILBACK_UNDEF, NULL, 12, 0, 100);
 	r + store_hwe_ext(hw, "GNBD", "GNBD", MULTIBUS,
         		  "/sbin/gnbd_import -q -U /block/%n", NULL, "0", "0",
 			  "directio", FAILBACK_UNDEF, NULL, 0, 0, 0);
@@ -35,7 +37,7 @@
 	                   100);
 	r += store_hwe_ext(hw, "COMPAQ", "MSA|HSV1.0.*", GROUP_BY_PRIO,
 	                   DEFAULT_GETUID, "/sbin/mpath_prio_hp_sw /dev/%n",
-	                   "1 hp_sw", "0", "hp_sw", FAILBACK_UNDEF, NULL, 12, 0,
+	                   "1 hp-sw", "0", "hp_sw", FAILBACK_UNDEF, NULL, 12, 0,
 	                   100);
 	r += store_hwe_ext(hw, "(COMPAQ|HP)", "HSV1[01]1|HSV2[01]0|HSV300",
 			   GROUP_BY_PRIO, DEFAULT_GETUID,
--- multipath-tools/libmultipath/structs.h	2008/04/14 22:40:08	1.17.2.8
+++ multipath-tools/libmultipath/structs.h	2009/01/17 00:46:51	1.17.2.9
@@ -20,7 +20,7 @@
 #define NO_PATH_RETRY_FAIL	-1
 #define NO_PATH_RETRY_QUEUE	-2
 
-#define MAX_FDS_UNLIMITED	-1
+#define MAX_FDS_MAX		(1024 * 1024)
 
 enum free_path_switch {
 	KEEP_PATHS,
--- multipath-tools/multipathd/main.c	2008/10/17 18:37:53	1.66.2.5
+++ multipath-tools/multipathd/main.c	2009/01/17 00:46:52	1.66.2.6
@@ -1625,14 +1625,9 @@
 
 	if (conf->max_fds) {
 		struct rlimit fd_limit;
-		if (conf->max_fds > 0) {
-			fd_limit.rlim_cur = conf->max_fds;
-			fd_limit.rlim_max = conf->max_fds;
-		}
-		else {
-			fd_limit.rlim_cur = RLIM_INFINITY;
-			fd_limit.rlim_max = RLIM_INFINITY;
-		}
+		
+		fd_limit.rlim_cur = conf->max_fds;
+		fd_limit.rlim_max = conf->max_fds;
 		if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
 			condlog(0, "can't set open fds limit to %d : %s\n",
 				conf->max_fds, strerror(errno));

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-09-08 22:01 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-09-08 22:01 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2008-09-08 22:01:20

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : config.h dict.c structs.h waiter.c 
	multipathd     : main.c 

Log message:
	Fix for bz #419581. There is a new default multipath.conf option,
	queue_without_daemon. It defaults to 'yes'.  If it is set to 'no', when
	multipathd is stopped, queue_if_no_path is disabled.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.8&r2=1.18.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.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/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.6&r2=1.18.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.7&r2=1.17.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.5&r2=1.18.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/waiter.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.11&r2=1.69.2.12

--- multipath-tools/multipath.conf.annotated	2008/09/04 20:09:48	1.18.2.8
+++ multipath-tools/multipath.conf.annotated	2008/09/08 22:01:19	1.18.2.9
@@ -121,6 +121,7 @@
 #	#
 #	#no_path_retry  queue
 #
+#	#
 #	# name    : flush_on_last_del
 #	# scope   : multipathd
 #	# desc    : If set to "yes", multipathd will disable queueing when the
@@ -131,6 +132,16 @@
 #	flush_on_last_del       yes
 #
 #	#
+#	# name    : queue_without_daemon
+#	# scope   : multipathd
+#	# desc    : If set to "no", multipathd will disable queueing for all
+#	#           devices when it is shut down.
+#	# values  : yes|no
+#	# default : yes
+#	#
+#	flush_on_last_del       no
+#
+#	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
 #	# desc    : If set to "yes", using the bindings file
--- multipath-tools/multipath.conf.synthetic	2008/09/04 20:09:48	1.11.2.5
+++ multipath-tools/multipath.conf.synthetic	2008/09/08 22:01:19	1.11.2.6
@@ -17,6 +17,7 @@
 #	no_path_retry		fail
 #	user_friendly_names	no
 #	flush_on_last_del	no
+#	queue_without_daemon    no
 #	mode			0666
 #	uid			0
 #	gid			0
--- multipath-tools/libmultipath/config.h	2008/09/04 20:09:48	1.18.2.6
+++ multipath-tools/libmultipath/config.h	2008/09/08 22:01:20	1.18.2.7
@@ -75,6 +75,7 @@
 	int force_reload;
 	int attribute_flags;
 	int flush_on_last_del;
+	int queue_without_daemon;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/dict.c	2008/09/04 20:09:48	1.17.2.7
+++ multipath-tools/libmultipath/dict.c	2008/09/08 22:01:20	1.17.2.8
@@ -317,6 +317,28 @@
 }
 
 static int
+def_queue_without_daemon(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1; 
+
+	if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) ||
+	    !strncmp(buff, "0", 1))
+		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
+	else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
+	    !strncmp(buff, "1", 1))
+		conf->queue_without_daemon = QUE_NO_DAEMON_ON;
+	else
+		conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 def_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -1812,6 +1834,18 @@
 }
 
 static int
+snprint_def_queue_without_daemon (char * buff, int len, void * data)
+{
+	switch (conf->queue_without_daemon) {
+	case QUE_NO_DAEMON_OFF:
+		return snprintf(buff, len, "no");
+	case QUE_NO_DAEMON_ON:
+		return snprintf(buff, len, "yes");
+	}
+	return 0;
+}
+
+static int
 snprint_def_flush_on_last_del (char * buff, int len, void * data)
 {
 	switch (conf->flush_on_last_del) {
@@ -1906,6 +1940,7 @@
 	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight);
 	install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
+	install_keyword("queue_without_daemon", &def_queue_without_daemon, &snprint_def_queue_without_daemon);
 	install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
 	install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
 	install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
--- multipath-tools/libmultipath/structs.h	2008/09/04 20:09:48	1.18.2.5
+++ multipath-tools/libmultipath/structs.h	2008/09/08 22:01:20	1.18.2.6
@@ -78,6 +78,12 @@
 	FLUSH_IN_PROGRESS,
 };
 
+enum queue_without_daemon_states {
+	QUE_NO_DAEMON_UNDEF,
+	QUE_NO_DAEMON_OFF,
+	QUE_NO_DAEMON_ON,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
--- multipath-tools/libmultipath/waiter.c	2008/08/27 19:14:57	1.1.2.2
+++ multipath-tools/libmultipath/waiter.c	2008/09/08 22:01:20	1.1.2.3
@@ -182,6 +182,8 @@
 	waiter = (struct event_thread *)et;
 	pthread_cleanup_push(free_waiter, et);
 
+	block_signal(SIGUSR1, NULL);
+	block_signal(SIGHUP, NULL);
 	while (1) {
 		r = waiteventloop(waiter);
 
--- multipath-tools/multipathd/main.c	2008/09/04 23:31:39	1.69.2.11
+++ multipath-tools/multipathd/main.c	2008/09/08 22:01:20	1.69.2.12
@@ -1470,6 +1470,8 @@
 #ifdef CLONE_NEWNS
 	unsigned int new_ns = (unsigned long)param & NEW_NS;
 #endif
+	struct multipath * mpp;
+	int i;
 
 	if (daemon)
 		setup_daemon();
@@ -1555,6 +1557,9 @@
 	 */
 	block_signal(SIGHUP, NULL);
 	lock(vecs->lock);
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
+		vector_foreach_slot(vecs->mpvec, mpp, i)
+			dm_queue_if_no_path(mpp->alias, 0);
 	remove_maps(vecs, stop_waiter_thread);
 	free_pathvec(vecs->pathvec, FREE_PATHS);
 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-08-25 20:59 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-08-25 20:59 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2008-08-25 20:59:06

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	kpartx         : devmapper.c devmapper.h kpartx.c 
	libmultipath   : config.c config.h configure.c devmapper.c 
	                 devmapper.h dict.c propsel.c propsel.h 
	                 structs.h structs_vec.c 

Log message:
	Fix for bz #431843.  Added three new parameters to /etc/multipath.conf:
	mode, uid, and gid.  These can be used to override the default values when
	multipath device nodes are created. Unfortunately, you cannot do name
	resolution with static binaries, since you must load libnss dynamically, so
	uid and gid must use the numerical user id and group id.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.5&r2=1.18.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.3&r2=1.11.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.8&r2=1.8.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/kpartx.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.9&r2=1.9.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.5&r2=1.19.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.4&r2=1.18.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/configure.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.4&r2=1.22.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.2&r2=1.11.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.4&r2=1.17.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11&r2=1.11.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.2&r2=1.18.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs_vec.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.1&r2=1.1.2.2

--- multipath-tools/multipath.conf.annotated	2008/01/15 01:34:36	1.18.2.5
+++ multipath-tools/multipath.conf.annotated	2008/08/25 20:59:05	1.18.2.6
@@ -143,6 +143,33 @@
 #	# default : "/var/lib/multipath/bindings"
 #	bindings_file "/etc/multipath_bindings"
 #
+#	#
+#	# name    : mode
+#	# scope   : multipath
+#	# desc    : The mode to use for the multipath device nodes, in octal.
+#	# values  : 0000 - 0777
+#	# default : determined by the process
+#	mode    0644
+#
+#	#
+#	# name    : uid
+#	# scope   : multipath
+#	# desc    : The user id to use for the multipath device nodes. You
+#	#           must use the numeric user id.
+#	# values  : <user_id_number>
+#	# default : determined by the process
+#	uid     0
+#
+#	#
+#	# name    : gid
+#	# scope   : multipath
+#	# desc    : The group id to use for the multipath device nodes. You
+#	#           must use the numeric group id.
+#	# values  : <group_id_number>
+#	# default : determined by the process
+#	gid     0
+#
+
 #}
 #	
 ##
@@ -264,6 +291,34 @@
 #		# default : 1000
 #		#
 #		rr_min_io	100
+#
+#		#
+#		# name    : mode
+#		# scope   : multipath
+#		# desc    : The mode to use for the multipath device node,
+#		#           in octal.
+#		# values  : 0000 - 0777
+#		# default : determined by the process
+#		mode    0644
+#
+#		#
+#		# name    : uid
+#		# scope   : multipath
+#		# desc    : The user id to use for the multipath device node.
+#		#           You must use the numeric user id.
+#		# values  : <user_id_number>
+#		# default : determined by the process
+#		uid     0
+#
+#		#
+#		# name    : gid
+#		# scope   : multipath
+#		# desc    : The group id to use for the multipath device node.
+#		#           You must use the numeric group id.
+#		# values  : <group_id_number>
+#		# default : determined by the process
+#		gid     0
+#
 #	}
 #	multipath {
 #		wwid	1DEC_____321816758474
--- multipath-tools/multipath.conf.synthetic	2008/01/15 01:34:36	1.11.2.3
+++ multipath-tools/multipath.conf.synthetic	2008/08/25 20:59:05	1.11.2.4
@@ -16,6 +16,9 @@
 #	failback		immediate
 #	no_path_retry		fail
 #	user_friendly_names	no
+#	mode			0666
+#	uid			0
+#	gid			0
 #}
 #blacklist {
 #       wwid 26353900f02796769
--- multipath-tools/kpartx/devmapper.c	2006/10/13 23:28:47	1.8
+++ multipath-tools/kpartx/devmapper.c	2008/08/25 20:59:06	1.8.2.1
@@ -74,7 +74,8 @@
 
 extern int
 dm_addmap (int task, const char *name, const char *target,
-	   const char *params, uint64_t size, const char *uuid, int part) {
+	   const char *params, uint64_t size, const char *uuid, int part,
+	   mode_t mode, uid_t uid, gid_t gid) {
 	int r = 0;
 	struct dm_task *dmt;
 	char *prefixed_uuid = NULL;
@@ -100,6 +101,13 @@
 			goto freeout;
 	}
 
+	if (!dm_task_set_mode(dmt, mode))
+		goto freeout;
+	if (!dm_task_set_uid(dmt, uid))
+		goto freeout;
+	if (!dm_task_set_gid(dmt, gid))
+		goto freeout;
+
 	dm_task_no_open_count(dmt);
 
 	r = dm_task_run (dmt);
--- multipath-tools/kpartx/devmapper.h	2006/10/13 23:28:47	1.5
+++ multipath-tools/kpartx/devmapper.h	2008/08/25 20:59:06	1.5.2.1
@@ -3,7 +3,7 @@
 int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *);
 int dm_addmap (int, const char *, const char *, const char *, uint64_t,
-	       const char *, int);
+	       const char *, int, mode_t, uid_t, gid_t);
 int dm_map_present (char *);
 char * dm_mapname(int major, int minor);
 dev_t dm_get_first_dep(char *devname);
--- multipath-tools/kpartx/kpartx.c	2006/10/13 23:28:47	1.9
+++ multipath-tools/kpartx/kpartx.c	2008/08/25 20:59:06	1.9.2.1
@@ -424,7 +424,9 @@
 					DM_DEVICE_RELOAD : DM_DEVICE_CREATE);
 
 				dm_addmap(op, partname, DM_TARGET, params,
-					  slices[j].size, uuid, j+1);
+					  slices[j].size, uuid, j+1,
+					  buf.st_mode & 0777, buf.st_uid,
+					  buf.st_gid);
 
 				if (op == DM_DEVICE_RELOAD)
 					dm_simplecmd(DM_DEVICE_RESUME,
--- multipath-tools/libmultipath/config.c	2008/01/15 01:34:36	1.19.2.5
+++ multipath-tools/libmultipath/config.c	2008/08/25 20:59:06	1.19.2.6
@@ -412,6 +412,7 @@
 	conf->dev_type = DEV_NONE;
 	conf->minio = 1000;
 	conf->max_fds = 0;
+	conf->attribute_flags = 0;
 
 	/*
 	 * read the config file
--- multipath-tools/libmultipath/config.h	2008/08/22 21:55:43	1.18.2.4
+++ multipath-tools/libmultipath/config.h	2008/08/25 20:59:06	1.18.2.5
@@ -1,6 +1,8 @@
 #ifndef _CONFIG_H
 #define _CONFIG_H
 
+#include <sys/types.h>
+
 #define ORIGIN_DEFAULT 0
 #define ORIGIN_CONFIG  1
 
@@ -43,6 +45,10 @@
 	int no_path_retry;
 	int minio;
 	int pg_timeout;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
 };
 
 struct config {
@@ -65,6 +71,10 @@
 	int pg_timeout;
 	int max_fds;
 	int force_reload;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
 
 	char * dev;
 	char * udev_dir;
--- multipath-tools/libmultipath/configure.c	2008/08/22 21:55:43	1.2.2.2
+++ multipath-tools/libmultipath/configure.c	2008/08/25 20:59:06	1.2.2.3
@@ -18,7 +18,6 @@
 
 #include "vector.h"
 #include "memory.h"
-#include "devmapper.h"
 #include "defaults.h"
 #include "structs.h"
 #include "structs_vec.h"
@@ -34,6 +33,7 @@
 #include "pgpolicies.h"
 #include "dict.h"
 #include "alias.h"
+#include "devmapper.h"
 
 extern int
 setup_map (struct multipath * mpp)
@@ -334,13 +334,11 @@
 		if (dm_map_present(mpp->alias))
 			break;
 
-		r = dm_addmap(DM_DEVICE_CREATE, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, mpp->wwid, 0);
+		r = dm_addmap(DM_DEVICE_CREATE, DEFAULT_TARGET, mpp, 1, 0);
 
 		if (!r)
-			r = dm_addmap(DM_DEVICE_CREATE, mpp->alias,
-				      DEFAULT_TARGET, mpp->params, mpp->size,
-				      mpp->wwid, 1);
+			r = dm_addmap(DM_DEVICE_CREATE, DEFAULT_TARGET, mpp, 1,
+				      1);
 		/*
 		 * DM_DEVICE_CREATE is actually DM_DEV_CREATE plus
 		 * DM_TABLE_LOAD. Failing the second part leaves an
@@ -357,12 +355,10 @@
 		break;
 
 	case ACT_RELOAD:
-		r = dm_addmap(DM_DEVICE_RELOAD, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, NULL, 0);
+		r = dm_addmap(DM_DEVICE_RELOAD, DEFAULT_TARGET, mpp, 0, 0);
 		if (!r)
-			r = dm_addmap(DM_DEVICE_RELOAD, mpp->alias,
-				      DEFAULT_TARGET, mpp->params, mpp->size,
-				      NULL, 1);
+			r = dm_addmap(DM_DEVICE_RELOAD, DEFAULT_TARGET, mpp, 0,
+				      1);
 		if (r)
 			r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias);
 		break;
--- multipath-tools/libmultipath/devmapper.c	2008/08/22 21:55:43	1.22.2.4
+++ multipath-tools/libmultipath/devmapper.c	2008/08/25 20:59:06	1.22.2.5
@@ -152,44 +152,53 @@
 }
 
 extern int
-dm_addmap (int task, const char *name, const char *target,
-	   const char *params, unsigned long long size, const char *uuid,
+dm_addmap (int task, const char *target, struct multipath *mpp, int use_wwid,
 	   int ro) {
 	int r = 0;
 	struct dm_task *dmt;
-	char *prefixed_uuid = NULL;
+	char *prefixed_wwid = NULL;
 
 	if (!(dmt = dm_task_create (task)))
 		return 0;
 
-	if (!dm_task_set_name (dmt, name))
+	if (!dm_task_set_name (dmt, mpp->alias))
 		goto addout;
 
-	if (!dm_task_add_target (dmt, 0, size, target, params))
+	if (!dm_task_add_target (dmt, 0, mpp->size, target, mpp->params))
 		goto addout;
 
 	if (ro)
 		dm_task_set_ro(dmt);
 
-	if (uuid){
-		prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(uuid) + 1);
-		if (!prefixed_uuid) {
+	if (use_wwid && mpp->wwid){
+		prefixed_wwid = MALLOC(UUID_PREFIX_LEN + strlen(mpp->wwid) + 1);
+		if (!prefixed_wwid) {
 			condlog(0, "cannot create prefixed uuid : %s\n",
 				strerror(errno));
 			goto addout;
 		}
-		sprintf(prefixed_uuid, UUID_PREFIX "%s", uuid);
-		if (!dm_task_set_uuid(dmt, prefixed_uuid))
+		sprintf(prefixed_wwid, UUID_PREFIX "%s", mpp->wwid);
+		if (!dm_task_set_uuid(dmt, prefixed_wwid))
 			goto freeout;
 	}
 
+	if (mpp->attribute_flags & (1 << ATTR_MODE) &&
+	    !dm_task_set_mode(dmt, mpp->mode))
+		goto freeout;
+	if (mpp->attribute_flags & (1 << ATTR_UID) &&
+	    !dm_task_set_uid(dmt, mpp->uid))
+		goto freeout;
+	if (mpp->attribute_flags & (1 << ATTR_GID) &&
+	    !dm_task_set_gid(dmt, mpp->gid))
+		goto freeout;
+
 	dm_task_no_open_count(dmt);
 
 	r = dm_task_run (dmt);
 
 	freeout:
-	if (prefixed_uuid)
-		free(prefixed_uuid);
+	if (prefixed_wwid)
+		free(prefixed_wwid);
 
 	addout:
 	dm_task_destroy (dmt);
--- multipath-tools/libmultipath/devmapper.h	2008/08/22 21:55:43	1.11.2.2
+++ multipath-tools/libmultipath/devmapper.h	2008/08/25 20:59:06	1.11.2.3
@@ -1,8 +1,7 @@
 void dm_init(void);
 int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *);
-int dm_addmap (int, const char *, const char *, const char *,
-	       unsigned long long, const char *uuid, int);
+int dm_addmap (int, const char *, struct multipath *, int, int); 
 int dm_map_present (char *);
 int dm_get_map(char *, unsigned long long *, char *);
 int dm_get_status(char *, char *);
--- multipath-tools/libmultipath/dict.c	2008/01/15 01:34:36	1.17.2.4
+++ multipath-tools/libmultipath/dict.c	2008/08/25 20:59:06	1.17.2.5
@@ -5,6 +5,8 @@
  * Copyright (c) 2005 Kiyoshi Ueda, NEC
  */
 #include <checkers.h>
+#include <sys/types.h>
+#include <pwd.h>
 
 #include "vector.h"
 #include "hwtable.h"
@@ -163,6 +165,79 @@
 }
 
 static int
+def_mode_handler(vector strvec)
+{
+	mode_t mode;
+	char *buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (sscanf(buff, "%o", &mode) == 1 && mode <= 0777){
+		conf->attribute_flags |= (1 << ATTR_MODE);
+		conf->mode = mode;
+	}
+
+	FREE(buff);
+	return 0;
+}
+
+static int
+def_uid_handler(vector strvec)
+{
+	uid_t uid;
+	char *buff;
+	/*
+	   char passwd_buf[1024];
+	   struct passwd info, *found;
+	 */
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+	/* Can't do this for statically linked binaries, because libnss
+	   must be dynamically loaded.  When we can use dynamically link
+	   binaries in the initramfs, we can put this back */
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+	  conf->attribute_flags |= (1 << ATTR_UID);
+	  conf->uid = info.pw_uid;
+	  }
+	  else */if (sscanf(buff, "%u", &uid) == 1){
+		  conf->attribute_flags |= (1 << ATTR_UID);
+		  conf->uid = uid;
+	  }
+	  FREE(buff);
+	  return 0;
+}
+
+static int
+def_gid_handler(vector strvec)
+{
+	gid_t gid;
+	char *buff;
+	/*
+	   char passwd_buf[1024];
+	   struct passwd info, *found;
+	 */
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+	  conf->attribute_flags |= (1 << ATTR_GID);
+	  conf->gid = info.pw_gid;
+	  }
+	  else */if (sscanf(buff, "%u", &gid) == 1){
+		  conf->attribute_flags |= (1 << ATTR_GID);
+		  conf->gid = gid;
+	  }
+	  FREE(buff);
+	  return 0;
+}
+
+static int
 def_weight_handler(vector strvec)
 {
 	char * buff;
@@ -938,6 +1013,88 @@
 }
 
 static int
+mp_mode_handler(vector strvec)
+{
+	mode_t mode;
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+	char *buff;
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+	if (sscanf(buff, "%o", &mode) == 1 && mode <= 0777){
+		mpe->attribute_flags |= (1 << ATTR_MODE);
+		mpe->mode = mode;
+	}
+
+	FREE(buff);
+	return 0;
+}
+
+static int
+mp_uid_handler(vector strvec)
+{
+	uid_t uid;
+	char *buff;
+	/*
+	   char passwd_buf[1024];
+	   struct passwd info, *found;
+	 */
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+	  mpe->attribute_flags |= (1 << ATTR_UID);
+	  mpe->uid = info.pw_uid;
+	  }
+	  else */if (sscanf(buff, "%u", &uid) == 1){
+		  mpe->attribute_flags |= (1 << ATTR_UID);
+		  mpe->uid = uid;
+	  }
+	  FREE(buff);
+	  return 0;
+}
+
+static int
+mp_gid_handler(vector strvec)
+{
+	gid_t gid;
+	char *buff;
+	/*
+	   char passwd_buf[1024];
+	   struct passwd info, *found;
+	 */
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+	  mpe->attribute_flags |= (1 << ATTR_GID);
+	  mpe->gid = info.pw_gid;
+	  }
+	  else */if (sscanf(buff, "%u", &gid) == 1){
+		  mpe->attribute_flags |= (1 << ATTR_GID);
+		  mpe->gid = gid;
+	  }
+	  FREE(buff);
+	  return 0;
+}
+
+static int
 mp_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -1018,6 +1175,36 @@
 }
 
 static int
+snprint_mp_mode(char * buff, int len, void * data)
+{
+	struct mpentry * mpe = (struct mpentry *)data;
+
+	if ((mpe->attribute_flags & (1 << ATTR_MODE)) == 0)
+		return 0;
+	return snprintf(buff, len, "0%o", mpe->mode);
+}
+
+static int
+snprint_mp_uid(char * buff, int len, void * data)
+{
+	struct mpentry * mpe = (struct mpentry *)data;
+
+	if ((mpe->attribute_flags & (1 << ATTR_UID)) == 0)
+		return 0;
+	return snprintf(buff, len, "%u", mpe->uid);
+}
+
+static int
+snprint_mp_gid(char * buff, int len, void * data)
+{
+	struct mpentry * mpe = (struct mpentry *)data;
+
+	if ((mpe->attribute_flags & (1 << ATTR_GID)) == 0)
+		return 0;
+	return snprintf(buff, len, "%u", mpe->gid);
+}
+
+static int
 snprint_mp_failback (char * buff, int len, void * data)
 {
 	struct mpentry * mpe = (struct mpentry *)data;
@@ -1472,6 +1659,30 @@
 }
 
 static int
+snprint_def_mode(char * buff, int len, void * data)
+{
+	if ((conf->attribute_flags & (1 << ATTR_MODE)) == 0)
+		return 0;
+	return snprintf(buff, len, "0%o", conf->mode);
+}
+
+static int
+snprint_def_uid(char * buff, int len, void * data)
+{
+	if ((conf->attribute_flags & (1 << ATTR_UID)) == 0)
+		return 0;
+	return snprintf(buff, len, "%u", conf->uid);
+}
+
+static int
+snprint_def_gid(char * buff, int len, void * data)
+{
+	if ((conf->attribute_flags & (1 << ATTR_GID)) == 0)
+		return 0;
+	return snprintf(buff, len, "%u", conf->gid);
+}
+
+static int
 snprint_def_rr_weight (char * buff, int len, void * data)
 {
 	if (!conf->rr_weight)
@@ -1590,6 +1801,9 @@
 	install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
 	install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
 	install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
+	install_keyword("mode", &def_mode_handler, &snprint_def_mode);
+	install_keyword("uid", &def_uid_handler, &snprint_def_uid);
+	install_keyword("gid", &def_gid_handler, &snprint_def_gid);
 	__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
 	__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
 	__deprecated install_keyword("default_getuid_callout", &def_getuid_callout_handler, NULL);
@@ -1657,5 +1871,8 @@
 	install_keyword("no_path_retry", &mp_no_path_retry_handler, &snprint_mp_no_path_retry);
 	install_keyword("rr_min_io", &mp_minio_handler, &snprint_mp_rr_min_io);
 	install_keyword("pg_timeout", &mp_pg_timeout_handler, &snprint_mp_pg_timeout);
+	install_keyword("mode", &mp_mode_handler, &snprint_mp_mode);
+	install_keyword("uid", &mp_uid_handler, &snprint_mp_uid);
+	install_keyword("gid", &mp_gid_handler, &snprint_mp_gid);
 	install_sublevel_end();
 }
--- multipath-tools/libmultipath/propsel.c	2006/08/02 21:37:22	1.11
+++ multipath-tools/libmultipath/propsel.c	2008/08/25 20:59:06	1.11.2.1
@@ -331,6 +331,60 @@
 }
 
 extern int
+select_mode (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_MODE))) {
+		mp->attribute_flags |= (1 << ATTR_MODE);
+		mp->mode = mp->mpe->mode;
+		condlog(3, "mode = 0%o (multipath setting)", mp->mode);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_MODE)) {
+		mp->attribute_flags |= (1 << ATTR_MODE);
+		mp->mode = conf->mode;
+		condlog(3, "mode = 0%o (config file default)", mp->mode);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_MODE);
+	return 0;
+}
+
+extern int
+select_uid (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_UID))) {
+		mp->attribute_flags |= (1 << ATTR_UID);
+		mp->uid = mp->mpe->uid;
+		condlog(3, "uid = %u (multipath setting)", mp->uid);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_UID)) {
+		mp->attribute_flags |= (1 << ATTR_UID);
+		mp->uid = conf->uid;
+		condlog(3, "uid = %u (config file default)", mp->uid);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_UID);
+	return 0;
+}
+
+extern int
+select_gid (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_GID))) {
+		mp->attribute_flags |= (1 << ATTR_GID);
+		mp->gid = mp->mpe->gid;
+		condlog(3, "gid = %u (multipath setting)", mp->gid);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_GID)) {
+		mp->attribute_flags |= (1 << ATTR_GID);
+		mp->gid = conf->gid;
+		condlog(3, "gid = %u (config file default)", mp->gid);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_GID);
+	return 0;
+}
+
+extern int
 select_pg_timeout(struct multipath *mp)
 {
 	if (mp->mpe && mp->mpe->pg_timeout != PGTIMEOUT_UNDEF) {
--- multipath-tools/libmultipath/propsel.h	2006/06/06 18:32:43	1.5
+++ multipath-tools/libmultipath/propsel.h	2008/08/25 20:59:06	1.5.2.1
@@ -11,3 +11,6 @@
 int select_no_path_retry(struct multipath *mp);
 int select_pg_timeout(struct multipath *mp);
 int select_minio(struct multipath *mp);
+int select_mode(struct multipath *mp);
+int select_uid(struct multipath *mp);
+int select_gid(struct multipath *mp);
--- multipath-tools/libmultipath/structs.h	2008/01/15 01:34:36	1.18.2.2
+++ multipath-tools/libmultipath/structs.h	2008/08/25 20:59:06	1.18.2.3
@@ -1,6 +1,8 @@
 #ifndef _STRUCTS_H
 #define _STRUCTS_H
 
+#include <sys/types.h>
+
 #define WWID_SIZE		128
 #define SERIAL_SIZE		64
 #define NODE_NAME_SIZE		19
@@ -63,6 +65,12 @@
 	PGTIMEOUT_NONE
 };
 
+enum attribute_bits {
+	ATTR_UID,
+	ATTR_GID,
+	ATTR_MODE,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -136,6 +144,11 @@
 	int retry_tick;    /* remaining times for retries */
 	int minio;
 	int pg_timeout;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
+
 	unsigned long long size;
 	vector paths;
 	vector pg;
--- multipath-tools/libmultipath/structs_vec.c	2007/06/15 19:03:02	1.1.2.1
+++ multipath-tools/libmultipath/structs_vec.c	2008/08/25 20:59:06	1.1.2.2
@@ -343,6 +343,9 @@
 
 	strcpy(mpp->wwid, pp->wwid);
 	select_alias(mpp);
+	select_mode(mpp);
+	select_uid(mpp);
+	select_gid(mpp);
 	mpp->size = pp->size;
 
 	if (adopt_paths(vecs->pathvec, mpp))

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-04-14 22:40 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-04-14 22:40 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2008-04-14 22:40:09

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : config.c config.h dict.c propsel.c propsel.h 
	                 structs.h 
	multipathd     : cli.c cli.h cli_handlers.c cli_handlers.h 
	                 main.c 

Log message:
	Fix for bz #430494.  I added another multipath.conf parameter,
	"flush_on_last_del" that, if set, turns off queueing when the last path for a
	mutipath device is deleted.  It is also possible to disable and restore queueing
	via multipathd -k commands.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.5&r2=1.16.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.10.2.2&r2=1.10.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.3&r2=1.17.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.3&r2=1.17.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.4&r2=1.16.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.9.2.2&r2=1.9.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4.2.2&r2=1.4.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.7&r2=1.17.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.66.2.3&r2=1.66.2.4

--- multipath-tools/multipath.conf.annotated	2008/04/14 22:32:03	1.16.2.5
+++ multipath-tools/multipath.conf.annotated	2008/04/14 22:40:08	1.16.2.6
@@ -140,6 +140,16 @@
 #	no_path_retry  queue
 #
 #	#
+#	# name    : flush_on_last_del
+#	# scope   : multipathd
+#	# desc    : If set to "yes", multipathd will disable queueing when the
+#	#           last path to a device has been deleted.
+#	# values  : yes|no
+#	# default : no
+#	#
+#	flush_on_last_del	yes
+#
+#	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
 #	# desc    : If set to "yes", using the bindings file, by default
@@ -282,7 +292,17 @@
 #		# values  : queue|fail|n (>0)
 #		#
 #		no_path_retry  queue
+#
 #		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#		flush_on_last_del	yes
+#
 #		# name    : mode
 #		# scope   : multipath
 #		# desc    : The mode to use for the multipath device node,
@@ -447,6 +467,16 @@
 #		# values  : queue|fail|n (>0)
 #		#
 #		no_path_retry  queue
+#
+#		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#		flush_on_last_del	yes
 #	}
 #	device {
 #		vendor			"COMPAQ  "
--- multipath-tools/multipath.conf.synthetic	2008/04/14 22:32:03	1.10.2.2
+++ multipath-tools/multipath.conf.synthetic	2008/04/14 22:40:08	1.10.2.3
@@ -15,6 +15,7 @@
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
+#	flush_on_last_del	no
 #	user_friendly_name	yes
 #	mode			0666
 #	uid			0
--- multipath-tools/libmultipath/config.c	2008/04/14 22:32:04	1.17.2.3
+++ multipath-tools/libmultipath/config.c	2008/04/14 22:40:08	1.17.2.4
@@ -408,6 +408,7 @@
 	conf->rr_min_io = DEFAULT_RR_MIN_IO;
 	conf->max_fds = 0;
 	conf->attribute_flags = 0;
+	conf->flush_on_last_del = 0;
 	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
--- multipath-tools/libmultipath/config.h	2008/04/14 22:32:04	1.17.2.3
+++ multipath-tools/libmultipath/config.h	2008/04/14 22:40:08	1.17.2.4
@@ -23,6 +23,7 @@
 	int rr_weight;
 	int no_path_retry;
 	int pg_timeout;
+	int flush_on_last_del;
 
 	char * vendor;
 	char * product;
@@ -44,6 +45,7 @@
 	int no_path_retry;
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
@@ -75,6 +77,7 @@
 	int pg_timeout;
 	int max_fds;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/dict.c	2008/04/14 22:32:04	1.16.2.4
+++ multipath-tools/libmultipath/dict.c	2008/04/14 22:40:08	1.16.2.5
@@ -294,6 +294,26 @@
 }
 
 static int
+def_flush_on_last_del_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		conf->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		conf->flush_on_last_del = FLUSH_ENABLED;
+	else
+		conf->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 default_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -659,6 +679,30 @@
 }
 
 static int
+hw_flush_on_last_del_handler(vector strvec)
+{
+	struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
+	char * buff;
+
+	if (!hwe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		hwe->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		hwe->flush_on_last_del = FLUSH_ENABLED;
+	else
+		hwe->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 hw_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -857,6 +901,30 @@
 }
 
 static int
+mp_flush_on_last_del_handler(vector strvec)
+{
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+	char * buff;
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+		mpe->flush_on_last_del = FLUSH_DISABLED;
+	else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+		mpe->flush_on_last_del = FLUSH_ENABLED;
+	else
+		mpe->flush_on_last_del = FLUSH_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 mp_mode_handler(vector strvec)
 {
 	mode_t mode;
@@ -987,6 +1055,7 @@
 	install_keyword("max_fds", &max_fds_handler);
 	install_keyword("rr_weight", &def_weight_handler);
 	install_keyword("no_path_retry", &def_no_path_retry_handler);
+	install_keyword("flush_on_last_del", &def_flush_on_last_del_handler);
 	install_keyword("pg_timeout", &default_pg_timeout_handler);
 	install_keyword("user_friendly_names", &names_handler);
 	install_keyword("bindings_file", &bindings_file_handler);
@@ -1024,6 +1093,7 @@
 	install_keyword("failback", &hw_failback_handler);
 	install_keyword("rr_weight", &hw_weight_handler);
 	install_keyword("no_path_retry", &hw_no_path_retry_handler);
+	install_keyword("flush_on_last_del", &hw_flush_on_last_del_handler);
 	install_keyword("pg_timeout", &hw_pg_timeout_handler);
 	install_sublevel_end();
 
@@ -1037,6 +1107,7 @@
 	install_keyword("failback", &mp_failback_handler);
 	install_keyword("rr_weight", &mp_weight_handler);
 	install_keyword("no_path_retry", &mp_no_path_retry_handler);
+	install_keyword("flush_on_last_del", &mp_flush_on_last_del_handler);
 	install_keyword("pg_timeout", &mp_pg_timeout_handler);
 	install_keyword("mode",	&mp_mode_handler);
 	install_keyword("uid", &mp_uid_handler);
--- multipath-tools/libmultipath/propsel.c	2008/04/14 22:32:04	1.9.2.2
+++ multipath-tools/libmultipath/propsel.c	2008/04/14 22:40:08	1.9.2.3
@@ -322,6 +322,32 @@
 }
 
 extern int
+select_flush_on_last_del(struct multipath *mp)
+{
+	if (mp->mpe && mp->mpe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->mpe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (multipath setting)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	if (mp->hwe && mp->hwe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->hwe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (controler setting)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	if (conf->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = conf->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (config file default)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	mp->flush_on_last_del = FLUSH_UNDEF;
+	condlog(3, "flush_on_last_del = DISABLED (internal default)");
+	return 0;
+}
+
+extern int
 select_pg_timeout(struct multipath *mp)
 {
 	if (mp->mpe && mp->mpe->pg_timeout != PGTIMEOUT_UNDEF) {
--- multipath-tools/libmultipath/propsel.h	2008/04/14 22:32:04	1.4.2.2
+++ multipath-tools/libmultipath/propsel.h	2008/04/14 22:40:08	1.4.2.3
@@ -14,3 +14,4 @@
 int select_mode(struct multipath *mp);
 int select_uid(struct multipath *mp);
 int select_gid(struct multipath *mp);
+int select_flush_on_last_del(struct multipath *mp);
--- multipath-tools/libmultipath/structs.h	2008/04/14 22:32:04	1.17.2.7
+++ multipath-tools/libmultipath/structs.h	2008/04/14 22:40:08	1.17.2.8
@@ -71,6 +71,12 @@
 	ATTR_MODE,
 };
 
+enum flush_states {
+	FLUSH_UNDEF,
+	FLUSH_DISABLED,
+	FLUSH_ENABLED,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -142,6 +148,7 @@
 	int retry_tick;    /* remaining times for retries */
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/multipathd/cli.c	2005/11/16 20:24:58	1.4
+++ multipath-tools/multipathd/cli.c	2008/04/14 22:40:09	1.4.2.1
@@ -124,6 +124,8 @@
 	r += add_key(keys, "del", DEL, 0);
 	r += add_key(keys, "switch", SWITCH, 0);
 	r += add_key(keys, "switchgroup", SWITCH, 0);
+	r += add_key(keys, "disablequeueing", DISABLEQ, 0);
+	r += add_key(keys, "restorequeueing", RESTOREQ, 0);
 	r += add_key(keys, "paths", PATHS, 0);
 	r += add_key(keys, "maps", MAPS, 0);
 	r += add_key(keys, "path", PATH, 1);
--- multipath-tools/multipathd/cli.h	2005/11/16 20:24:58	1.4
+++ multipath-tools/multipathd/cli.h	2008/04/14 22:40:09	1.4.2.1
@@ -3,6 +3,8 @@
 	__ADD,
 	__DEL,
 	__SWITCH,
+	__DISABLEQ,
+	__RESTOREQ,
 	__PATHS,
 	__MAPS,
 	__PATH,
@@ -17,6 +19,8 @@
 #define ADD		(1 << __ADD)
 #define DEL		(1 << __DEL)
 #define SWITCH		(1 << __SWITCH)
+#define DISABLEQ	(1 << __DISABLEQ)
+#define RESTOREQ	(1 << __RESTOREQ)
 #define PATHS		(1 << __PATHS)
 #define MAPS		(1 << __MAPS)
 #define PATH		(1 << __PATH)
--- multipath-tools/multipathd/cli_handlers.c	2005/12/02 08:01:09	1.4
+++ multipath-tools/multipathd/cli_handlers.c	2008/04/14 22:40:09	1.4.2.1
@@ -74,6 +74,48 @@
 }
 
 int
+cli_restore_queueing(void *v, char **reply, int *len, void *data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	char * mapname = get_keyparam(v, MAP);
+	struct multipath *mpp;
+	int minor;
+
+	if (sscanf(mapname, "dm-%d", &minor) == 1)
+		mpp = find_mp_by_minor(vecs->mpvec, minor);
+	else
+		mpp = find_mp(vecs->mpvec, mapname);
+
+	if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
+	    mpp->no_path_retry != NO_PATH_RETRY_FAIL) {
+		dm_queue_if_no_path(mpp->alias, 1);
+		if (mpp->nr_active > 0)
+			mpp->retry_tick = 0;
+		else
+			mpp->retry_tick = mpp->no_path_retry * conf->checkint;
+	}
+	return 0;
+}
+
+int
+cli_disable_queueing(void *v, char **reply, int *len, void *data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	char * mapname = get_keyparam(v, MAP);
+	struct multipath *mpp;
+	int minor;
+
+	if (sscanf(mapname, "dm-%d", &minor) == 1)
+		mpp = find_mp_by_minor(vecs->mpvec, minor);
+	else
+		mpp = find_mp(vecs->mpvec, mapname);
+
+	mpp->retry_tick = 0;
+	dm_queue_if_no_path(mpp->alias, 0);
+	return 0;
+}
+
+int
 cli_del_map (void * v, char ** reply, int * len, void * data)
 {
 	struct vectors * vecs = (struct vectors *)data;
--- multipath-tools/multipathd/cli_handlers.h	2005/10/12 21:57:26	1.2
+++ multipath-tools/multipathd/cli_handlers.h	2008/04/14 22:40:09	1.2.2.1
@@ -7,3 +7,5 @@
 int cli_switch_group(void * v, char ** reply, int * len, void * data);
 int cli_dump_pathvec(void * v, char ** reply, int * len, void * data);
 int cli_reconfigure(void * v, char ** reply, int * len, void * data);
+int cli_disable_queueing(void * v, char ** reply, int * len, void * data);
+int cli_restore_queueing(void * v, char ** reply, int * len, void * data);
--- multipath-tools/multipathd/main.c	2008/01/25 22:30:00	1.66.2.3
+++ multipath-tools/multipathd/main.c	2008/04/14 22:40:09	1.66.2.4
@@ -416,6 +416,7 @@
 	adopt_paths(vecs, mpp);
 	mpp->hwe = extract_hwe_from_path(mpp);
 	select_pgfailback(mpp);
+	select_flush_on_last_del(mpp);
 	set_no_path_retry(mpp);
 
 	return 0;
@@ -837,6 +838,8 @@
 {
 	int i;
 	struct path * pp;
+	struct multipath * mpp;
+	int found = 0;
 
 	pp = find_path_by_dev(vecs->pathvec, devname);
 
@@ -844,14 +847,28 @@
 		condlog(3, "%s: not in pathvec", devname);
 		return 1;
 	}
+	
+	mpp = pp->mpp;
 
-	if (pp->mpp && (pp->state == PATH_UP || pp->state == PATH_GHOST))
-		update_queue_mode_del_path(pp->mpp);
+	if (mpp && (pp->state == PATH_UP || pp->state == PATH_GHOST))
+		update_queue_mode_del_path(mpp);
 
 	condlog(2, "remove %s path checker", devname);
 	i = find_slot(vecs->pathvec, (void *)pp);
 	vector_del_slot(vecs->pathvec, i);
 	free_path(pp);
+	vector_foreach_slot (vecs->pathvec, pp, i) {
+		if (pp->mpp == mpp){
+			found = 1;
+			break;
+		}
+	}
+	if (!found && mpp->flush_on_last_del == FLUSH_ENABLED) {	
+		condlog(1, "%s: Last path deleted, disabling queueing",
+		        mpp->alias);
+		mpp->retry_tick = 0;
+		dm_queue_if_no_path(mpp->alias, 0);
+	}
 
 	return 0;
 }
@@ -1166,6 +1183,8 @@
 	add_handler(SWITCH+MAP+GROUP, cli_switch_group);
 	add_handler(DUMP+PATHVEC, cli_dump_pathvec);
 	add_handler(RECONFIGURE, cli_reconfigure);
+	add_handler(DISABLEQ+MAP, cli_disable_queueing);
+	add_handler(RESTOREQ+MAP, cli_restore_queueing);
 
 	uxsock_listen(&uxsock_trigger, ap);
 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-04-14 22:32 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-04-14 22:32 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2008-04-14 22:32:04

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	kpartx         : devmapper.c devmapper.h kpartx.c 
	libmultipath   : config.c config.h devmapper.c devmapper.h 
	                 dict.c propsel.c propsel.h structs.h 
	multipath      : main.c 

Log message:
	Fix for bz #251388.  Added three new parameters to /etc/multipath.conf:
	mode, uid, and gid.  These can be used to override the default values when
	multipath device nodes are created. Unfortunately, you cannot do name
	resolution with static binaries, since you must load libnss dynamically, so
	uid and gid must use the numerical user id and group id.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.4&r2=1.16.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.10.2.1&r2=1.10.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/kpartx.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.7.2.2&r2=1.7.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.2&r2=1.17.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.2&r2=1.17.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.18.2.1&r2=1.18.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.10&r2=1.10.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.3&r2=1.16.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.9.2.1&r2=1.9.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.6&r2=1.17.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.41.2.6&r2=1.41.2.7

--- multipath-tools/multipath.conf.annotated	2008/01/25 22:30:00	1.16.2.4
+++ multipath-tools/multipath.conf.annotated	2008/04/14 22:32:03	1.16.2.5
@@ -161,6 +161,32 @@
 #	# default : "/var/lib/multipath/bindings"
 #	bindings_file "/etc/multipath_bindings"
 #
+#	#
+#	# name    : mode
+#	# scope   : multipath
+#	# desc    : The mode to use for the multipath device nodes, in octal.
+#	# values  : 0000 - 0777
+#	# default : determined by the process
+#	mode	0644
+#
+#	#
+#	# name    : uid
+#	# scope   : multipath
+#	# desc    : The user id to use for the multipath device nodes. You
+#	#           must use the numeric user id.
+#	# values  : <user_id_number>
+#	# default : determined by the process
+#	uid	0
+#
+#	#
+#	# name    : gid
+#	# scope   : multipath
+#	# desc    : The group id to use for the multipath device nodes. You
+#	#           must use the numeric group id.
+#	# values  : <group_id_number>
+#	# default : determined by the process
+#	gid	0
+#
 #}
 #	
 ##
@@ -256,6 +282,33 @@
 #		# values  : queue|fail|n (>0)
 #		#
 #		no_path_retry  queue
+#		#
+#		# name    : mode
+#		# scope   : multipath
+#		# desc    : The mode to use for the multipath device node,
+#		#           in octal.
+#		# values  : 0000 - 0777
+#		# default : determined by the process
+#		mode	0644
+#
+#		#
+#		# name    : uid
+#		# scope   : multipath
+#		# desc    : The user id to use for the multipath device node.
+#		#           You must use the numeric user id.
+#		# values  : <user_id_number>
+#		# default : determined by the process
+#		uid	0
+#
+#		#
+#		# name    : gid
+#		# scope   : multipath
+#		# desc    : The group id to use for the multipath device node.
+#		#           You must use the numeric group id.
+#		# values  : <group_id_number>
+#		# default : determined by the process
+#		gid	0
+#
 #	}
 #	multipath {
 #		wwid	1DEC_____321816758474
--- multipath-tools/multipath.conf.synthetic	2008/01/25 22:30:00	1.10.2.1
+++ multipath-tools/multipath.conf.synthetic	2008/04/14 22:32:03	1.10.2.2
@@ -16,6 +16,9 @@
 #	failback		immediate
 #	no_path_retry		fail
 #	user_friendly_name	yes
+#	mode			0666
+#	uid			0
+#	gid			0
 #}
 #devnode_blacklist {
 #       wwid 26353900f02796769
--- multipath-tools/kpartx/devmapper.c	2006/09/19 21:06:40	1.6.2.1
+++ multipath-tools/kpartx/devmapper.c	2008/04/14 22:32:04	1.6.2.2
@@ -72,7 +72,8 @@
 
 extern int
 dm_addmap (int task, const char *name, const char *target,
-	   const char *params, unsigned long size, const char *uuid, int part) {
+	   const char *params, unsigned long size, const char *uuid, int part,
+	   mode_t mode, uid_t uid, gid_t gid) {
 	int r = 0;
 	struct dm_task *dmt;
 	char *prefixed_uuid = NULL;
@@ -98,6 +99,13 @@
 			goto freeout;
 	}
 
+	if (!dm_task_set_mode(dmt, mode))
+		goto freeout;
+	if (!dm_task_set_uid(dmt, uid))
+		goto freeout;
+	if (!dm_task_set_gid(dmt, gid))
+		goto freeout;
+
 	dm_task_no_open_count(dmt);
 
 	r = dm_task_run (dmt);
--- multipath-tools/kpartx/devmapper.h	2006/09/19 21:06:40	1.3.2.1
+++ multipath-tools/kpartx/devmapper.h	2008/04/14 22:32:04	1.3.2.2
@@ -1,7 +1,7 @@
 int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *);
 int dm_addmap (int, const char *, const char *, const char *, unsigned long,
-	       char *, int);
+	       char *, int, mode_t, uid_t, gid_t);
 int dm_map_present (char *);
 const char * dm_mapname(int major, int minor);
 dev_t dm_get_first_dep(char *devname);
--- multipath-tools/kpartx/kpartx.c	2007/10/19 21:41:56	1.7.2.2
+++ multipath-tools/kpartx/kpartx.c	2008/04/14 22:32:04	1.7.2.3
@@ -511,7 +511,9 @@
 					DM_DEVICE_RELOAD : DM_DEVICE_CREATE);
 
 				dm_addmap(op, partname, DM_TARGET, params,
-					  slices[j].size, uuid, j+1);
+					  slices[j].size, uuid, j+1,
+					  buf.st_mode & 0777, buf.st_uid,
+					  buf.st_gid);
 
 				if (op == DM_DEVICE_RELOAD)
 					dm_simplecmd(DM_DEVICE_RESUME,
--- multipath-tools/libmultipath/config.c	2008/01/25 22:30:00	1.17.2.2
+++ multipath-tools/libmultipath/config.c	2008/04/14 22:32:04	1.17.2.3
@@ -407,6 +407,7 @@
 	conf->dev_type = DEV_NONE;
 	conf->rr_min_io = DEFAULT_RR_MIN_IO;
 	conf->max_fds = 0;
+	conf->attribute_flags = 0;
 	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
--- multipath-tools/libmultipath/config.h	2008/01/25 22:30:00	1.17.2.2
+++ multipath-tools/libmultipath/config.h	2008/04/14 22:32:04	1.17.2.3
@@ -1,6 +1,8 @@
 #ifndef _CONFIG_H
 #define _CONFIG_H
 
+#include <sys/types.h>
+
 #ifndef _VECTOR_H
 #include "vector.h"
 #endif
@@ -41,6 +43,10 @@
 	int rr_weight;
 	int no_path_retry;
 	int pg_timeout;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
 
 	char * wwid;
 	char * selector;
@@ -68,6 +74,10 @@
 	int user_friendly_names;
 	int pg_timeout;
 	int max_fds;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
 
 	char * dev;
 	char * udev_dir;
--- multipath-tools/libmultipath/devmapper.c	2007/07/31 22:19:56	1.18.2.1
+++ multipath-tools/libmultipath/devmapper.c	2008/04/14 22:32:04	1.18.2.2
@@ -111,40 +111,48 @@
 }
 
 extern int
-dm_addmap (int task, const char *name, const char *target,
-	   const char *params, unsigned long long size, const char *uuid) {
+dm_addmap (int task, const char *target, struct multipath *mpp, int use_wwid) {
 	int r = 0;
 	struct dm_task *dmt;
-	char *prefixed_uuid = NULL;
+	char *prefixed_wwid = NULL;
 
 	if (!(dmt = dm_task_create (task)))
 		return 0;
 
-	if (!dm_task_set_name (dmt, name))
+	if (!dm_task_set_name (dmt, mpp->alias))
 		goto addout;
 
-	if (!dm_task_add_target (dmt, 0, size, target, params))
+	if (!dm_task_add_target (dmt, 0, mpp->size, target, mpp->params))
 		goto addout;
 
-	if (uuid) {
-		prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(uuid) + 1);
-		if (!prefixed_uuid) {
+	if (use_wwid && mpp->wwid) {
+		prefixed_wwid = MALLOC(UUID_PREFIX_LEN + strlen(mpp->wwid) + 1);
+		if (!prefixed_wwid) {
 			condlog(0, "cannot create prefixed uuid : %s\n",
 				strerror(errno));
 			goto addout;
 		}
-		sprintf(prefixed_uuid, UUID_PREFIX "%s", uuid);
-		if (!dm_task_set_uuid(dmt, prefixed_uuid)) 
+		sprintf(prefixed_wwid, UUID_PREFIX "%s", mpp->wwid);
+		if (!dm_task_set_uuid(dmt, prefixed_wwid)) 
 			goto freeout;
 	}
 
+	if (mpp->attribute_flags & (1 << ATTR_MODE) &&
+	    !dm_task_set_mode(dmt, mpp->mode))
+		goto freeout;
+	if (mpp->attribute_flags & (1 << ATTR_UID) &&
+	    !dm_task_set_uid(dmt, mpp->uid))
+		goto freeout;
+	if (mpp->attribute_flags & (1 << ATTR_GID) &&
+	    !dm_task_set_gid(dmt, mpp->gid))
+		goto freeout;
 	dm_task_no_open_count(dmt);
 
 	r = dm_task_run (dmt);
 
 	freeout:
-	if (prefixed_uuid)
-		free(prefixed_uuid);
+	if (prefixed_wwid)
+		free(prefixed_wwid);
 
 	addout:
 	dm_task_destroy (dmt);
--- multipath-tools/libmultipath/devmapper.h	2005/11/04 23:35:28	1.10
+++ multipath-tools/libmultipath/devmapper.h	2008/04/14 22:32:04	1.10.2.1
@@ -2,8 +2,7 @@
 void dm_restore_log(void);
 int dm_prereq (char *, int, int, int);
 int dm_simplecmd (int, const char *);
-int dm_addmap (int, const char *, const char *, const char *,
-	       unsigned long long, const char *uuid);
+int dm_addmap (int, const char *, struct multipath *mpp, int use_wwid);
 int dm_map_present (char *);
 int dm_get_map(char *, unsigned long long *, char *);
 int dm_get_status(char *, char *);
--- multipath-tools/libmultipath/dict.c	2008/01/25 22:30:00	1.16.2.3
+++ multipath-tools/libmultipath/dict.c	2008/04/14 22:32:04	1.16.2.4
@@ -4,6 +4,9 @@
  * Copyright (c) 2005 Benjamin Marzinski, Redhat
  * Copyright (c) 2005 Kiyoshi Ueda, NEC
  */
+#include <sys/types.h>
+#include <pwd.h>
+
 #include "vector.h"
 #include "hwtable.h"
 #include "structs.h"
@@ -160,6 +163,79 @@
 }
 
 static int
+def_mode_handler(vector strvec)
+{
+	mode_t mode;
+	char *buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (sscanf(buff, "%o", &mode) == 1 && mode <= 0777){
+		conf->attribute_flags |= (1 << ATTR_MODE);
+		conf->mode = mode;
+	}
+
+	FREE(buff);
+	return 0;
+}
+
+static int
+def_uid_handler(vector strvec)
+{
+	uid_t uid;
+	char *buff;
+	/*
+	char passwd_buf[1024];
+	struct passwd info, *found;
+	*/
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+	/* Can't do this for statically linked binaries, because libnss
+	   must be dynamically loaded.  When we can use dynamically link
+	   binaries in the initramfs, we can put this back */
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+		conf->attribute_flags |= (1 << ATTR_UID);
+		conf->uid = info.pw_uid;
+	}
+	else */if (sscanf(buff, "%u", &uid) == 1){
+		conf->attribute_flags |= (1 << ATTR_UID);
+		conf->uid = uid;
+	}
+	FREE(buff);
+	return 0;
+}
+
+static int
+def_gid_handler(vector strvec)
+{
+	gid_t gid;
+	char *buff;
+	/*
+	char passwd_buf[1024];
+	struct passwd info, *found;
+	*/
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+		conf->attribute_flags |= (1 << ATTR_GID);
+		conf->gid = info.pw_gid;
+	}
+	else */if (sscanf(buff, "%u", &gid) == 1){
+		conf->attribute_flags |= (1 << ATTR_GID);
+		conf->gid = gid;
+	}
+	FREE(buff);
+	return 0;
+}
+
+static int
 def_weight_handler(vector strvec)
 {
 	char * buff;
@@ -781,6 +857,88 @@
 }
 
 static int
+mp_mode_handler(vector strvec)
+{
+	mode_t mode;
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+	char *buff;
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+	if (sscanf(buff, "%o", &mode) == 1 && mode <= 0777){
+		mpe->attribute_flags |= (1 << ATTR_MODE);
+		mpe->mode = mode;
+	}
+
+	FREE(buff);
+	return 0;
+}
+
+static int
+mp_uid_handler(vector strvec)
+{
+	uid_t uid;
+	char *buff;
+	/*
+	char passwd_buf[1024];
+	struct passwd info, *found;
+	*/
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+		mpe->attribute_flags |= (1 << ATTR_UID);
+		mpe->uid = info.pw_uid;
+	}
+	else */if (sscanf(buff, "%u", &uid) == 1){
+		mpe->attribute_flags |= (1 << ATTR_UID);
+		mpe->uid = uid;
+	}
+	FREE(buff);
+	return 0;
+}
+
+static int
+mp_gid_handler(vector strvec)
+{
+	gid_t gid;
+	char *buff;
+	/*
+	char passwd_buf[1024];
+	struct passwd info, *found;
+	*/
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+
+	if (!mpe)
+		return 1;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	/*if (getpwnam_r(buff, &info, passwd_buf, 1024, &found) == 0 && found) {
+		mpe->attribute_flags |= (1 << ATTR_GID);
+		mpe->gid = info.pw_gid;
+	}
+	else */if (sscanf(buff, "%u", &gid) == 1){
+		mpe->attribute_flags |= (1 << ATTR_GID);
+		mpe->gid = gid;
+	}
+	FREE(buff);
+	return 0;
+}
+
+static int
 mp_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -832,6 +990,9 @@
 	install_keyword("pg_timeout", &default_pg_timeout_handler);
 	install_keyword("user_friendly_names", &names_handler);
 	install_keyword("bindings_file", &bindings_file_handler);
+	install_keyword("mode", &def_mode_handler);
+	install_keyword("uid", &def_uid_handler);
+	install_keyword("gid", &def_gid_handler);
 
 	/*
 	 * deprecated synonyms
@@ -877,6 +1038,9 @@
 	install_keyword("rr_weight", &mp_weight_handler);
 	install_keyword("no_path_retry", &mp_no_path_retry_handler);
 	install_keyword("pg_timeout", &mp_pg_timeout_handler);
+	install_keyword("mode",	&mp_mode_handler);
+	install_keyword("uid", &mp_uid_handler);
+	install_keyword("gid", &mp_gid_handler);
 	install_sublevel_end();
 
 	return keywords;
--- multipath-tools/libmultipath/propsel.c	2006/12/01 23:45:18	1.9.2.1
+++ multipath-tools/libmultipath/propsel.c	2008/04/14 22:32:04	1.9.2.2
@@ -173,6 +173,60 @@
 }
 
 extern int
+select_mode (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_MODE))) {
+		mp->attribute_flags |= (1 << ATTR_MODE);
+		mp->mode = mp->mpe->mode;
+		condlog(3, "mode = 0%o (multipath setting)", mp->mode);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_MODE)) {
+		mp->attribute_flags |= (1 << ATTR_MODE);
+		mp->mode = conf->mode;
+		condlog(3, "mode = 0%o (config file default)", mp->mode);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_MODE);
+	return 0;
+}
+
+extern int
+select_uid (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_UID))) {
+		mp->attribute_flags |= (1 << ATTR_UID);
+		mp->uid = mp->mpe->uid;
+		condlog(3, "uid = %u (multipath setting)", mp->uid);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_UID)) {
+		mp->attribute_flags |= (1 << ATTR_UID);
+		mp->uid = conf->uid;
+		condlog(3, "uid = %u (config file default)", mp->uid);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_UID);
+	return 0;
+}
+
+extern int
+select_gid (struct multipath *mp)
+{
+	if (mp->mpe && (mp->mpe->attribute_flags & (1 << ATTR_GID))) {
+		mp->attribute_flags |= (1 << ATTR_GID);
+		mp->gid = mp->mpe->gid;
+		condlog(3, "gid = %u (multipath setting)", mp->gid);
+	}
+	else if (conf->attribute_flags & (1 << ATTR_GID)) {
+		mp->attribute_flags |= (1 << ATTR_GID);
+		mp->gid = conf->gid;
+		condlog(3, "gid = %u (config file default)", mp->gid);
+	}
+	else
+		mp->attribute_flags &= ~(1 << ATTR_GID);
+	return 0;
+}
+
+extern int
 select_features (struct multipath * mp)
 {
 	if (mp->hwe && mp->hwe->features) {
--- multipath-tools/libmultipath/propsel.h	2006/12/01 23:45:18	1.4.2.1
+++ multipath-tools/libmultipath/propsel.h	2008/04/14 22:32:04	1.4.2.2
@@ -11,3 +11,6 @@
 int select_no_path_retry(struct multipath *mp);
 int select_pg_timeout(struct multipath *mp);
 int select_rr_min_io(struct multipath *mp);
+int select_mode(struct multipath *mp);
+int select_uid(struct multipath *mp);
+int select_gid(struct multipath *mp);
--- multipath-tools/libmultipath/structs.h	2008/01/25 22:30:00	1.17.2.6
+++ multipath-tools/libmultipath/structs.h	2008/04/14 22:32:04	1.17.2.7
@@ -1,6 +1,8 @@
 #ifndef _STRUCTS_H
 #define _STRUCTS_H
 
+#include <sys/types.h>
+
 #define WWID_SIZE		128
 #define SERIAL_SIZE		64
 #define NODE_NAME_SIZE		19
@@ -63,6 +65,12 @@
 	PGTIMEOUT_NONE
 };
 
+enum attribute_bits {
+	ATTR_UID,
+	ATTR_GID,
+	ATTR_MODE,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -133,6 +141,11 @@
 	int no_path_retry; /* number of retries after all paths are down */
 	int retry_tick;    /* remaining times for retries */
 	int pg_timeout;
+	int attribute_flags;
+	uid_t uid;
+	gid_t gid;
+	mode_t mode;
+
 	unsigned long long size;
 	vector paths;
 	vector pg;
--- multipath-tools/multipath/main.c	2007/12/17 23:15:22	1.41.2.6
+++ multipath-tools/multipath/main.c	2008/04/14 22:32:04	1.41.2.7
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.41.2.6 2007/12/17 23:15:22 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.41.2.7 2008/04/14 22:32:04 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -33,7 +33,6 @@
 #include <vector.h>
 #include <memory.h>
 #include <libdevmapper.h>
-#include <devmapper.h>
 #include <checkers.h>
 #include <path_state.h>
 #include <blacklist.h>
@@ -51,6 +50,7 @@
 #include <sysfs/libsysfs.h>
 #include <print.h>
 #include <alias.h>
+#include <devmapper.h>
 
 #include "main.h"
 #include "pgpolicies.h"
@@ -669,8 +669,7 @@
 		if (dm_map_present(mpp->alias))
 			break;
 
-		r = dm_addmap(DM_DEVICE_CREATE, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, mpp->wwid);
+		r = dm_addmap(DM_DEVICE_CREATE, DEFAULT_TARGET, mpp, 1);
 
 		/*
 		 * DM_DEVICE_CREATE is actually DM_DEV_CREATE plus
@@ -689,8 +688,7 @@
 		break;
 
 	case ACT_RELOAD:
-		r = (dm_addmap(DM_DEVICE_RELOAD, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, NULL) &&
+		r = (dm_addmap(DM_DEVICE_RELOAD, DEFAULT_TARGET, mpp, 0) &&
 		     dm_simplecmd(DM_DEVICE_RESUME, mpp->alias));
 		break;
 
@@ -774,6 +772,9 @@
 		mpp->hwe = pp1->hwe;
 		strcpy(mpp->wwid, pp1->wwid);
 		select_alias(mpp);
+		select_mode(mpp);
+		select_uid(mpp);
+		select_gid(mpp);
 
 		pp1->mpp = mpp;
 		mpp->size = pp1->size;

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-01-25 22:30 wysochanski
  0 siblings, 0 replies; 15+ messages in thread
From: wysochanski @ 2008-01-25 22:30 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	wysochanski@sourceware.org	2008-01-25 22:30:00

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : config.c config.h dict.c discovery.c structs.h 
	multipathd     : main.c 

Log message:
	Fix for bz #217130. Add max_fds config parameter to fix multipathd problems with large number of paths

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.3&r2=1.16.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.10&r2=1.10.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.1&r2=1.17.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.1&r2=1.17.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.2&r2=1.16.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.28.2.4&r2=1.28.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.5&r2=1.17.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.66.2.2&r2=1.66.2.3

--- multipath-tools/multipath.conf.annotated	2007/12/03 18:42:15	1.16.2.3
+++ multipath-tools/multipath.conf.annotated	2008/01/25 22:30:00	1.16.2.4
@@ -109,6 +109,16 @@
 #	rr_min_io	100
 #
 #	#
+#	# name    : max_fds
+#	# scope   : multipathd
+#	# desc    : Sets the maximum number of open file descriptors for the
+#	#           multipathd process.
+#	# values  : unlimited|n > 0
+#	# default : None
+#	#
+#	max_fds		8192
+#
+#	#
 #	# name    : rr_weight
 #	# scope   : multipath
 #	# desc    : if set to priorities the multipath configurator will assign
--- multipath-tools/multipath.conf.synthetic	2005/11/21 23:28:31	1.10
+++ multipath-tools/multipath.conf.synthetic	2008/01/25 22:30:00	1.10.2.1
@@ -11,6 +11,7 @@
 #	prio_callout		/bin/true
 #	path_checker		readsector0
 #	rr_min_io		100
+#	max_fds			8192
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
--- multipath-tools/libmultipath/config.c	2006/12/01 23:45:18	1.17.2.1
+++ multipath-tools/libmultipath/config.c	2008/01/25 22:30:00	1.17.2.2
@@ -406,6 +406,7 @@
 
 	conf->dev_type = DEV_NONE;
 	conf->rr_min_io = DEFAULT_RR_MIN_IO;
+	conf->max_fds = 0;
 	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
--- multipath-tools/libmultipath/config.h	2006/12/01 23:45:18	1.17.2.1
+++ multipath-tools/libmultipath/config.h	2008/01/25 22:30:00	1.17.2.2
@@ -67,6 +67,7 @@
 	int no_path_retry;
 	int user_friendly_names;
 	int pg_timeout;
+	int max_fds;
 
 	char * dev;
 	char * udev_dir;
--- multipath-tools/libmultipath/dict.c	2007/10/11 20:17:17	1.16.2.2
+++ multipath-tools/libmultipath/dict.c	2008/01/25 22:30:00	1.16.2.3
@@ -140,6 +140,26 @@
 }
 
 static int
+max_fds_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	if (strlen(buff) == 9 &&
+	    !strcmp(buff, "unlimited"))
+		conf->max_fds = MAX_FDS_UNLIMITED;
+	else
+		conf->max_fds = atoi(buff);
+	FREE(buff);
+
+	return 0;
+}
+
+static int
 def_weight_handler(vector strvec)
 {
 	char * buff;
@@ -806,6 +826,7 @@
 	install_keyword("path_checker", &def_path_checker_handler);
 	install_keyword("failback", &default_failback_handler);
 	install_keyword("rr_min_io", &def_rr_min_io_handler);
+	install_keyword("max_fds", &max_fds_handler);
 	install_keyword("rr_weight", &def_weight_handler);
 	install_keyword("no_path_retry", &def_no_path_retry_handler);
 	install_keyword("pg_timeout", &default_pg_timeout_handler);
--- multipath-tools/libmultipath/discovery.c	2007/07/24 20:35:24	1.28.2.4
+++ multipath-tools/libmultipath/discovery.c	2008/01/25 22:30:00	1.28.2.5
@@ -749,6 +749,10 @@
 		condlog(3, "serial = %s", pp->serial);
 	}
 
+#ifndef DAEMON
+	close(pp->fd);
+	pp->fd = -1;
+#endif
 	return 0;
 }
 
@@ -844,5 +848,11 @@
 	 */
 	memset(pp->wwid, 0, WWID_SIZE);
 	pp->state = PATH_DOWN;
+#ifndef DAEMON
+	if (pp->fd > 0){
+		close(pp->fd);
+		pp->fd = -1;
+	}
+#endif
 	return 0;
 }
--- multipath-tools/libmultipath/structs.h	2007/07/24 20:35:24	1.17.2.5
+++ multipath-tools/libmultipath/structs.h	2008/01/25 22:30:00	1.17.2.6
@@ -18,6 +18,8 @@
 #define NO_PATH_RETRY_FAIL	-1
 #define NO_PATH_RETRY_QUEUE	-2
 
+#define MAX_FDS_UNLIMITED	-1
+
 enum free_path_switch {
 	KEEP_PATHS,
 	FREE_PATHS
--- multipath-tools/multipathd/main.c	2007/04/26 17:47:01	1.66.2.2
+++ multipath-tools/multipathd/main.c	2008/01/25 22:30:00	1.66.2.3
@@ -12,6 +12,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
 
 /*
  * libsysfs
@@ -1602,6 +1604,21 @@
 		conf->max_checkint = MAX_CHECKINT;
 	}
 
+	if (conf->max_fds) {
+		struct rlimit fd_limit;
+		if (conf->max_fds > 0) {
+			fd_limit.rlim_cur = conf->max_fds;
+			fd_limit.rlim_max = conf->max_fds;
+		}
+		else {
+			fd_limit.rlim_cur = RLIM_INFINITY;
+			fd_limit.rlim_max = RLIM_INFINITY;
+		}
+		if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
+			condlog(0, "can't set open fds limit to %d : %s\n",
+				conf->max_fds, strerror(errno));
+	}
+
 	if (pidfile_create(DEFAULT_PIDFILE, getpid())) {
 		if (logsink)
 			log_thread_stop();

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2008-01-15  1:34 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2008-01-15  1:34 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2008-01-15 01:34:36

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : config.c config.h dict.c discovery.c structs.h 
	multipath      : multipath.conf.redhat 
	multipathd     : main.c 

Log message:
	Fix for bz 251346. Added a max_fds paramter to /etc/multipath.conf. This allows
	you to set the maximum number of open fds that multipathd can use, like with
	ulimit -n.  Also added some code so that multipath closes the file descriptor
	after it's used by the checker function, since multipath doesn't need to keep
	them always open like multipathd does.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.4&r2=1.18.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.2&r2=1.11.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.4&r2=1.19.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.2&r2=1.18.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.3&r2=1.17.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.32.2.5&r2=1.32.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.1&r2=1.18.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.redhat.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6.2.6&r2=1.6.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.4&r2=1.69.2.5

--- multipath-tools/multipath.conf.annotated	2008/01/14 23:49:34	1.18.2.4
+++ multipath-tools/multipath.conf.annotated	2008/01/15 01:34:36	1.18.2.5
@@ -80,6 +80,16 @@
 #	rr_min_io	100
 #
 #	#
+#	# name    : max_fds
+#	# scope   : multipathd
+#	# desc    : Sets the maximum number of open file descriptors for the
+#	#           multipathd process.
+#	# values  : unlimited|n > 0
+#	# default : None
+#	#
+#	max_fds		8192
+#
+#	#
 #	# name    : rr_weight
 #	# scope   : multipath
 #	# desc    : if set to priorities the multipath configurator will assign
--- multipath-tools/multipath.conf.synthetic	2007/06/19 18:12:15	1.11.2.2
+++ multipath-tools/multipath.conf.synthetic	2008/01/15 01:34:36	1.11.2.3
@@ -11,6 +11,7 @@
 #	prio_callout		/bin/true
 #	path_checker		readsector0
 #	rr_min_io		100
+#	max_fds			8192
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
--- multipath-tools/libmultipath/config.c	2007/12/15 00:27:39	1.19.2.4
+++ multipath-tools/libmultipath/config.c	2008/01/15 01:34:36	1.19.2.5
@@ -411,6 +411,7 @@
 
 	conf->dev_type = DEV_NONE;
 	conf->minio = 1000;
+	conf->max_fds = 0;
 
 	/*
 	 * read the config file
--- multipath-tools/libmultipath/config.h	2007/12/15 00:27:39	1.18.2.2
+++ multipath-tools/libmultipath/config.h	2008/01/15 01:34:36	1.18.2.3
@@ -63,6 +63,7 @@
 	int no_path_retry;
 	int user_friendly_names;
 	int pg_timeout;
+	int max_fds;
 
 	char * dev;
 	char * udev_dir;
--- multipath-tools/libmultipath/dict.c	2007/12/15 00:27:39	1.17.2.3
+++ multipath-tools/libmultipath/dict.c	2008/01/15 01:34:36	1.17.2.4
@@ -143,6 +143,26 @@
 }
 
 static int
+max_fds_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	if (strlen(buff) == 9 &&
+	    !strcmp(buff, "unlimited"))
+		conf->max_fds = MAX_FDS_UNLIMITED;
+	else
+		conf->max_fds = atoi(buff);
+	FREE(buff);
+
+	return 0;
+}
+
+static int
 def_weight_handler(vector strvec)
 {
 	char * buff;
@@ -1441,6 +1461,17 @@
 }
 
 static int
+snprint_max_fds (char * buff, int len, void * data)
+{
+	if (!conf->max_fds)
+		return 0;
+
+	if (conf->max_fds < 0)
+		return snprintf(buff, len, "unlimited");	
+	return snprintf(buff, len, "%d", conf->max_fds);
+}
+
+static int
 snprint_def_rr_weight (char * buff, int len, void * data)
 {
 	if (!conf->rr_weight)
@@ -1553,6 +1584,7 @@
 	install_keyword("path_checker", &def_path_checker_handler, &snprint_def_path_checker);
 	install_keyword("failback", &default_failback_handler, &snprint_def_failback);
 	install_keyword("rr_min_io", &def_minio_handler, &snprint_def_rr_min_io);
+	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight);
 	install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
 	install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
--- multipath-tools/libmultipath/discovery.c	2007/06/18 17:37:18	1.32.2.5
+++ multipath-tools/libmultipath/discovery.c	2008/01/15 01:34:36	1.32.2.6
@@ -820,6 +820,10 @@
 	if (mask & DI_WWID && !strlen(pp->wwid))
 		get_uid(pp);
 
+#ifndef DAEMON
+	close(pp->fd);
+	pp->fd = -1;
+#endif
 	return 0;
 
 blank:
@@ -828,5 +832,11 @@
 	 */
 	memset(pp->wwid, 0, WWID_SIZE);
 	pp->state = PATH_DOWN;
+#ifndef DAEMON
+	if (pp->fd > 0){
+		close(pp->fd);
+		pp->fd = -1;
+	}
+#endif
 	return 0;
 }
--- multipath-tools/libmultipath/structs.h	2007/06/18 17:37:18	1.18.2.1
+++ multipath-tools/libmultipath/structs.h	2008/01/15 01:34:36	1.18.2.2
@@ -18,6 +18,8 @@
 #define NO_PATH_RETRY_FAIL	-1
 #define NO_PATH_RETRY_QUEUE	-2
 
+#define MAX_FDS_UNLIMITED	-1
+
 enum free_path_switch {
 	KEEP_PATHS,
 	FREE_PATHS
--- multipath-tools/multipath/multipath.conf.redhat	2008/01/02 19:06:12	1.6.2.6
+++ multipath-tools/multipath/multipath.conf.redhat	2008/01/15 01:34:36	1.6.2.7
@@ -39,6 +39,7 @@
 #	prio_callout		/bin/true
 #	path_checker		readsector0
 #	rr_min_io		100
+#	max_fds			8192
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
--- multipath-tools/multipathd/main.c	2007/12/17 22:27:38	1.69.2.4
+++ multipath-tools/multipathd/main.c	2008/01/15 01:34:36	1.69.2.5
@@ -13,6 +13,8 @@
 #include <sys/mount.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
 
 /*
  * libsysfs
@@ -1451,6 +1453,21 @@
 		conf->max_checkint = MAX_CHECKINT(conf->checkint);
 	}
 
+	if (conf->max_fds) {
+		struct rlimit fd_limit;
+		if (conf->max_fds > 0) {
+			fd_limit.rlim_cur = conf->max_fds;
+			fd_limit.rlim_max = conf->max_fds;
+		}
+		else {
+			fd_limit.rlim_cur = RLIM_INFINITY;
+			fd_limit.rlim_max = RLIM_INFINITY;
+		}
+		if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
+			condlog(0, "can't set open fds limit to %d : %s\n",
+				conf->max_fds, strerror(errno));
+	}
+
 	if (pidfile_create(DEFAULT_PIDFILE, getpid())) {
 		if (logsink)
 			log_thread_stop();

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-12-03 18:42 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-12-03 18:42 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-03 18:42:15

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	libmultipath   : hwtable.c 

Log message:
	Fix for bz #304481. Update hardware table with latest HP StorageWorks
	parameters for RHEL4.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.2&r2=1.16.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.5.2.8&r2=1.5.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.12&r2=1.16.2.13

--- multipath-tools/multipath.conf.annotated	2007/10/19 21:41:56	1.16.2.2
+++ multipath-tools/multipath.conf.annotated	2007/12/03 18:42:15	1.16.2.3
@@ -11,7 +11,7 @@
 #	#
 #	# name    : udev_dir
 #	# desc    : directory where udev creates its device nodes
-#	# default : /udev
+#	# default : /dev
 #	#
 #	udev_dir	/dev
 #
@@ -67,7 +67,17 @@
 #	#           exploitable prio value for example. "none" is a valid value
 #	# default : (null)
 #	#
-#	#prio_callout	"/bin/true"
+#	prio_callout	"/bin/true"
+#
+#	#
+#	# name    : features
+#	# scope   : multipath
+#	# desc    : The default extra features of multipath devices. The
+#	#           only existing feature currently is queue_if_no_path.
+#	# values  : "1 queue_if_no_path"
+#	# default : (null)
+#	#
+#	features	"1 queue_if_no_path"
 #
 #	#
 #	# name    : path_checker
@@ -79,6 +89,17 @@
 #	path_checker	readsector0
 #
 #	#
+#	# name    : failback
+#	# scope   : multipathd
+#	# desc    : tell the daemon to manage path group failback, or not to.
+#	#	    0 means immediate failback, values >0 means deffered
+#	#	    failback expressed in seconds.
+#	# values  : manual|immediate|n > 0
+#	# default : immediate
+#	#
+#	failback	manual
+#
+#	#
 #	# name    : rr_min_io
 #	# scope   : multipath
 #	# desc    : the number of IO to route to a path before switching
@@ -98,17 +119,6 @@
 #	rr_weight	priorities
 #
 #	#
-#	# name    : failback
-#	# scope   : multipathd
-#	# desc    : tell the daemon to manage path group failback, or not to.
-#	#	    0 means immediate failback, values >0 means deffered
-#	#	    failback expressed in seconds.
-#	# values  : manual|immediate|n > 0
-#	# default : immediate
-#	#
-#	failback	manual
-#
-#	#
 #	# name    : no_path_retry
 #	# scope   : multipath & multipathd
 #	# desc    : tell the number of retries until disable queueing, or
@@ -197,17 +207,14 @@
 #		#				 priority value
 #		#	    group_by_node_name = 1 priority group per target
 #		#				 node name
-#		# default : failover
 #		#
 #		path_grouping_policy	multibus
 #
 #		#
-#		#
 #		# name    : path_selector
 #		# desc    : the path selector algorithm to use for this mpath
 #		#           these algo are offered by the kernel mpath target
 #		# values  : "round-robin 0"
-#		# default : "round-robin 0"
 #		#
 #		path_selector		"round-robin 0"
 #
@@ -218,7 +225,6 @@
 #		#	    not to. 0 means immediate failback, values >0 means
 #		#	    deffered failback expressed in seconds.
 #		# values  : manual|immediate|n > 0
-#		# default : immediate
 #		#
 #		failback		manual
 #
@@ -228,7 +234,6 @@
 #		# desc    : if set to priorities the multipath configurator will
 #		#	    assign path weights as "path prio * rr_min_io"
 #		# values  : priorities|uniform
-#		# default : uniform
 #		#
 #		rr_weight	priorities
 #
@@ -239,7 +244,6 @@
 #		#           or "fail" means immediate failure (no queueing),
 #		#           "queue" means never stop queueing
 #		# values  : queue|fail|n (>0)
-#		# default : (null)
 #		#
 #		no_path_retry  queue
 #	}
@@ -253,7 +257,7 @@
 ##
 ## name  : devices
 ## scope : multipath & multipathd
-## desc  : list of per storage controler settings
+## desc  : list of per storage controller settings
 ##	  overrides default settings (device_maps block)
 ##         overriden by per multipath settings (multipaths block)
 ##
@@ -261,7 +265,7 @@
 #	#
 #	# name  : device
 #	# scope : multipath & multipathd
-#	# desc  : settings for this specific storage controler
+#	# desc  : settings for this specific storage controller
 #	#
 #	device {
 #		#
@@ -280,14 +284,13 @@
 #		#	    blacklisted, the vendor, product, and bl_product
 #		#	    strings must all match, not just the vendor and
 #		#	    bl_product strings as in the upstream version.
-#		# default : (null)
 #		bl_product		"LUN_Z"
 #
 #		#
 #		# name    : path_grouping_policy
 #		# scope   : multipath
 #		# desc    : path grouping policy to apply to multipath hosted
-#		#           by this storage controler
+#		#           by this storage controller
 #		# values  : failover           = 1 path per priority group
 #		#           multibus           = all valid paths in 1 priority
 #		#				 group
@@ -297,7 +300,6 @@
 #		#				 priority value
 #		#	    group_by_node_name = 1 priority group per target
 #		#				 node name
-#		# default : failover
 #		#
 #		path_grouping_policy	multibus
 #
@@ -306,49 +308,33 @@
 #		# scope   : multipath
 #		# desc    : the program and args to callout to obtain a unique 
 #		#           path identifier. Absolute path required
-#		# default : /sbin/scsi_id -g -u -s
 #		#
 #		getuid_callout          "/sbin/scsi_id -g -u -s /block/%n"
 #
 #		#
-#		# name    : prio_callout
-#		# scope   : multipath
-#		# desc    : the program and args to callout to obtain a path 
-#		#           weight. Weights are summed for each path group to
-#		#	    determine the next PG to use case of failure.
-#		#	    "none" is a valid value.
-#		# default : no callout, all paths equals
+#		# name    : path_selector
+#		# desc    : the path selector algorithm to use for this mpath
+#		#           these algo are offered by the kernel mpath target
+#		# values  : "round-robin 0"
 #		#
-#		prio_callout          "/sbin/mpath_prio_balance_units %d"
+#		path_selector		"round-robin 0"
 #
 #		#
 #		# name    : path_checker
 #		# scope   : multipathd
 #		# desc    : path checking alorithm to use to check path state
-#		# values  : readsector0, tur
-#		# default : readsector0
+#		# values  : readsector0|tur|emc_clariion|hp_sw|directio
 #		#
 #		path_checker		readsector0
 #
 #		#
-#		# name    : path_selector
-#		# desc    : the path selector algorithm to use for this mpath
-#		#           these algo are offered by the kernel mpath target
-#		# values  : "round-robin 0"
-#		# default : "round-robin 0"
-#		#
-#		path_selector		"round-robin 0"
-#
-#		#
-#		# name    : failback
-#		# scope   : multipathd
-#		# desc    : tell the daemon to manage path group failback, or
-#		#	    not to. 0 means immediate failback, values >0 means
-#		#	    deffered failback expressed in seconds.
-#		# values  : manual|immediate|n > 0
-#		# default : immediate
+#		# name    : features
+#		# scope   : multipath
+#		# desc    : The default extra features of multipath devices. The
+#		#           only existing feature currently is queue_if_no_path.
+#		# values  : "1 queue_if_no_path"
 #		#
-#		failback		30
+#		features	"1 queue_if_no_path"
 #
 #		#
 #		# name    : hardware_handler
@@ -357,17 +343,35 @@
 #		#           perform hardware specific actions when switching
 #		#	    path groups or handling IO errors
 #		# values  : "0"|"1 emc"
-#		# default : "0"
 #		#
 #		hardware_handler "1 emc"
 #
 #		#
+#		# name    : prio_callout
+#		# scope   : multipath
+#		# desc    : the program and args to callout to obtain a path 
+#		#           weight. Weights are summed for each path group to
+#		#	    determine the next PG to use case of failure.
+#		#	    "none" is a valid value.
+#		#
+#		prio_callout          "/sbin/mpath_prio_balance_units %d"
+#
+#		#
+#		# name    : failback
+#		# scope   : multipathd
+#		# desc    : tell the daemon to manage path group failback, or
+#		#	    not to. 0 means immediate failback, values >0 means
+#		#	    deffered failback expressed in seconds.
+#		# values  : manual|immediate|n > 0
+#		#
+#		failback		30
+#
+#		#
 #		# name    : rr_weight
 #		# scope   : multipath
 #		# desc    : if set to priorities the multipath configurator will
 #		#	    assign path weights as "path prio * rr_min_io"
 #		# values  : priorities|uniform
-#		# default : uniform
 #		#
 #		rr_weight	priorities
 #
@@ -378,7 +382,6 @@
 #		#           or "fail" means immediate failure (no queueing),
 #		#           "queue" means never stop queueing
 #		# values  : queue|fail|n (>0)
-#		# default : (null)
 #		#
 #		no_path_retry  queue
 #	}
--- multipath-tools/multipath.conf.defaults	2007/10/19 21:41:56	1.5.2.8
+++ multipath-tools/multipath.conf.defaults	2007/12/03 18:42:15	1.5.2.9
@@ -20,6 +20,7 @@
 #devnode_blacklist {
 #       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #       devnode "^hd[a-z]"
+#       devnode "^cciss!c[0-9]d[0-9]*"
 #}
 #
 #devices {
@@ -35,59 +36,47 @@
 #               path_grouping_policy    multibus
 #		getuid_callout		"/sbin/scsi_id -g -u -s"
 #	}
+#	device {
+#		vendor			"HP"
+#		product			"MSA2000s*"
+#		getuid_callout		"/sbin/cciss_id %n"
+#		path_grouping_policy	multibus
+#		path_checker		cciss_tur
+#               no_path_retry           12
+#	}
 #       device {
-#               vendor                  "COMPAQ"
-#               product                 "HSV110 \(C\)COMPAQ"
-#               path_grouping_policy    group_by_serial
-#               getuid_callout          "/sbin/scsi_id -g -u -s"
-#       }
-#       device {
-#               vendor                  "COMPAQ"
-#               product                 "HSV111 \(C\)COMPAQ"
+#               vendor                  "(COMPAQ|HP)"
+#               product                 "HSV(1|2).*"
 #               path_grouping_policy    group_by_prio
 #               prio_callout            "/sbin/mpath_prio_alua %d"      
 #               path_checker            tur
 #		failback		immediate
-#               no_path_retry           60 
+#               no_path_retry           12
 #		rr_min_io		100
-#       }
+#        }
 #       device {
-#               vendor                  "HP"
-#               product                 "HSV2[10]0"
-#               path_grouping_policy    group_by_prio
-#               prio_callout            "/sbin/mpath_prio_alua %d"      
-#               path_checker            tur
+#		vendor			"(HITACHI|HP)"
+#		product			"OPEN-.*"
+#		path_grouping_policy	multibus
+#		path_checker		tur
 #		failback		immediate
-#               no_path_retry           60 
+#               no_path_retry           12
 #		rr_min_io		100
-#        }
-#       device {
-#                vendor                 "{HITACHI|HP}"
-#                product                "OPEN-.*"
-#                path_grouping_policy   multibus
-#                path_checker           tur
-#        }
+#	}
 #       device {
 #                vendor                 "HP"
 #                product                "*33[89]0*"
 #                path_grouping_policy   multibus
 #                path_checker           tur
-#        }
-#      device {
+#	}
+#	device {
 #               vendor                  "HP"
 #               product                 "MSA VOLUME"
 #               path_grouping_policy    group_by_prio
 #               prio_callout            "/sbin/mpath_prio_alua %d"      
 #               path_checker            tur
-#       }
-#      device {
-#               vendor                  "HP"
-#               product                 "HSV101"
-#               path_grouping_policy    group_by_prio
-#               prio_callout            "/sbin/mpath_prio_alua %n"      
-#               path_checker            tur
 #		failback		immediate
-#               no_path_retry           60 
+#               no_path_retry           12
 #		rr_min_io		100
 #       }
 #       device {
@@ -143,12 +132,6 @@
 #	}
 #       device {
 #               vendor                  "HP"
-#               product                 "HSV110"
-#               path_grouping_policy    group_by_serial
-#               getuid_callout          "/sbin/scsi_id -g -u -s"
-#       }
-#       device {
-#               vendor                  "HP"
 #               product                 "A6189A"
 #               path_grouping_policy    multibus
 #               getuid_callout          "/sbin/scsi_id -g -u -s"
--- multipath-tools/libmultipath/hwtable.c	2007/09/11 18:06:01	1.16.2.12
+++ multipath-tools/libmultipath/hwtable.c	2007/12/03 18:42:15	1.16.2.13
@@ -20,7 +20,6 @@
 	r += store_hwe(hw, "EMC", "SYMMETRIX", MULTIBUS,
 		       "/sbin/scsi_id -g -u -ppre-spc3-83 -s /block/%n");
 	r += store_hwe(hw, "FSC", "CentricStor", GROUP_BY_SERIAL, DEFAULT_GETUID);
-	r += store_hwe(hw, "HP", "HSV110", GROUP_BY_SERIAL, DEFAULT_GETUID);
 	r += store_hwe(hw, "HP", "A6189A", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "IBM", "ProFibre 4000R", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "SGI", "TP9100", MULTIBUS, DEFAULT_GETUID);
@@ -32,21 +31,20 @@
 	r + store_hwe_ext(hw, "GNBD", "GNBD", MULTIBUS,
         		  "/sbin/gnbd_import -q -U /block/%n", NULL, "0", "0",
 			  "directio", FAILBACK_UNDEF, NULL, 0, 0, 0);
-        r += store_hwe_ext(hw, "HP", "MSA VOLUME", GROUP_BY_PRIO, DEFAULT_GETUID,
-		   "/sbin/mpath_prio_alua %d", "0", "0", "tur", FAILBACK_UNDEF, NULL,
-		   0, 0, 0);
-	r += store_hwe_ext(hw, "HP", "HSV101", GROUP_BY_PRIO, DEFAULT_GETUID,
-		"/sbin/mpath_prio_alua %n", "0", "0", "tur",
-		-FAILBACK_IMMEDIATE, NULL, 60, 0, 100);
-	r += store_hwe_ext(hw, "HP", "HSV2[10]0", GROUP_BY_PRIO, DEFAULT_GETUID,
-		"/sbin/mpath_prio_alua %n", "0", "0", "tur",
-		-FAILBACK_IMMEDIATE, NULL, 60, 0, 100);
-	r += store_hwe_ext(hw, "COMPAQ", "HSV111", GROUP_BY_PRIO,
-		DEFAULT_GETUID, "/sbin/mpath_prio_alua %n", "0", "0", "tur",
-		-FAILBACK_IMMEDIATE, NULL, 60, 0, 100);
-	r += store_hwe_ext(hw, "{HITACHI,HP}", "OPEN-.*", MULTIBUS,
+        r += store_hwe_ext(hw, "HP", "MSA VOLUME", GROUP_BY_PRIO,
+	                   DEFAULT_GETUID, "/sbin/mpath_prio_alua /dev/%n",
+	                   "0", "0", "tur", -FAILBACK_IMMEDIATE, NULL, 12, 0,
+	                   100);
+	r += store_hwe_ext(hw, "(COMPAQ|HP)", "HSV(1|2).*", GROUP_BY_PRIO,
+	                   DEFAULT_GETUID, "/sbin/mpath_prio_alua /dev/%n",
+	                   "0", "0", "tur", -FAILBACK_IMMEDIATE, NULL, 12, 0,
+	                   100);
+	r += store_hwe_ext(hw, "HP", "MSA2000s*", MULTIBUS, "/sbin/cciss_id %n",
+	                   NULL, "0", "0", "cciss_tur", FAILBACK_UNDEF, NULL,
+	                   12, 0, 0);
+	r += store_hwe_ext(hw, "(HITACHI|HP)", "OPEN-.*", MULTIBUS,
 		DEFAULT_GETUID, NULL, "0", "0", "tur", -FAILBACK_IMMEDIATE,
-		NULL, 60, 0, 100);
+		NULL, 12, 0, 100);
         r += store_hwe_ext(hw, "HP", "*33[89]0*", MULTIBUS, DEFAULT_GETUID, NULL, "0", "0",
 		    "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "DGC", "*", GROUP_BY_PRIO,

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-10-19 21:41 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-10-19 21:41 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2007-10-19 21:41:56

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	kpartx         : kpartx.c 

Log message:
	clarified config files. added fix for bz 320101. kpartx now has a config file,
	/etc/kpartx.conf. This lets it choose whether to always use 'p' as the
	delimiter, or to use the default method, where 'p' is only used if the last
	character is a number.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.1&r2=1.16.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.5.2.7&r2=1.5.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/kpartx.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.7.2.1&r2=1.7.2.2

--- multipath-tools/multipath.conf.annotated	2007/10/11 20:17:17	1.16.2.1
+++ multipath-tools/multipath.conf.annotated	2007/10/19 21:41:56	1.16.2.2
@@ -144,14 +144,14 @@
 #}
 #	
 ##
-## name    : blacklist
+## name    : devnode_blacklist 
 ## scope   : multipath & multipathd
 ## desc    : list of device names to discard as not multipath candidates.
 ##           Devices can identified by either their device node name "devnode"
 ##           or their WWID "wwid".
 ## default : cciss, fd, hd, md, dm, sr, scd, st, ram, raw, loop
 ##
-#blacklist {
+#devnode_blacklist {
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z]"
--- multipath-tools/multipath.conf.defaults	2007/10/11 20:17:17	1.5.2.7
+++ multipath-tools/multipath.conf.defaults	2007/10/19 21:41:56	1.5.2.8
@@ -14,10 +14,10 @@
 #	failback		immediate
 #	no_path_retry		fail
 #	user_friendly_names	no
-#	bindings_file		/var/lib/multipath/bindings
+#	bindings_file		"/var/lib/multipath/bindings"
 #}
 #
-#blacklist {
+#devnode_blacklist {
 #       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #       devnode "^hd[a-z]"
 #}
--- multipath-tools/kpartx/kpartx.c	2006/09/19 21:06:40	1.7.2.1
+++ multipath-tools/kpartx/kpartx.c	2007/10/19 21:41:56	1.7.2.2
@@ -46,6 +46,8 @@
 #define PARTNAME_SIZE	128
 #define DELIM_SIZE	8
 
+#define DEFAULT_CONFIG_FILE "/etc/kpartx.conf"
+
 struct slice slices[MAXSLICES];
 
 enum action { LIST, ADD, DELETE };
@@ -179,6 +181,89 @@
 	return device;
 }
 
+
+char *
+strip_string(char *str, int remove_quotes)
+{
+	char *c;
+
+	while (isspace(*str) || !isascii(*str))
+		str++;
+	if (*str == '\0')
+		return str;
+	if (*str == '"' && remove_quotes){
+		str++;
+		c = str;
+		while (*c != '"' && *c != '\0') {
+			*c = tolower(*c);
+			c++;
+		}
+	} else {
+		c = str;
+		while (isascii(*c) && !isspace(*c)){
+			*c = tolower(*c);
+			c++;
+		}
+	}
+	*c = '\0';
+	return str;
+}
+	
+
+void
+read_config_file(char *config_file, char **delim)
+{
+	char buf[LINE_MAX];
+	struct stat s;
+	FILE *f;
+
+	if (*delim != NULL)
+		return;
+
+	if (stat(config_file, &s) != 0) {
+		if (errno != ENOENT)
+			fprintf(stderr, "Can't stat '%s' (%s). skipping\n",
+				config_file, strerror(errno));
+		return;
+	}
+ 	if (!S_ISREG(s.st_mode)) {
+		fprintf(stderr, "'%s' is not a regular file. skipping\n",
+			config_file);
+		return;
+	}
+	if (s.st_size == 0)
+		return;
+	f = fopen(config_file, "r");
+	if (!f) {
+		fprintf(stderr, "cannot open bindings file '%s' (%s). "
+			"skipping\n", config_file, strerror(errno));
+		return;
+	}
+	while (fgets(buf, LINE_MAX, f)) {
+		char *c, *value;
+
+		c = strpbrk(buf, "#\n\r");
+		if (c)
+			*c = '\0';
+		c = strchr(buf, '=');
+		if (c){
+			*c = '\0';
+			value = c + 1;
+		}
+		else
+			continue;
+		if (strcmp("consistent_suffix", strip_string(buf, 0)) != 0)
+			continue;
+		value = strip_string(value, 1);
+		if (strcmp(value, "y") == 0 || strcmp(value, "yes") == 0){
+			*delim = "p";
+			goto exit;
+		}
+	}
+exit:			
+	fclose(f);
+}
+
 int
 main(int argc, char **argv){
         int fd, i, j, k, n, op, off, arg;
@@ -195,6 +280,7 @@
 	int loopro = 0;
 	int hotplug = 0;
 	struct stat buf;
+	char *config_file = DEFAULT_CONFIG_FILE;
 
 	initpts();
 	init_crc32();
@@ -266,6 +352,8 @@
 		exit(1);
 	}
 
+	read_config_file(config_file, &delim);
+
 	if (hotplug) {
 		/* already got [disk]device */
 	} else if (optind == argc-2) {

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-10-11 20:17 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-10-11 20:17 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2007-10-11 20:17:17

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	libmultipath   : dict.c parser.c 

Log message:
	Fixes for bz303291 and bz320151.  multipath now ignores nonascii characters
	in /etc/multipath.conf.  There is also now a new multipath.conf option,
	bindings_file, which specifies the location of the user_friendly_names
	bindings file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16&r2=1.16.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.5.2.6&r2=1.5.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.1&r2=1.16.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/parser.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17&r2=1.17.2.1

--- multipath-tools/multipath.conf.annotated	2006/04/19 18:58:28	1.16
+++ multipath-tools/multipath.conf.annotated	2007/10/11 20:17:17	1.16.2.1
@@ -122,8 +122,8 @@
 #	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
-#	# desc    : If set to "yes", using the bindings file
-#	#           /var/lib/multipath/bindings to assign a persistent and
+#	# desc    : If set to "yes", using the bindings file, by default
+#	#           /var/lib/multipath/bindings, to assign a persistent and
 #	#           unique alias to the multipath, in the form of mpath<n>.
 #	#           If set to "no" use the WWID as the alias. In either case
 #	#           this be will be overriden by any specific aliases in this
@@ -132,6 +132,15 @@
 #	# default : no
 #	user_friendly_names no
 #
+#	#
+#	# name    : bindings_file
+#	# scope   : multipath
+#	# desc    : The location of the bindings file that is used with
+#	#           the user_friendly_names option.
+#	# values  : <full_pathname>
+#	# default : "/var/lib/multipath/bindings"
+#	bindings_file "/etc/multipath_bindings"
+#
 #}
 #	
 ##
--- multipath-tools/multipath.conf.defaults	2007/09/11 18:06:01	1.5.2.6
+++ multipath-tools/multipath.conf.defaults	2007/10/11 20:17:17	1.5.2.7
@@ -14,6 +14,7 @@
 #	failback		immediate
 #	no_path_retry		fail
 #	user_friendly_names	no
+#	bindings_file		/var/lib/multipath/bindings
 #}
 #
 #blacklist {
--- multipath-tools/libmultipath/dict.c	2006/12/01 23:45:18	1.16.2.1
+++ multipath-tools/libmultipath/dict.c	2007/10/11 20:17:17	1.16.2.2
@@ -242,6 +242,17 @@
 	return 0;
 }
 
+static int
+bindings_file_handler(vector strvec)
+{
+	conf->bindings_file = set_value(strvec);
+
+	if (!conf->bindings_file)
+		return 1;
+
+	return 0;
+}
+
 /*
  * blacklist block handlers
  */
@@ -799,6 +810,7 @@
 	install_keyword("no_path_retry", &def_no_path_retry_handler);
 	install_keyword("pg_timeout", &default_pg_timeout_handler);
 	install_keyword("user_friendly_names", &names_handler);
+	install_keyword("bindings_file", &bindings_file_handler);
 
 	/*
 	 * deprecated synonyms
--- multipath-tools/libmultipath/parser.c	2005/10/12 21:57:26	1.17
+++ multipath-tools/libmultipath/parser.c	2007/10/11 20:17:17	1.17.2.1
@@ -2,7 +2,7 @@
  * Part:        Configuration file parser/reader. Place into the dynamic
  *              data structure representation the conf file
  *  
- * Version:     $Id: parser.c,v 1.17 2005/10/12 21:57:26 bmarzins Exp $
+ * Version:     $Id: parser.c,v 1.17.2.1 2007/10/11 20:17:17 bmarzins Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -119,7 +119,7 @@
 	cp = string;
 
 	/* Skip white spaces */
-	while (isspace((int) *cp) && *cp != '\0')
+	while ((isspace((int) *cp) || !isascii((int) *cp)) && *cp != '\0')
 		cp++;
 
 	/* Return if there is only white spaces */
@@ -171,7 +171,8 @@
 		}
 		vector_set_slot(strvec, token);
 
-		while (isspace((int) *cp) && *cp != '\0')
+		while ((isspace((int) *cp) || !isascii((int) *cp))
+		       && *cp != '\0')
 			cp++;
 		if (*cp == '\0' || *cp == '!' || *cp == '#')
 			return strvec;

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-06-19 18:12 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-06-19 18:12 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2007-06-19 18:12:15

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	                 multipath.conf.synthetic 
	multipath      : multipath.conf.redhat 

Log message:
	Pulled out cciss blacklist info from files.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.1&r2=1.18.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.4.3&r2=1.5.4.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.1&r2=1.11.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.redhat.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6.2.3&r2=1.6.2.4

--- multipath-tools/multipath.conf.annotated	2007/01/10 20:08:07	1.18.2.1
+++ multipath-tools/multipath.conf.annotated	2007/06/19 18:12:15	1.18.2.2
@@ -130,13 +130,12 @@
 ## name    : blacklist
 ## scope   : multipath & multipathd
 ## desc    : list of device names to discard as not multipath candidates
-## default : cciss, fd, hd, md, dm, sr, scd, st, ram, raw, loop
+## default : fd, hd, md, dm, sr, scd, st, ram, raw, loop
 ##
 #blacklist {
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z][[0-9]*]"
-#	devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
 #       device {
 #               vendor DEC.*
 #               product MSA[15]00
--- multipath-tools/multipath.conf.defaults	2007/05/17 19:47:24	1.5.4.3
+++ multipath-tools/multipath.conf.defaults	2007/06/19 18:12:15	1.5.4.4
@@ -19,7 +19,6 @@
 #blacklist {
 #       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #       devnode "^hd[a-z]"
-#       devnode "^cciss!c[0-9]d[0-9]*"
 #}
 #
 #devices {
--- multipath-tools/multipath.conf.synthetic	2007/01/10 20:08:07	1.11.2.1
+++ multipath-tools/multipath.conf.synthetic	2007/06/19 18:12:15	1.11.2.2
@@ -20,7 +20,6 @@
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z][[0-9]*]"
-#	devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
 #	device {
 #		vendor DEC.*
 #		product MSA[15]00
--- multipath-tools/multipath/multipath.conf.redhat	2007/05/08 20:15:59	1.6.2.3
+++ multipath-tools/multipath/multipath.conf.redhat	2007/06/19 18:12:15	1.6.2.4
@@ -57,7 +57,6 @@
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z]"
-#	devnode "^cciss!c[0-9]d[0-9]*"
 #}
 #multipaths {
 #	multipath {

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-01-15 21:52 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-01-15 21:52 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Changes by:	bmarzins@sourceware.org	2007-01-15 21:52:20

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.synthetic 
	libmultipath   : blacklist.c blacklist.h config.c config.h 
	                 dict.c discovery.c print.c print.h 
	multipath      : main.c multipath.conf.redhat 
	multipathd     : cli.c cli.h cli_handlers.c cli_handlers.h 
	                 main.c multipathd.8 

Log message:
	updated to latest upstream code

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/blacklist.c.diff?cvsroot=dm&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/blacklist.h.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.c.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.h.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.redhat.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.h.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.c.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.h.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&r1=1.69&r2=1.70
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/multipathd.8.diff?cvsroot=dm&r1=1.5&r2=1.6

--- multipath-tools/multipath.conf.annotated	2006/08/02 21:37:22	1.18
+++ multipath-tools/multipath.conf.annotated	2007/01/15 21:52:19	1.19
@@ -142,6 +142,22 @@
 #               product MSA[15]00
 #       }
 #}
+##
+## name    : blacklist_exceptions
+## scope   : multipath & multipathd
+## desc    : list of device names to be treated as multipath candidates
+##           even if they are on the blacklist.
+##           Note: blacklist exceptions are only valid in the same class.
+##           It is not possible to blacklist devices using the devnode keyword
+##           and to exclude some devices of them using the wwid keyword.
+## default : -
+##
+#blacklist_exceptions {
+#       devnode "^dasd[c-d]+[0-9]*"
+#       wwid    "IBM.75000000092461.4d00.34"
+#       wwid    "IBM.75000000092461.4d00.35"
+#       wwid    "IBM.75000000092461.4d00.36"
+#}
 #
 ##
 ## name    : multipaths
--- multipath-tools/multipath.conf.synthetic	2006/06/06 18:32:43	1.11
+++ multipath-tools/multipath.conf.synthetic	2007/01/15 21:52:19	1.12
@@ -16,7 +16,7 @@
 #	no_path_retry		fail
 #	user_friendly_names	no
 #}
-#devnode_blacklist {
+#blacklist {
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z][[0-9]*]"
@@ -26,6 +26,10 @@
 #		product MSA[15]00
 #	}
 #}
+#blacklist_exceptions {
+#       devnode "^dasd[c-d]+[0-9]*"
+#       wwid    "IBM.75000000092461.4d00.34"
+#}
 #multipaths {
 #	multipath {
 #		wwid			3600508b4000156d700012000000b0000
--- multipath-tools/libmultipath/blacklist.c	2006/06/06 18:32:43	1.11
+++ multipath-tools/libmultipath/blacklist.c	2007/01/15 21:52:20	1.12
@@ -2,7 +2,6 @@
  * Copyright (c) 2004, 2005 Christophe Varoqui
  */
 #include <stdio.h>
-
 #include <checkers.h>
 
 #include "memory.h"
@@ -14,7 +13,7 @@
 #include "blacklist.h"
 
 extern int
-store_ble (vector blist, char * str)
+store_ble (vector blist, char * str, int origin)
 {
 	struct blentry * ble;
 	
@@ -36,6 +35,7 @@
 		goto out1;
 
 	ble->str = str;
+	ble->origin = origin;
 	vector_set_slot(blist, ble);
 	return 0;
 out1:
@@ -63,7 +63,7 @@
 }
 	
 extern int
-set_ble_device (vector blist, char * vendor, char * product)
+set_ble_device (vector blist, char * vendor, char * product, int origin)
 {
 	struct blentry_device * ble;
 	
@@ -91,6 +91,7 @@
 		}
 		ble->product = product;
 	}
+	ble->origin = origin;
 	return 0;
 }
 
@@ -105,19 +106,19 @@
 	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
 	str = STRDUP("^hd[a-z]");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 	
 	str = STRDUP("^cciss!c[0-9]d[0-9]*");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
 	vector_foreach_slot (conf->hwtable, hwe, i) {
@@ -128,7 +129,8 @@
 					  VECTOR_SIZE(conf->blist_device) -1);
 			if (set_ble_device(conf->blist_device,
 					   STRDUP(hwe->vendor),
-					   STRDUP(hwe->bl_product))) {
+					   STRDUP(hwe->bl_product),
+					   ORIGIN_DEFAULT)) {
 				FREE(ble);
 				return 1;
 			}
@@ -139,11 +141,29 @@
 }
 
 int
-blacklist (vector blist, char * str)
+blacklist_exceptions (vector elist, char * str)
+{
+        int i;
+        struct blentry * ele;
+
+        vector_foreach_slot (elist, ele, i) {
+                if (!regexec(&ele->regex, str, 0, NULL, 0)) {
+			condlog(3, "%s: exception-listed", str);
+			return 1;
+		}
+	}
+        return 0;
+}
+
+int
+blacklist (vector blist, vector elist, char * str)
 {
 	int i;
 	struct blentry * ble;
 
+	if (blacklist_exceptions(elist, str))
+		return 0;
+
 	vector_foreach_slot (blist, ble, i) {
 		if (!regexec(&ble->regex, str, 0, NULL, 0)) {
 			condlog(3, "%s: blacklisted", str);
@@ -154,11 +174,30 @@
 }
 
 int
-blacklist_device (vector blist, char * vendor, char * product)
+blacklist_exceptions_device(vector elist, char * vendor, char * product)
+{
+	int i;
+	struct blentry_device * ble;
+
+	vector_foreach_slot (elist, ble, i) {
+		if (!regexec(&ble->vendor_reg, vendor, 0, NULL, 0) &&
+		    !regexec(&ble->product_reg, product, 0, NULL, 0)) {
+			condlog(3, "%s:%s: exception-listed", vendor, product);
+			return 1;
+		}
+	}
+	return 0;
+}
+
+int
+blacklist_device (vector blist, vector elist, char * vendor, char * product)
 {
 	int i;
 	struct blentry_device * ble;
 
+	if (blacklist_exceptions_device(elist, vendor, product))
+		return 0;
+
 	vector_foreach_slot (blist, ble, i) {
 		if (!regexec(&ble->vendor_reg, vendor, 0, NULL, 0) &&
 		    !regexec(&ble->product_reg, product, 0, NULL, 0)) {
@@ -172,14 +211,14 @@
 int
 blacklist_path (struct config * conf, struct path * pp)
 {
-	if (blacklist(conf->blist_devnode, pp->dev))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, pp->dev))
 		return 1;
 
-	if (blacklist(conf->blist_wwid, pp->wwid))
+	if (blacklist(conf->blist_wwid, conf->elist_wwid, pp->wwid))
 		return 1;
 
 	if (pp->vendor_id && pp->product_id &&
-	    blacklist_device(conf->blist_device, pp->vendor_id, pp->product_id))
+	    blacklist_device(conf->blist_device, conf->elist_device, pp->vendor_id, pp->product_id))
 		return 1;
 
 	return 0;
--- multipath-tools/libmultipath/blacklist.h	2006/06/06 18:32:43	1.6
+++ multipath-tools/libmultipath/blacklist.h	2007/01/15 21:52:20	1.7
@@ -6,6 +6,7 @@
 struct blentry {
 	char * str;
 	regex_t regex;
+	int origin;
 };
 
 struct blentry_device {
@@ -13,15 +14,16 @@
 	char * product;
 	regex_t vendor_reg;
 	regex_t product_reg;
+	int origin;
 };
 
 int setup_default_blist (struct config *);
 int alloc_ble_device (vector);
-int blacklist (vector, char *);
-int blacklist_device (vector, char *, char *);
+int blacklist (vector, vector, char *);
+int blacklist_device (vector, vector, char *, char *);
 int blacklist_path (struct config *, struct path *);
-int store_ble (vector, char *);
-int set_ble_device (vector, char *, char *);
+int store_ble (vector, char *, int);
+int set_ble_device (vector, char *, char *, int);
 void free_blacklist (vector);
 void free_blacklist_device (vector);
 
--- multipath-tools/libmultipath/config.c	2006/12/13 00:02:59	1.20
+++ multipath-tools/libmultipath/config.c	2007/01/15 21:52:20	1.21
@@ -333,6 +333,11 @@
 	free_blacklist(conf->blist_devnode);
 	free_blacklist(conf->blist_wwid);
 	free_blacklist_device(conf->blist_device);
+
+	free_blacklist(conf->elist_devnode);
+	free_blacklist(conf->elist_wwid);
+	free_blacklist_device(conf->elist_device);
+
 	free_mptable(conf->mptable);
 	free_hwtable(conf->hwtable);
 	free_keywords(conf->keywords);
@@ -403,6 +408,26 @@
 	if (setup_default_blist(conf))
 		goto out;
 
+	if (conf->elist_devnode == NULL) {
+                conf->elist_devnode = vector_alloc();
+
+                if (!conf->elist_devnode)
+			goto out;
+	}
+	if (conf->elist_wwid == NULL) {
+		conf->elist_wwid = vector_alloc();
+
+                if (!conf->elist_wwid)
+			goto out;
+	}
+
+	if (conf->elist_device == NULL) {
+		conf->elist_device = vector_alloc();
+		
+		if (!conf->elist_device)
+			goto out;
+	}
+
 	if (conf->mptable == NULL) {
 		conf->mptable = vector_alloc();
 
--- multipath-tools/libmultipath/config.h	2006/12/13 00:02:59	1.19
+++ multipath-tools/libmultipath/config.h	2007/01/15 21:52:20	1.20
@@ -1,6 +1,9 @@
 #ifndef _CONFIG_H
 #define _CONFIG_H
 
+#define ORIGIN_DEFAULT 0
+#define ORIGIN_CONFIG  1
+
 enum devtypes {
 	DEV_NONE,
 	DEV_DEVT,
@@ -78,6 +81,9 @@
 	vector blist_devnode;
 	vector blist_wwid;
 	vector blist_device;
+	vector elist_devnode;
+	vector elist_wwid;
+	vector elist_device;
 };
 
 struct config * conf;
--- multipath-tools/libmultipath/dict.c	2006/06/06 18:32:43	1.17
+++ multipath-tools/libmultipath/dict.c	2007/01/15 21:52:20	1.18
@@ -264,6 +264,19 @@
 }
 
 static int
+blacklist_exceptions_handler(vector strvec)
+{
+        conf->elist_devnode = vector_alloc();
+        conf->elist_wwid = vector_alloc();
+	conf->elist_device = vector_alloc();
+
+        if (!conf->elist_devnode || !conf->elist_wwid || !conf->blist_device)
+                return 1;
+
+        return 0;
+}
+
+static int
 ble_devnode_handler(vector strvec)
 {
 	char * buff;
@@ -273,7 +286,20 @@
 	if (!buff)
 		return 1;
 
-	return store_ble(conf->blist_devnode, buff);
+	return store_ble(conf->blist_devnode, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_devnode_handler(vector strvec)
+{
+        char * buff;
+
+        buff = set_value(strvec);
+
+        if (!buff)
+                return 1;
+
+	return store_ble(conf->elist_devnode, buff, ORIGIN_CONFIG);
 }
 
 static int
@@ -286,7 +312,20 @@
 	if (!buff)
 		return 1;
 
-	return store_ble(conf->blist_wwid, buff);
+	return store_ble(conf->blist_wwid, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_wwid_handler(vector strvec)
+{
+        char * buff;
+
+        buff = set_value(strvec);
+
+        if (!buff)
+                return 1;
+
+	return store_ble(conf->elist_wwid, buff, ORIGIN_CONFIG);
 }
 
 static int
@@ -296,6 +335,12 @@
 }
 
 static int
+ble_except_device_handler(vector strvec)
+{
+	return alloc_ble_device(conf->elist_device);
+}
+
+static int
 ble_vendor_handler(vector strvec)
 {
 	char * buff;
@@ -305,7 +350,21 @@
 	if (!buff)
 		return 1;
 
-	return set_ble_device(conf->blist_device, buff, NULL);
+	return set_ble_device(conf->blist_device, buff, NULL, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_vendor_handler(vector strvec)
+{
+	char * buff;
+	int r;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	return set_ble_device(conf->elist_device, buff, NULL, ORIGIN_CONFIG);
 }
 
 static int
@@ -318,7 +377,20 @@
 	if (!buff)
 		return 1;
 
-	return set_ble_device(conf->blist_device, NULL, buff);
+	return set_ble_device(conf->blist_device, NULL, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_product_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	return set_ble_device(conf->elist_device, NULL, buff, ORIGIN_CONFIG);
 }
 
 /*
@@ -1476,6 +1548,14 @@
 	install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor);
 	install_keyword("product", &ble_product_handler, &snprint_bled_product);
 	install_sublevel_end();
+	install_keyword_root("blacklist_exceptions", &blacklist_exceptions_handler);
+	install_keyword("devnode", &ble_except_devnode_handler, &snprint_ble_simple);
+	install_keyword("wwid", &ble_except_wwid_handler, &snprint_ble_simple);
+	install_keyword("device", &ble_except_device_handler, NULL);
+	install_sublevel();
+	install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor);
+	install_keyword("product", &ble_except_product_handler, &snprint_bled_product);
+	install_sublevel_end();
 
 #if 0
 	__deprecated install_keyword_root("devnode_blacklist", &blacklist_handler);
--- multipath-tools/libmultipath/discovery.c	2006/12/13 00:02:59	1.33
+++ multipath-tools/libmultipath/discovery.c	2007/01/15 21:52:20	1.34
@@ -104,7 +104,7 @@
 	if (!devname)
 		return 0;
 
-	if (blacklist(conf->blist_devnode, devname))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, devname))
 		return 0;
 
 	if(safe_sprintf(path, "%s/block/%s/device", sysfs_path,
@@ -426,7 +426,7 @@
 	if (sscanf(pp->dev, "gnbd%u", &unused) == 1){
 		strcpy(pp->vendor_id,  "GNBD");
 		strcpy(pp->product_id, "GNBD");
-		pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id);
+		pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, NULL);
 		return 0;
 	}
 	/*
--- multipath-tools/libmultipath/print.c	2006/07/13 19:49:23	1.5
+++ multipath-tools/libmultipath/print.c	2007/01/15 21:52:20	1.6
@@ -5,6 +5,8 @@
 #include <string.h>
 #include <libdevmapper.h>
 #include <stdarg.h>
+#include <sysfs/dlist.h>
+#include <sysfs/libsysfs.h>
 
 #include <checkers.h>
 
@@ -18,6 +20,7 @@
 #include "pgpolicies.h"
 #include "defaults.h"
 #include "parser.h"
+#include "blacklist.h"
 
 #define MAX(x,y) (x > y) ? x : y
 #define TAIL     (line + len - 1 - c)
@@ -850,6 +853,110 @@
 	
 }
 
+static int
+snprint_blacklist_group (char *buff, int len, int *fwd, vector *vec)
+{
+	int threshold = MAX_LINE_LEN;
+	struct blentry * ble;
+	int pos;
+	int i;
+
+	pos = *fwd;
+	if (!VECTOR_SIZE(*vec)) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		pos += snprintf(buff + pos, len - pos, "        <empty>\n");
+	} else vector_foreach_slot (*vec, ble, i) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		if (ble->origin == ORIGIN_CONFIG)
+			pos += snprintf(buff + pos, len - pos, "        (config file rule) ");
+		else if (ble->origin == ORIGIN_DEFAULT)
+			pos += snprintf(buff + pos, len - pos, "        (default rule)     ");
+		pos += snprintf(buff + pos, len - pos, "%s\n", ble->str);
+	}
+
+	*fwd = pos;
+	return pos;
+}
+
+static int
+snprint_blacklist_devgroup (char *buff, int len, int *fwd, vector *vec)
+{
+	int threshold = MAX_LINE_LEN;
+	struct blentry_device * bled;
+	int pos;
+	int i;
+
+	pos = *fwd;
+	if (!VECTOR_SIZE(*vec)) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		pos += snprintf(buff + pos, len - pos, "        <empty>\n");
+	} else vector_foreach_slot (*vec, bled, i) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		if (bled->origin == ORIGIN_CONFIG)
+			pos += snprintf(buff + pos, len - pos, "        (config file rule) ");
+		else if (bled->origin == ORIGIN_DEFAULT)
+			pos += snprintf(buff + pos, len - pos, "        (default rule)     ");
+		pos += snprintf(buff + pos, len - pos, "%s:%s\n", bled->vendor, bled->product);
+	}
+
+	*fwd = pos;
+	return pos;
+}
+
+extern int
+snprint_blacklist_report (char * buff, int len)
+{
+	int threshold = MAX_LINE_LEN;
+	int fwd = 0;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "device node rules:\n"
+			                       "- blacklist:\n");
+	if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_devnode))
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_devnode) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n"
+			                       "- blacklist:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_wwid) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "device rules:\n"
+			                       "- blacklist:\n");
+	if (snprint_blacklist_devgroup(buff, len, &fwd, &conf->blist_device) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_devgroup(buff, len, &fwd, &conf->elist_device) == 0)
+		return len;
+
+	if (fwd > len)
+		return len;
+	return fwd;
+}
+
 extern int
 snprint_blacklist (char * buff, int len)
 {
@@ -912,12 +1019,123 @@
 		if (fwd > len)
 			return len;
 	}
+	fwd += snprintf(buff + fwd, len - fwd, "}\n");
+	if (fwd > len)
+		return len;
+	return fwd;
+}
 
+extern int
+snprint_blacklist_except (char * buff, int len)
+{
+	int i;
+	struct blentry * ele;
+	struct blentry_device * eled;
+	int fwd = 0;
+	struct keyword *rootkw;
+	struct keyword *kw;
+
+	rootkw = find_keyword(NULL, "blacklist_exceptions");
+	if (!rootkw)
+		return 0;
+
+	fwd += snprintf(buff + fwd, len - fwd, "blacklist_exceptions {\n");
+	if (fwd > len)
+		return len;
+
+	vector_foreach_slot (conf->elist_devnode, ele, i) {
+		kw = find_keyword(rootkw->sub, "devnode");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+				       kw, ele);
+		if (fwd > len)
+			return len;
+	}
+	vector_foreach_slot (conf->elist_wwid, ele, i) {
+		kw = find_keyword(rootkw->sub, "wwid");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+				       kw, ele);
+		if (fwd > len)
+			return len;
+	}
+	rootkw = find_keyword(rootkw->sub, "device");
+	if (!rootkw)
+		return 0;
+
+	vector_foreach_slot (conf->elist_device, eled, i) {
+		fwd += snprintf(buff + fwd, len - fwd, "\tdevice {\n");
+		if (fwd > len)
+			return len;
+		kw = find_keyword(rootkw->sub, "vendor");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+				       kw, eled);
+		if (fwd > len)
+			return len;
+		kw = find_keyword(rootkw->sub, "product");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+				       kw, eled);
+		if (fwd > len)
+			return len;
+		fwd += snprintf(buff + fwd, len - fwd, "\t}\n");
+		if (fwd > len)
+			return len;
+	}
 	fwd += snprintf(buff + fwd, len - fwd, "}\n");
 	if (fwd > len)
 		return len;
 	return fwd;
-	
+}
+
+extern int
+snprint_devices (char * buff, int len, struct vectors *vecs)
+{
+        struct dlist * ls;
+        struct sysfs_class * class;
+        struct sysfs_class_device * dev;
+	int threshold = MAX_LINE_LEN;
+	int fwd = 0;
+
+
+	struct path * pp;
+
+
+
+        if (!(class = sysfs_open_class("block")))
+                return 0;
+
+        if (!(ls = sysfs_get_class_devices(class))) {
+                sysfs_close_class(class);
+                return 0;
+        }
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "available block devices:\n");
+
+        dlist_for_each_data(ls, dev, struct sysfs_class_device) {
+		if ((len - fwd - threshold)  <= 0)
+			return len;
+		fwd += snprintf(buff + fwd, len - fwd, "    %s ", dev->name);
+		pp = find_path_by_dev(vecs->pathvec, dev->name);
+		if (blacklist(conf->blist_devnode, conf->elist_devnode,
+			      dev->name) || pp == NULL)
+			fwd += snprintf(buff + fwd, len - fwd,
+					"(blacklisted)\n");
+                else
+			fwd += snprintf(buff + fwd, len - fwd, "\n");
+        }
+        sysfs_close_class(class);
+
+	if (fwd > len)
+		return len;
+	return fwd;
 }
 
 extern int
--- multipath-tools/libmultipath/print.h	2006/06/06 18:32:43	1.3
+++ multipath-tools/libmultipath/print.h	2007/01/15 21:52:20	1.4
@@ -42,6 +42,9 @@
 				int verbosity);
 int snprint_defaults (char *, int);
 int snprint_blacklist (char *, int);
+int snprint_blacklist_except (char *, int);
+int snprint_blacklist_report (char *, int);
+int snprint_devices (char *, int, struct vectors *);
 int snprint_hwtable (char *, int, vector);
 int snprint_mptable (char *, int, vector);
 
--- multipath-tools/multipath/main.c	2006/12/13 00:02:59	1.45
+++ multipath-tools/multipath/main.c	2007/01/15 21:52:20	1.46
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.45 2006/12/13 00:02:59 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.46 2007/01/15 21:52:20 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -234,7 +234,7 @@
 			dev = conf->dev;
 	}
 	
-	if (dev && blacklist(conf->blist_devnode, dev))
+	if (dev && blacklist(conf->blist_devnode, conf->elist_devnode, dev))
 		goto out;
 	
 	/*
@@ -250,7 +250,7 @@
 		}
 		condlog(3, "scope limited to %s", refwwid);
 
-		if (blacklist(conf->blist_wwid, refwwid))
+		if (blacklist(conf->blist_wwid, conf->elist_wwid, refwwid))
 			goto out;
 	}
 
--- multipath-tools/multipath/multipath.conf.redhat	2006/07/17 21:09:08	1.6
+++ multipath-tools/multipath/multipath.conf.redhat	2007/01/15 21:52:20	1.7
@@ -36,7 +36,12 @@
 ##
 ## The wwid line in the following blacklist section is shown as an example
 ## of how to blacklist devices by wwid.  The 3 devnode lines are the
-## compiled in default blacklist.
+## compiled in default blacklist. If you want to blacklist entire types
+## of devices, such as all scsi devices, you should use a devnode line.
+## However, if you want to blacklist specific devices, you should use
+## a wwid line.  Since there is no guarantee that a specific device will
+## not change names on reboot (from /dev/sda to /dev/sdb for example)
+## devnode lines are not recommended for blacklisting specific devices.
 ##
 #devnode_blacklist {
 #       wwid 26353900f02796769
--- multipath-tools/multipathd/cli.c	2006/06/06 18:32:44	1.5
+++ multipath-tools/multipathd/cli.c	2007/01/15 21:52:20	1.6
@@ -141,6 +141,8 @@
 	r += add_key(keys, "stats", STATS, 0);
 	r += add_key(keys, "topology", TOPOLOGY, 0);
 	r += add_key(keys, "config", CONFIG, 0);
+	r += add_key(keys, "blacklist", BLACKLIST, 0);
+	r += add_key(keys, "devices", DEVICES, 0);
 
 	if (r) {
 		free_keys(keys);
--- multipath-tools/multipathd/cli.h	2006/06/06 18:32:44	1.5
+++ multipath-tools/multipathd/cli.h	2007/01/15 21:52:20	1.6
@@ -17,6 +17,8 @@
 	__STATS,
 	__TOPOLOGY,
 	__CONFIG,
+	__BLACKLIST,
+	__DEVICES,
 };
 
 #define LIST		(1 << __LIST)
@@ -37,6 +39,8 @@
 #define STATS		(1 << __STATS)
 #define TOPOLOGY	(1 << __TOPOLOGY)
 #define CONFIG		(1 << __CONFIG)
+#define BLACKLIST	(1 << __BLACKLIST)
+#define DEVICES  	(1 << __DEVICES)
 
 #define INITIAL_REPLY_LEN 1000
 
--- multipath-tools/multipathd/cli_handlers.c	2006/07/13 19:49:23	1.6
+++ multipath-tools/multipathd/cli_handlers.c	2007/01/15 21:52:20	1.7
@@ -143,6 +143,12 @@
 			reply = REALLOC(reply, maxlen *= 2);
 			continue;
 		}
+		c += snprint_blacklist_except(c, reply + maxlen - c);
+		again = ((c - reply) == maxlen);
+		if (again) {
+			reply = REALLOC(reply, maxlen *= 2);
+			continue;
+		}
 		c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable);
 		again = ((c - reply) == maxlen);
 		if (again) {
@@ -280,7 +286,7 @@
 
 	condlog(2, "%s: add path (operator)", param);
 
-	if (blacklist(conf->blist_devnode, param) ||
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, param) ||
 	    (r = ev_add_path(param, vecs)) == 2) {
 		*reply = strdup("blacklisted");
 		*len = strlen(*reply) + 1;
@@ -309,7 +315,7 @@
 
 	condlog(2, "%s: add map (operator)", param);
 
-	if (blacklist(conf->blist_wwid, param)) {
+	if (blacklist(conf->blist_wwid, conf->elist_wwid, param)) {
 		*reply = strdup("blacklisted");
 		*len = strlen(*reply) + 1;
 		condlog(2, "%s: map blacklisted", param);
@@ -433,3 +439,79 @@
 
 	return dm_fail_path(pp->mpp->alias, pp->dev_t);
 }
+
+int
+show_blacklist (char ** r, int * len)
+{
+        char *c = NULL;
+        char *reply = NULL;
+        unsigned int maxlen = INITIAL_REPLY_LEN;
+        int again = 1;
+
+        while (again) {
+		reply = MALLOC(maxlen);
+		if (!reply)
+			return 1;
+
+                c = reply;
+                c += snprint_blacklist_report(c, maxlen);
+                again = ((c - reply) == maxlen);
+                if (again) {
+			maxlen  *= 2;
+			FREE(reply);
+                        continue;
+                }
+        }
+
+        *r = reply;
+        *len = (int)(c - reply + 1);
+
+        return 0;
+}
+
+int
+cli_list_blacklist (void * v, char ** reply, int * len, void * data)
+{
+        condlog(3, "list blacklist (operator)");
+
+        return show_blacklist(reply, len);
+}
+
+int
+show_devices (char ** r, int * len, struct vectors *vecs)
+{
+        char *c = NULL;
+        char *reply = NULL;
+        unsigned int maxlen = INITIAL_REPLY_LEN;
+        int again = 1;
+
+        while (again) {
+                reply = MALLOC(maxlen);
+                if (!reply)
+                        return 1;
+
+                c = reply;
+                c += snprint_devices(c, maxlen, vecs);
+                again = ((c - reply) == maxlen);
+                if (again) {
+                        maxlen  *= 2;
+                        FREE(reply);
+                        continue;
+                }
+        }
+
+        *r = reply;
+        *len = (int)(c - reply + 1);
+
+        return 0;
+}
+
+int
+cli_list_devices (void * v, char ** reply, int * len, void * data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+
+        condlog(3, "list devices (operator)");
+
+        return show_devices(reply, len, vecs);
+}
--- multipath-tools/multipathd/cli_handlers.h	2006/06/06 18:32:44	1.3
+++ multipath-tools/multipathd/cli_handlers.h	2007/01/15 21:52:20	1.4
@@ -5,6 +5,8 @@
 int cli_list_map_topology (void * v, char ** reply, int * len, void * data);
 int cli_list_maps_topology (void * v, char ** reply, int * len, void * data);
 int cli_list_config (void * v, char ** reply, int * len, void * data);
+int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
+int cli_list_devices (void * v, char ** reply, int * len, void * data);
 int cli_add_path (void * v, char ** reply, int * len, void * data);
 int cli_del_path (void * v, char ** reply, int * len, void * data);
 int cli_add_map (void * v, char ** reply, int * len, void * data);
--- multipath-tools/multipathd/main.c	2006/10/12 16:16:09	1.69
+++ multipath-tools/multipathd/main.c	2007/01/15 21:52:20	1.70
@@ -675,7 +675,7 @@
 	/*
 	 * path add/remove event
 	 */
-	if (blacklist(conf->blist_devnode, devname))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, devname))
 		goto out;
 
 	if (!strncmp(uev->action, "add", 3)) {
@@ -718,6 +718,8 @@
 	add_handler(LIST+TOPOLOGY, cli_list_maps_topology);
 	add_handler(LIST+MAP+TOPOLOGY, cli_list_map_topology);
 	add_handler(LIST+CONFIG, cli_list_config);
+	add_handler(LIST+BLACKLIST, cli_list_blacklist);
+	add_handler(LIST+DEVICES, cli_list_devices);
 	add_handler(ADD+PATH, cli_add_path);
 	add_handler(DEL+PATH, cli_del_path);
 	add_handler(ADD+MAP, cli_add_map);
--- multipath-tools/multipathd/multipathd.8	2006/12/13 00:02:59	1.5
+++ multipath-tools/multipathd/multipathd.8	2007/01/15 21:52:20	1.6
@@ -57,6 +57,12 @@
 .B list|show config
 Show the currently used configuration, derived from default values and values specified within the configuration file /etc/multipath.conf.
 .TP
+.B list|show blacklist
+Show the currently used blacklist rules, derived from default values and values specified within the configuration file /etc/multipath.conf.
+.TP
+.B list|show devices
+Show all available block devices by name including the information if they are blacklisted or not.
+.TP
 .B add path $path
 Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda).
 .TP 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* multipath-tools ./multipath.conf.annotated ./m ...
@ 2007-01-10 20:08 bmarzins
  0 siblings, 0 replies; 15+ messages in thread
From: bmarzins @ 2007-01-10 20:08 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2007-01-10 20:08:10

Modified files:
	.              : multipath.conf.annotated 
	                 multipath.conf.defaults 
	                 multipath.conf.synthetic 
	libmultipath   : blacklist.c blacklist.h config.c config.h 
	                 dict.c discovery.c hwtable.c print.c print.h 
	multipath      : main.c multipath.conf.redhat 
	multipathd     : cli.c cli.h cli_handlers.c cli_handlers.h 
	                 main.c 

Log message:
	Resolves: bz 219804
	Pulled in the blacklist_exceptions patch from upstream. Made dasds blacklisted
	by default again. Added some a commented out blacklist_exceptions section to
	the default /etc/multipath.conf file, so that it's easy to unblacklist the
	dasd devices.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18&r2=1.18.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.4.1&r2=1.5.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11&r2=1.11.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/blacklist.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11&r2=1.11.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/blacklist.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19&r2=1.19.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18&r2=1.18.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17&r2=1.17.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/discovery.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.32&r2=1.32.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.2&r2=1.20.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44&r2=1.44.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.redhat.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3&r2=1.3.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&r2=1.69.2.1

--- multipath-tools/multipath.conf.annotated	2006/08/02 21:37:22	1.18
+++ multipath-tools/multipath.conf.annotated	2007/01/10 20:08:07	1.18.2.1
@@ -142,6 +142,26 @@
 #               product MSA[15]00
 #       }
 #}
+##
+## name    : blacklist_exceptions
+## scope   : multipath & multipathd
+## desc    : list of device names to be treated as multipath candidates
+##           even if they are on the blacklist.
+##           Note: blacklist exceptions are only valid in the same class.
+##           It is not possible to blacklist devices using the devnode keyword
+##           and to exclude some devices of them using the wwid keyword.
+## default : -
+##
+#blacklist_exceptions {
+#       devnode "^dasd[c-d]+[0-9]*"
+#       wwid    "IBM.75000000092461.4d00.34"
+#       wwid    "IBM.75000000092461.4d00.35"
+#       wwid    "IBM.75000000092461.4d00.36"
+#	device {
+#		vendor "IBM"
+#		product "S/390.*"
+#	}
+#}
 #
 ##
 ## name    : multipaths
--- multipath-tools/multipath.conf.defaults	2006/12/19 22:51:31	1.5.4.1
+++ multipath-tools/multipath.conf.defaults	2007/01/10 20:08:07	1.5.4.2
@@ -118,7 +118,7 @@
 #       device {
 #               vendor                  "DGC"
 #		product			".*"
-#		bl_product		"LUN_Z"
+#		product_blacklist	"LUN_Z"
 #		getuid_callout          "/sbin/scsi_id -g -u -s"
 #		prio_callout		"/sbin/mpath_prio_emc /dev/%n"
 #		features		"1 queue_if_no_path"
@@ -264,6 +264,7 @@
 #	device {
 #		vendor			"IBM"
 #		product			"S/390 DASD ECKD"
+#		product_blacklist	"S/390.*"
 #		getuid_callout		"/sbin/dasd_id /dev/%n"
 #		features		"0"
 #		hardware_handler	"0"
--- multipath-tools/multipath.conf.synthetic	2006/06/06 18:32:43	1.11
+++ multipath-tools/multipath.conf.synthetic	2007/01/10 20:08:07	1.11.2.1
@@ -16,7 +16,7 @@
 #	no_path_retry		fail
 #	user_friendly_names	no
 #}
-#devnode_blacklist {
+#blacklist {
 #       wwid 26353900f02796769
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
 #	devnode "^hd[a-z][[0-9]*]"
@@ -26,6 +26,10 @@
 #		product MSA[15]00
 #	}
 #}
+#blacklist_exceptions {
+#       devnode "^dasd[c-d]+[0-9]*"
+#       wwid    "IBM.75000000092461.4d00.34"
+#}
 #multipaths {
 #	multipath {
 #		wwid			3600508b4000156d700012000000b0000
--- multipath-tools/libmultipath/blacklist.c	2006/06/06 18:32:43	1.11
+++ multipath-tools/libmultipath/blacklist.c	2007/01/10 20:08:08	1.11.2.1
@@ -2,7 +2,6 @@
  * Copyright (c) 2004, 2005 Christophe Varoqui
  */
 #include <stdio.h>
-
 #include <checkers.h>
 
 #include "memory.h"
@@ -14,7 +13,7 @@
 #include "blacklist.h"
 
 extern int
-store_ble (vector blist, char * str)
+store_ble (vector blist, char * str, int origin)
 {
 	struct blentry * ble;
 	
@@ -36,6 +35,7 @@
 		goto out1;
 
 	ble->str = str;
+	ble->origin = origin;
 	vector_set_slot(blist, ble);
 	return 0;
 out1:
@@ -63,7 +63,7 @@
 }
 	
 extern int
-set_ble_device (vector blist, char * vendor, char * product)
+set_ble_device (vector blist, char * vendor, char * product, int origin)
 {
 	struct blentry_device * ble;
 	
@@ -91,6 +91,7 @@
 		}
 		ble->product = product;
 	}
+	ble->origin = origin;
 	return 0;
 }
 
@@ -105,19 +106,19 @@
 	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
 	str = STRDUP("^hd[a-z]");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 	
 	str = STRDUP("^cciss!c[0-9]d[0-9]*");
 	if (!str)
 		return 1;
-	if (store_ble(conf->blist_devnode, str))
+	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
 	vector_foreach_slot (conf->hwtable, hwe, i) {
@@ -128,7 +129,8 @@
 					  VECTOR_SIZE(conf->blist_device) -1);
 			if (set_ble_device(conf->blist_device,
 					   STRDUP(hwe->vendor),
-					   STRDUP(hwe->bl_product))) {
+					   STRDUP(hwe->bl_product),
+					   ORIGIN_DEFAULT)) {
 				FREE(ble);
 				return 1;
 			}
@@ -139,11 +141,29 @@
 }
 
 int
-blacklist (vector blist, char * str)
+blacklist_exceptions (vector elist, char * str)
+{
+        int i;
+        struct blentry * ele;
+
+        vector_foreach_slot (elist, ele, i) {
+                if (!regexec(&ele->regex, str, 0, NULL, 0)) {
+			condlog(3, "%s: exception-listed", str);
+			return 1;
+		}
+	}
+        return 0;
+}
+
+int
+blacklist (vector blist, vector elist, char * str)
 {
 	int i;
 	struct blentry * ble;
 
+	if (blacklist_exceptions(elist, str))
+		return 0;
+
 	vector_foreach_slot (blist, ble, i) {
 		if (!regexec(&ble->regex, str, 0, NULL, 0)) {
 			condlog(3, "%s: blacklisted", str);
@@ -154,15 +174,36 @@
 }
 
 int
-blacklist_device (vector blist, char * vendor, char * product)
+blacklist_exceptions_device(vector elist, char *str, char * vendor, char * product)
+{
+	int i;
+	struct blentry_device * ble;
+
+	vector_foreach_slot (elist, ble, i) {
+		if (!regexec(&ble->vendor_reg, vendor, 0, NULL, 0) &&
+		    !regexec(&ble->product_reg, product, 0, NULL, 0)) {
+			condlog(3, "%s: (%s:%s) exception-listed by product",
+				str, vendor, product);
+			return 1;
+		}
+	}
+	return 0;
+}
+
+int
+blacklist_device (vector blist, vector elist, char *str, char * vendor, char * product)
 {
 	int i;
 	struct blentry_device * ble;
 
+	if (blacklist_exceptions_device(elist, str, vendor, product))
+		return 0;
+
 	vector_foreach_slot (blist, ble, i) {
 		if (!regexec(&ble->vendor_reg, vendor, 0, NULL, 0) &&
 		    !regexec(&ble->product_reg, product, 0, NULL, 0)) {
-			condlog(3, "%s:%s: blacklisted", vendor, product);
+			condlog(3, "%s: (%s:%s) blacklisted by product",
+				str, vendor, product);
 			return 1;
 		}
 	}
@@ -172,14 +213,15 @@
 int
 blacklist_path (struct config * conf, struct path * pp)
 {
-	if (blacklist(conf->blist_devnode, pp->dev))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, pp->dev))
 		return 1;
 
-	if (blacklist(conf->blist_wwid, pp->wwid))
+	if (blacklist(conf->blist_wwid, conf->elist_wwid, pp->wwid))
 		return 1;
 
 	if (pp->vendor_id && pp->product_id &&
-	    blacklist_device(conf->blist_device, pp->vendor_id, pp->product_id))
+	    blacklist_device(conf->blist_device, conf->elist_device, pp->dev,
+			     pp->vendor_id, pp->product_id))
 		return 1;
 
 	return 0;
--- multipath-tools/libmultipath/blacklist.h	2006/06/06 18:32:43	1.6
+++ multipath-tools/libmultipath/blacklist.h	2007/01/10 20:08:08	1.6.2.1
@@ -6,6 +6,7 @@
 struct blentry {
 	char * str;
 	regex_t regex;
+	int origin;
 };
 
 struct blentry_device {
@@ -13,15 +14,16 @@
 	char * product;
 	regex_t vendor_reg;
 	regex_t product_reg;
+	int origin;
 };
 
 int setup_default_blist (struct config *);
 int alloc_ble_device (vector);
-int blacklist (vector, char *);
-int blacklist_device (vector, char *, char *);
+int blacklist (vector, vector, char *);
+int blacklist_device (vector, vector, char *,char *, char *);
 int blacklist_path (struct config *, struct path *);
-int store_ble (vector, char *);
-int set_ble_device (vector, char *, char *);
+int store_ble (vector, char *, int);
+int set_ble_device (vector, char *, char *, int);
 void free_blacklist (vector);
 void free_blacklist_device (vector);
 
--- multipath-tools/libmultipath/config.c	2006/11/30 23:25:13	1.19
+++ multipath-tools/libmultipath/config.c	2007/01/10 20:08:08	1.19.2.1
@@ -324,6 +324,11 @@
 	free_blacklist(conf->blist_devnode);
 	free_blacklist(conf->blist_wwid);
 	free_blacklist_device(conf->blist_device);
+
+	free_blacklist(conf->elist_devnode);
+	free_blacklist(conf->elist_wwid);
+	free_blacklist_device(conf->elist_device);
+
 	free_mptable(conf->mptable);
 	free_hwtable(conf->hwtable);
 	free_keywords(conf->keywords);
@@ -394,6 +399,26 @@
 	if (setup_default_blist(conf))
 		goto out;
 
+	if (conf->elist_devnode == NULL) {
+                conf->elist_devnode = vector_alloc();
+
+                if (!conf->elist_devnode)
+			goto out;
+	}
+	if (conf->elist_wwid == NULL) {
+		conf->elist_wwid = vector_alloc();
+
+                if (!conf->elist_wwid)
+			goto out;
+	}
+
+	if (conf->elist_device == NULL) {
+		conf->elist_device = vector_alloc();
+		
+		if (!conf->elist_device)
+			goto out;
+	}
+
 	if (conf->mptable == NULL) {
 		conf->mptable = vector_alloc();
 
--- multipath-tools/libmultipath/config.h	2006/06/06 18:32:43	1.18
+++ multipath-tools/libmultipath/config.h	2007/01/10 20:08:08	1.18.2.1
@@ -1,6 +1,9 @@
 #ifndef _CONFIG_H
 #define _CONFIG_H
 
+#define ORIGIN_DEFAULT 0
+#define ORIGIN_CONFIG  1
+
 enum devtypes {
 	DEV_NONE,
 	DEV_DEVT,
@@ -77,6 +80,9 @@
 	vector blist_devnode;
 	vector blist_wwid;
 	vector blist_device;
+	vector elist_devnode;
+	vector elist_wwid;
+	vector elist_device;
 };
 
 struct config * conf;
--- multipath-tools/libmultipath/dict.c	2006/06/06 18:32:43	1.17
+++ multipath-tools/libmultipath/dict.c	2007/01/10 20:08:08	1.17.2.1
@@ -264,6 +264,19 @@
 }
 
 static int
+blacklist_exceptions_handler(vector strvec)
+{
+        conf->elist_devnode = vector_alloc();
+        conf->elist_wwid = vector_alloc();
+	conf->elist_device = vector_alloc();
+
+        if (!conf->elist_devnode || !conf->elist_wwid || !conf->blist_device)
+                return 1;
+
+        return 0;
+}
+
+static int
 ble_devnode_handler(vector strvec)
 {
 	char * buff;
@@ -273,7 +286,20 @@
 	if (!buff)
 		return 1;
 
-	return store_ble(conf->blist_devnode, buff);
+	return store_ble(conf->blist_devnode, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_devnode_handler(vector strvec)
+{
+        char * buff;
+
+        buff = set_value(strvec);
+
+        if (!buff)
+                return 1;
+
+	return store_ble(conf->elist_devnode, buff, ORIGIN_CONFIG);
 }
 
 static int
@@ -286,7 +312,20 @@
 	if (!buff)
 		return 1;
 
-	return store_ble(conf->blist_wwid, buff);
+	return store_ble(conf->blist_wwid, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_wwid_handler(vector strvec)
+{
+        char * buff;
+
+        buff = set_value(strvec);
+
+        if (!buff)
+                return 1;
+
+	return store_ble(conf->elist_wwid, buff, ORIGIN_CONFIG);
 }
 
 static int
@@ -296,6 +335,12 @@
 }
 
 static int
+ble_except_device_handler(vector strvec)
+{
+	return alloc_ble_device(conf->elist_device);
+}
+
+static int
 ble_vendor_handler(vector strvec)
 {
 	char * buff;
@@ -305,7 +350,20 @@
 	if (!buff)
 		return 1;
 
-	return set_ble_device(conf->blist_device, buff, NULL);
+	return set_ble_device(conf->blist_device, buff, NULL, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_vendor_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	return set_ble_device(conf->elist_device, buff, NULL, ORIGIN_CONFIG);
 }
 
 static int
@@ -318,7 +376,20 @@
 	if (!buff)
 		return 1;
 
-	return set_ble_device(conf->blist_device, NULL, buff);
+	return set_ble_device(conf->blist_device, NULL, buff, ORIGIN_CONFIG);
+}
+
+static int
+ble_except_product_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
+
+	return set_ble_device(conf->elist_device, NULL, buff, ORIGIN_CONFIG);
 }
 
 /*
@@ -1476,6 +1547,14 @@
 	install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor);
 	install_keyword("product", &ble_product_handler, &snprint_bled_product);
 	install_sublevel_end();
+	install_keyword_root("blacklist_exceptions", &blacklist_exceptions_handler);
+	install_keyword("devnode", &ble_except_devnode_handler, &snprint_ble_simple);
+	install_keyword("wwid", &ble_except_wwid_handler, &snprint_ble_simple);
+	install_keyword("device", &ble_except_device_handler, NULL);
+	install_sublevel();
+	install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor);
+	install_keyword("product", &ble_except_product_handler, &snprint_bled_product);
+	install_sublevel_end();
 
 #if 0
 	__deprecated install_keyword_root("devnode_blacklist", &blacklist_handler);
--- multipath-tools/libmultipath/discovery.c	2006/10/12 16:16:09	1.32
+++ multipath-tools/libmultipath/discovery.c	2007/01/10 20:08:08	1.32.2.1
@@ -104,7 +104,7 @@
 	if (!devname)
 		return 0;
 
-	if (blacklist(conf->blist_devnode, devname))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, devname))
 		return 0;
 
 	if(safe_sprintf(path, "%s/block/%s/device", sysfs_path,
--- multipath-tools/libmultipath/hwtable.c	2006/12/19 22:51:32	1.20.2.2
+++ multipath-tools/libmultipath/hwtable.c	2007/01/10 20:08:08	1.20.2.3
@@ -371,6 +371,7 @@
 		/* IBM S/390 ECKD DASD */
 		.vendor        = "IBM",
 		.product       = "S/390 DASD ECKD",
+		.bl_product    = "S/390.*",
 		.getuid        = "/sbin/dasd_id /dev/%n",
 		.getprio       = NULL,
 		.features      = DEFAULT_FEATURES,
--- multipath-tools/libmultipath/print.c	2006/07/13 19:49:23	1.5
+++ multipath-tools/libmultipath/print.c	2007/01/10 20:08:08	1.5.2.1
@@ -5,6 +5,8 @@
 #include <string.h>
 #include <libdevmapper.h>
 #include <stdarg.h>
+#include <sysfs/dlist.h>
+#include <sysfs/libsysfs.h>
 
 #include <checkers.h>
 
@@ -18,6 +20,7 @@
 #include "pgpolicies.h"
 #include "defaults.h"
 #include "parser.h"
+#include "blacklist.h"
 
 #define MAX(x,y) (x > y) ? x : y
 #define TAIL     (line + len - 1 - c)
@@ -850,6 +853,110 @@
 	
 }
 
+static int
+snprint_blacklist_group (char *buff, int len, int *fwd, vector *vec)
+{
+	int threshold = MAX_LINE_LEN;
+	struct blentry * ble;
+	int pos;
+	int i;
+
+	pos = *fwd;
+	if (!VECTOR_SIZE(*vec)) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		pos += snprintf(buff + pos, len - pos, "        <empty>\n");
+	} else vector_foreach_slot (*vec, ble, i) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		if (ble->origin == ORIGIN_CONFIG)
+			pos += snprintf(buff + pos, len - pos, "        (config file rule) ");
+		else if (ble->origin == ORIGIN_DEFAULT)
+			pos += snprintf(buff + pos, len - pos, "        (default rule)     ");
+		pos += snprintf(buff + pos, len - pos, "%s\n", ble->str);
+	}
+
+	*fwd = pos;
+	return pos;
+}
+
+static int
+snprint_blacklist_devgroup (char *buff, int len, int *fwd, vector *vec)
+{
+	int threshold = MAX_LINE_LEN;
+	struct blentry_device * bled;
+	int pos;
+	int i;
+
+	pos = *fwd;
+	if (!VECTOR_SIZE(*vec)) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		pos += snprintf(buff + pos, len - pos, "        <empty>\n");
+	} else vector_foreach_slot (*vec, bled, i) {
+		if ((len - pos - threshold) <= 0)
+			return 0;
+		if (bled->origin == ORIGIN_CONFIG)
+			pos += snprintf(buff + pos, len - pos, "        (config file rule) ");
+		else if (bled->origin == ORIGIN_DEFAULT)
+			pos += snprintf(buff + pos, len - pos, "        (default rule)     ");
+		pos += snprintf(buff + pos, len - pos, "%s:%s\n", bled->vendor, bled->product);
+	}
+
+	*fwd = pos;
+	return pos;
+}
+
+extern int
+snprint_blacklist_report (char * buff, int len)
+{
+	int threshold = MAX_LINE_LEN;
+	int fwd = 0;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "device node rules:\n"
+			                       "- blacklist:\n");
+	if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_devnode))
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_devnode) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n"
+			                       "- blacklist:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_wwid) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "device rules:\n"
+			                       "- blacklist:\n");
+	if (snprint_blacklist_devgroup(buff, len, &fwd, &conf->blist_device) == 0)
+		return len;
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+	if (snprint_blacklist_devgroup(buff, len, &fwd, &conf->elist_device) == 0)
+		return len;
+
+	if (fwd > len)
+		return len;
+	return fwd;
+}
+
 extern int
 snprint_blacklist (char * buff, int len)
 {
@@ -912,12 +1019,123 @@
 		if (fwd > len)
 			return len;
 	}
+	fwd += snprintf(buff + fwd, len - fwd, "}\n");
+	if (fwd > len)
+		return len;
+	return fwd;
+}
 
+extern int
+snprint_blacklist_except (char * buff, int len)
+{
+	int i;
+	struct blentry * ele;
+	struct blentry_device * eled;
+	int fwd = 0;
+	struct keyword *rootkw;
+	struct keyword *kw;
+
+	rootkw = find_keyword(NULL, "blacklist_exceptions");
+	if (!rootkw)
+		return 0;
+
+	fwd += snprintf(buff + fwd, len - fwd, "blacklist_exceptions {\n");
+	if (fwd > len)
+		return len;
+
+	vector_foreach_slot (conf->elist_devnode, ele, i) {
+		kw = find_keyword(rootkw->sub, "devnode");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+				       kw, ele);
+		if (fwd > len)
+			return len;
+	}
+	vector_foreach_slot (conf->elist_wwid, ele, i) {
+		kw = find_keyword(rootkw->sub, "wwid");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+				       kw, ele);
+		if (fwd > len)
+			return len;
+	}
+	rootkw = find_keyword(rootkw->sub, "device");
+	if (!rootkw)
+		return 0;
+
+	vector_foreach_slot (conf->elist_device, eled, i) {
+		fwd += snprintf(buff + fwd, len - fwd, "\tdevice {\n");
+		if (fwd > len)
+			return len;
+		kw = find_keyword(rootkw->sub, "vendor");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+				       kw, eled);
+		if (fwd > len)
+			return len;
+		kw = find_keyword(rootkw->sub, "product");
+		if (!kw)
+			return 0;
+		fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+				       kw, eled);
+		if (fwd > len)
+			return len;
+		fwd += snprintf(buff + fwd, len - fwd, "\t}\n");
+		if (fwd > len)
+			return len;
+	}
 	fwd += snprintf(buff + fwd, len - fwd, "}\n");
 	if (fwd > len)
 		return len;
 	return fwd;
-	
+}
+
+extern int
+snprint_devices (char * buff, int len, struct vectors *vecs)
+{
+        struct dlist * ls;
+        struct sysfs_class * class;
+        struct sysfs_class_device * dev;
+	int threshold = MAX_LINE_LEN;
+	int fwd = 0;
+
+
+	struct path * pp;
+
+
+
+        if (!(class = sysfs_open_class("block")))
+                return 0;
+
+        if (!(ls = sysfs_get_class_devices(class))) {
+                sysfs_close_class(class);
+                return 0;
+        }
+
+	if ((len - fwd - threshold) <= 0)
+		return len;
+	fwd += snprintf(buff + fwd, len - fwd, "available block devices:\n");
+
+        dlist_for_each_data(ls, dev, struct sysfs_class_device) {
+		if ((len - fwd - threshold)  <= 0)
+			return len;
+		fwd += snprintf(buff + fwd, len - fwd, "    %s ", dev->name);
+		pp = find_path_by_dev(vecs->pathvec, dev->name);
+		if (blacklist(conf->blist_devnode, conf->elist_devnode,
+			      dev->name) || pp == NULL)
+			fwd += snprintf(buff + fwd, len - fwd,
+					"(blacklisted)\n");
+                else
+			fwd += snprintf(buff + fwd, len - fwd, "\n");
+        }
+        sysfs_close_class(class);
+
+	if (fwd > len)
+		return len;
+	return fwd;
 }
 
 extern int
--- multipath-tools/libmultipath/print.h	2006/06/06 18:32:43	1.3
+++ multipath-tools/libmultipath/print.h	2007/01/10 20:08:08	1.3.2.1
@@ -42,6 +42,9 @@
 				int verbosity);
 int snprint_defaults (char *, int);
 int snprint_blacklist (char *, int);
+int snprint_blacklist_except (char *, int);
+int snprint_blacklist_report (char *, int);
+int snprint_devices (char *, int, struct vectors *);
 int snprint_hwtable (char *, int, vector);
 int snprint_mptable (char *, int, vector);
 
--- multipath-tools/multipath/main.c	2006/11/30 23:25:13	1.44
+++ multipath-tools/multipath/main.c	2007/01/10 20:08:08	1.44.2.1
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44 2006/11/30 23:25:13 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.1 2007/01/10 20:08:08 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -232,7 +232,7 @@
 			dev = conf->dev;
 	}
 	
-	if (dev && blacklist(conf->blist_devnode, dev))
+	if (dev && blacklist(conf->blist_devnode, conf->elist_devnode, dev))
 		goto out;
 	
 	/*
@@ -248,7 +248,7 @@
 		}
 		condlog(3, "scope limited to %s", refwwid);
 
-		if (blacklist(conf->blist_wwid, refwwid))
+		if (blacklist(conf->blist_wwid, conf->elist_wwid, refwwid))
 			goto out;
 	}
 
--- multipath-tools/multipath/multipath.conf.redhat	2006/12/14 23:44:33	1.6.2.1
+++ multipath-tools/multipath/multipath.conf.redhat	2007/01/10 20:08:08	1.6.2.2
@@ -11,6 +11,16 @@
         devnode "*"
 }
 
+## By default, devices with vendor = "IBM" and product = "S/390.*" are
+## blacklisted. To enable mulitpathing on these devies, uncomment the
+## following lines.
+#blacklist_exceptions {
+#	device {
+#		vendor	"IBM"
+#		product	"S/390.*"
+#	}
+#}
+
 ## Use user friendly names, instead of using WWIDs as names.
 defaults {
 	user_friendly_names yes
--- multipath-tools/multipathd/cli.c	2006/06/06 18:32:44	1.5
+++ multipath-tools/multipathd/cli.c	2007/01/10 20:08:09	1.5.2.1
@@ -141,6 +141,8 @@
 	r += add_key(keys, "stats", STATS, 0);
 	r += add_key(keys, "topology", TOPOLOGY, 0);
 	r += add_key(keys, "config", CONFIG, 0);
+	r += add_key(keys, "blacklist", BLACKLIST, 0);
+	r += add_key(keys, "devices", DEVICES, 0);
 
 	if (r) {
 		free_keys(keys);
--- multipath-tools/multipathd/cli.h	2006/06/06 18:32:44	1.5
+++ multipath-tools/multipathd/cli.h	2007/01/10 20:08:09	1.5.2.1
@@ -17,6 +17,8 @@
 	__STATS,
 	__TOPOLOGY,
 	__CONFIG,
+	__BLACKLIST,
+	__DEVICES,
 };
 
 #define LIST		(1 << __LIST)
@@ -37,6 +39,8 @@
 #define STATS		(1 << __STATS)
 #define TOPOLOGY	(1 << __TOPOLOGY)
 #define CONFIG		(1 << __CONFIG)
+#define BLACKLIST	(1 << __BLACKLIST)
+#define DEVICES  	(1 << __DEVICES)
 
 #define INITIAL_REPLY_LEN 1000
 
--- multipath-tools/multipathd/cli_handlers.c	2006/07/13 19:49:23	1.6
+++ multipath-tools/multipathd/cli_handlers.c	2007/01/10 20:08:09	1.6.2.1
@@ -143,6 +143,12 @@
 			reply = REALLOC(reply, maxlen *= 2);
 			continue;
 		}
+		c += snprint_blacklist_except(c, reply + maxlen - c);
+		again = ((c - reply) == maxlen);
+		if (again) {
+			reply = REALLOC(reply, maxlen *= 2);
+			continue;
+		}
 		c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable);
 		again = ((c - reply) == maxlen);
 		if (again) {
@@ -280,7 +286,7 @@
 
 	condlog(2, "%s: add path (operator)", param);
 
-	if (blacklist(conf->blist_devnode, param) ||
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, param) ||
 	    (r = ev_add_path(param, vecs)) == 2) {
 		*reply = strdup("blacklisted");
 		*len = strlen(*reply) + 1;
@@ -309,7 +315,7 @@
 
 	condlog(2, "%s: add map (operator)", param);
 
-	if (blacklist(conf->blist_wwid, param)) {
+	if (blacklist(conf->blist_wwid, conf->elist_wwid, param)) {
 		*reply = strdup("blacklisted");
 		*len = strlen(*reply) + 1;
 		condlog(2, "%s: map blacklisted", param);
@@ -433,3 +439,79 @@
 
 	return dm_fail_path(pp->mpp->alias, pp->dev_t);
 }
+
+int
+show_blacklist (char ** r, int * len)
+{
+        char *c = NULL;
+        char *reply = NULL;
+        unsigned int maxlen = INITIAL_REPLY_LEN;
+        int again = 1;
+
+        while (again) {
+		reply = MALLOC(maxlen);
+		if (!reply)
+			return 1;
+
+                c = reply;
+                c += snprint_blacklist_report(c, maxlen);
+                again = ((c - reply) == maxlen);
+                if (again) {
+			maxlen  *= 2;
+			FREE(reply);
+                        continue;
+                }
+        }
+
+        *r = reply;
+        *len = (int)(c - reply + 1);
+
+        return 0;
+}
+
+int
+cli_list_blacklist (void * v, char ** reply, int * len, void * data)
+{
+        condlog(3, "list blacklist (operator)");
+
+        return show_blacklist(reply, len);
+}
+
+int
+show_devices (char ** r, int * len, struct vectors *vecs)
+{
+        char *c = NULL;
+        char *reply = NULL;
+        unsigned int maxlen = INITIAL_REPLY_LEN;
+        int again = 1;
+
+        while (again) {
+                reply = MALLOC(maxlen);
+                if (!reply)
+                        return 1;
+
+                c = reply;
+                c += snprint_devices(c, maxlen, vecs);
+                again = ((c - reply) == maxlen);
+                if (again) {
+                        maxlen  *= 2;
+                        FREE(reply);
+                        continue;
+                }
+        }
+
+        *r = reply;
+        *len = (int)(c - reply + 1);
+
+        return 0;
+}
+
+int
+cli_list_devices (void * v, char ** reply, int * len, void * data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+
+        condlog(3, "list devices (operator)");
+
+        return show_devices(reply, len, vecs);
+}
--- multipath-tools/multipathd/cli_handlers.h	2006/06/06 18:32:44	1.3
+++ multipath-tools/multipathd/cli_handlers.h	2007/01/10 20:08:09	1.3.2.1
@@ -5,6 +5,8 @@
 int cli_list_map_topology (void * v, char ** reply, int * len, void * data);
 int cli_list_maps_topology (void * v, char ** reply, int * len, void * data);
 int cli_list_config (void * v, char ** reply, int * len, void * data);
+int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
+int cli_list_devices (void * v, char ** reply, int * len, void * data);
 int cli_add_path (void * v, char ** reply, int * len, void * data);
 int cli_del_path (void * v, char ** reply, int * len, void * data);
 int cli_add_map (void * v, char ** reply, int * len, void * data);
--- multipath-tools/multipathd/main.c	2006/10/12 16:16:09	1.69
+++ multipath-tools/multipathd/main.c	2007/01/10 20:08:09	1.69.2.1
@@ -675,7 +675,7 @@
 	/*
 	 * path add/remove event
 	 */
-	if (blacklist(conf->blist_devnode, devname))
+	if (blacklist(conf->blist_devnode, conf->elist_devnode, devname))
 		goto out;
 
 	if (!strncmp(uev->action, "add", 3)) {
@@ -718,6 +718,8 @@
 	add_handler(LIST+TOPOLOGY, cli_list_maps_topology);
 	add_handler(LIST+MAP+TOPOLOGY, cli_list_map_topology);
 	add_handler(LIST+CONFIG, cli_list_config);
+	add_handler(LIST+BLACKLIST, cli_list_blacklist);
+	add_handler(LIST+DEVICES, cli_list_devices);
 	add_handler(ADD+PATH, cli_add_path);
 	add_handler(DEL+PATH, cli_del_path);
 	add_handler(ADD+MAP, cli_add_map);

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

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

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-04 20:09 multipath-tools ./multipath.conf.annotated ./m bmarzins
  -- strict thread matches above, loose matches on Subject: below --
2011-10-10  4:15 bmarzins
2009-01-17  0:46 bmarzins
2008-09-08 22:01 bmarzins
2008-08-25 20:59 bmarzins
2008-04-14 22:40 bmarzins
2008-04-14 22:32 bmarzins
2008-01-25 22:30 wysochanski
2008-01-15  1:34 bmarzins
2007-12-03 18:42 bmarzins
2007-10-19 21:41 bmarzins
2007-10-11 20:17 bmarzins
2007-06-19 18:12 bmarzins
2007-01-15 21:52 bmarzins
2007-01-10 20:08 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.