All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools libmultipath/config.c libmulti ...
@ 2012-07-11 23:03 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2012-07-11 23:03 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2012-07-11 23:03:35

Modified files:
	libmultipath   : config.c config.h dict.c hwtable.c propsel.c 
	                 structs.h 
	multipathd     : cli.c cli.h cli_handlers.c cli_handlers.h 
	                 main.c multipathd.init.redhat 
	path_priority/pp_alua: mpath_prio_alua.8 

Log message:
	Fix for bzs #644989, #799847, #833193, and #744231
	
	Backport RHEL6 config changes.
	Yet another fix to the ramfs.
	Fixup mpath_prio_alua man page
	
	Not applicable upstream

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.11&r2=1.19.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.17&r2=1.18.2.18
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.22&r2=1.17.2.23
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.20.2.38&r2=1.20.2.39
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.11.2.7&r2=1.11.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.10&r2=1.18.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.4&r2=1.5.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.3&r2=1.5.2.4
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.4&r2=1.6.2.5
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.3&r2=1.3.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.41&r2=1.69.2.42
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/multipathd.init.redhat.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.4.6&r2=1.2.4.7
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/mpath_prio_alua.8.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2&r2=1.2.2.1

--- multipath-tools/libmultipath/config.c	2011/10/27 21:36:19	1.19.2.11
+++ multipath-tools/libmultipath/config.c	2012/07/11 23:03:34	1.19.2.12
@@ -332,6 +332,11 @@
 	hwe->no_path_retry = dhwe->no_path_retry;
 	hwe->minio = dhwe->minio;
 	hwe->checker = dhwe->checker;
+	hwe->pg_timeout = dhwe->pg_timeout;
+	hwe->flush_on_last_del = dhwe->flush_on_last_del;
+	hwe->fast_io_fail = dhwe->fast_io_fail;
+	hwe->dev_loss = dhwe->dev_loss;
+	hwe->user_friendly_names = dhwe->user_friendly_names;
 
 	if (dhwe->bl_product && !(hwe->bl_product = set_param_str(dhwe->bl_product)))
 		goto out;
@@ -415,7 +420,7 @@
 
 	conf->dev_type = DEV_NONE;
 	conf->minio = 1000;
-	conf->max_fds = 0;
+	conf->max_fds = MAX_FDS_MAX;
 	conf->attribute_flags = 0;
 	conf->flush_on_last_del = 0;
 	conf->file_timeout = DEFAULT_FILE_TIMEOUT;
--- multipath-tools/libmultipath/config.h	2012/06/14 21:56:47	1.18.2.17
+++ multipath-tools/libmultipath/config.h	2012/07/11 23:03:34	1.18.2.18
@@ -32,6 +32,7 @@
 	int flush_on_last_del;
 	int fast_io_fail;
 	unsigned int dev_loss;
+	int user_friendly_names;
 	struct checker * checker;
 	char * bl_product;
 };
@@ -51,6 +52,7 @@
 	int pg_timeout;
 	int attribute_flags;
 	int flush_on_last_del;
+	int user_friendly_names;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/dict.c	2011/10/27 21:36:20	1.17.2.22
+++ multipath-tools/libmultipath/dict.c	2012/07/11 23:03:34	1.17.2.23
@@ -455,7 +455,7 @@
 }
 
 static int
-names_handler(vector strvec)
+def_names_handler(vector strvec)
 {
 	char * buff;
 
@@ -466,10 +466,12 @@
 
 	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
 	    (strlen(buff) == 1 && !strcmp(buff, "0")))
-		conf->user_friendly_names = 0;
+		conf->user_friendly_names = USER_FRIENDLY_NAMES_OFF;
 	else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
 		 (strlen(buff) == 1 && !strcmp(buff, "1")))
-		conf->user_friendly_names = 1;
+		conf->user_friendly_names = USER_FRIENDLY_NAMES_ON;
+	else
+		conf->user_friendly_names = USER_FRIENDLY_NAMES_UNDEF;
 
 	FREE(buff);
 	return 0;
@@ -1072,6 +1074,32 @@
 	return 0;
 }
 
+static int
+hw_names_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 ((strlen(buff) == 2 && strcmp(buff, "no") == 0) ||
+			(strlen(buff) == 1 && strcmp(buff, "0") == 0))
+		hwe->user_friendly_names = USER_FRIENDLY_NAMES_OFF;
+	else if ((strlen(buff) == 3 && strcmp(buff, "yes") == 0) ||
+			(strlen(buff) == 1 && strcmp(buff, "1") == 0))
+		hwe->user_friendly_names = USER_FRIENDLY_NAMES_ON;
+	else
+		hwe->user_friendly_names = USER_FRIENDLY_NAMES_UNDEF;
+
+	FREE(buff);
+	return 0;
+}
+
 /*
  * multipaths block handlers
  */
@@ -1426,6 +1454,32 @@
 	return 0;
 }
 
+static int
+mp_names_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 ((strlen(buff) == 2 && strcmp(buff, "no") == 0) ||
+			(strlen(buff) == 1 && strcmp(buff, "0") == 0))
+		mpe->user_friendly_names = USER_FRIENDLY_NAMES_OFF;
+	else if ((strlen(buff) == 3 && strcmp(buff, "yes") == 0) ||
+			(strlen(buff) == 1 && strcmp(buff, "1") == 0))
+		mpe->user_friendly_names = USER_FRIENDLY_NAMES_ON;
+	else
+		mpe->user_friendly_names = USER_FRIENDLY_NAMES_UNDEF;
+
+	FREE(buff);
+	return 0;
+}
+
 /*
  * config file keywords printing
  */
@@ -1613,6 +1667,19 @@
 }
 
 static int
+snprint_mp_user_friendly_names (char * buff, int len, void * data)
+{
+	struct mpentry * mpe = (struct mpentry *)data;
+
+	if (mpe->user_friendly_names == USER_FRIENDLY_NAMES_UNDEF)
+		return 0;
+	else if (mpe->user_friendly_names == USER_FRIENDLY_NAMES_OFF)
+		return snprintf(buff, len, "no");
+	else
+		return snprintf(buff, len, "yes");
+}
+
+static int
 snprint_hw_fast_io_fail(char * buff, int len, void * data)
 {
 	struct hwentry * hwe = (struct hwentry *)data;
@@ -1851,6 +1918,19 @@
 }
 
 static int
+snprint_hw_user_friendly_names (char * buff, int len, void * data)
+{
+	struct hwentry * hwe = (struct hwentry *)data;
+
+	if (hwe->user_friendly_names == USER_FRIENDLY_NAMES_UNDEF)
+		return 0;
+	else if (hwe->user_friendly_names == USER_FRIENDLY_NAMES_OFF)
+		return snprintf(buff, len, "no");
+	else
+		return snprintf(buff, len, "yes");
+}
+
+static int
 snprint_def_polling_interval (char * buff, int len, void * data)
 {
 	return snprintf(buff, len, "%i", conf->checkint);
@@ -2053,10 +2133,12 @@
 {
 	switch (conf->queue_without_daemon) {
 	case QUE_NO_DAEMON_OFF:
-		return snprintf(buff, len, "no");
 	case QUE_NO_DAEMON_UNDEF:
+		return snprintf(buff, len, "no");
 	case QUE_NO_DAEMON_ON:
 		return snprintf(buff, len, "yes");
+	case QUE_NO_DAEMON_FORCE:
+		return snprintf(buff, len, "forced");
 	}
 	return 0;
 }
@@ -2103,10 +2185,10 @@
 static int
 snprint_def_user_friendly_names (char * buff, int len, void * data)
 {
-	if (!conf->user_friendly_names)
+	if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON)
+		return snprintf(buff, len, "yes");
+	else
 		return snprintf(buff, len, "no");
-
-	return snprintf(buff, len, "yes");
 }
 
 static int
@@ -2194,7 +2276,7 @@
 	install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
 	install_keyword("checker_timeout", &def_checker_timeout_handler, &snprint_def_checker_timeout);
 	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("user_friendly_names", &def_names_handler, &snprint_def_user_friendly_names);
 	install_keyword("pg_prio_calc", &def_pg_prio_calc_handler, &snprint_def_pg_prio_calc);
 	install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
 	install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
@@ -2261,6 +2343,7 @@
 	install_keyword("pg_timeout", &hw_pg_timeout_handler, &snprint_hw_pg_timeout);
 	install_keyword("fast_io_fail_tmo", &hw_fast_io_fail_handler, &snprint_hw_fast_io_fail);
 	install_keyword("dev_loss_tmo", &hw_dev_loss_handler, &snprint_hw_dev_loss);
+	install_keyword("user_friendly_names", &hw_names_handler, &snprint_hw_user_friendly_names);
 	install_sublevel_end();
 
 	install_keyword_root("multipaths", &multipaths_handler);
@@ -2280,5 +2363,6 @@
 	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_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names);
 	install_sublevel_end();
 }
--- multipath-tools/libmultipath/hwtable.c	2012/06/14 21:56:47	1.20.2.38
+++ multipath-tools/libmultipath/hwtable.c	2012/07/11 23:03:34	1.20.2.39
@@ -716,7 +716,7 @@
 		.product       = "LUN.*",
 		.getuid        = DEFAULT_GETUID,
 		.getprio       = "/sbin/mpath_prio_ontap /dev/%n",
-		.features      = "1 queue_if_no_path",
+		.features      = "3 queue_if_no_path pg_init_retries 50",
 		.hwhandler     = DEFAULT_HWHANDLER,
 		.selector      = DEFAULT_SELECTOR,
 		.pgpolicy      = GROUP_BY_PRIO,
@@ -724,7 +724,7 @@
 		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
 		.minio         = 128,
-		.checker_name  = DIRECTIO,
+		.checker_name  = TUR,
 	},
  	/*
 	 * IBM NSeries (NETAPP) controller family
--- multipath-tools/libmultipath/propsel.c	2012/06/14 21:56:47	1.11.2.7
+++ multipath-tools/libmultipath/propsel.c	2012/07/11 23:03:34	1.11.2.8
@@ -156,6 +156,18 @@
 	return 0;
 }
 
+static int
+want_user_friendly_names(struct multipath * mp)
+{
+	if (mp->mpe &&
+	    mp->mpe->user_friendly_names != USER_FRIENDLY_NAMES_UNDEF)
+		return (mp->mpe->user_friendly_names == USER_FRIENDLY_NAMES_ON);
+	if (mp->hwe &&
+	    mp->hwe->user_friendly_names != USER_FRIENDLY_NAMES_UNDEF)
+		return (mp->hwe->user_friendly_names == USER_FRIENDLY_NAMES_ON);
+	return (conf->user_friendly_names  == USER_FRIENDLY_NAMES_ON);
+}
+
 extern int
 select_alias (struct multipath * mp)
 {
@@ -163,7 +175,7 @@
 		mp->alias = mp->mpe->alias;
 	else {
 		mp->alias = NULL;
-		if (conf->user_friendly_names)
+		if (want_user_friendly_names(mp))
 			mp->alias = get_user_friendly_alias(mp->wwid,
 					conf->bindings_file,
 					conf->bindings_read_only);
--- multipath-tools/libmultipath/structs.h	2011/10/10 03:03:17	1.18.2.10
+++ multipath-tools/libmultipath/structs.h	2012/07/11 23:03:34	1.18.2.11
@@ -82,6 +82,7 @@
 	QUE_NO_DAEMON_UNDEF,
 	QUE_NO_DAEMON_OFF,
 	QUE_NO_DAEMON_ON,
+	QUE_NO_DAEMON_FORCE,
 };
 
 enum pg_prio_calc_states {
@@ -94,6 +95,12 @@
 	LOG_CHKR_ERR_ONCE,
 };
 
+enum user_friendly_names_states {
+	USER_FRIENDLY_NAMES_UNDEF,
+	USER_FRIENDLY_NAMES_OFF,
+	USER_FRIENDLY_NAMES_ON,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
--- multipath-tools/multipathd/cli.c	2009/05/06 17:26:44	1.5.2.4
+++ multipath-tools/multipathd/cli.c	2012/07/11 23:03:34	1.5.2.5
@@ -129,6 +129,7 @@
 	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, "forcequeueing", FORCEQ, 0);
 	r += add_key(keys, "disablequeueing", DISABLEQ, 0);
 	r += add_key(keys, "restorequeueing", RESTOREQ, 0);
 	r += add_key(keys, "resize", RESIZE, 0);
@@ -140,6 +141,7 @@
 	r += add_key(keys, "multipath", MAP, 1);
 	r += add_key(keys, "group", GROUP, 1);
 	r += add_key(keys, "reconfigure", RECONFIGURE, 0);
+	r += add_key(keys, "daemon", MPATH_DAEMON, 0);
 	r += add_key(keys, "status", STATUS, 0);
 	r += add_key(keys, "stats", STATS, 0);
 	r += add_key(keys, "topology", TOPOLOGY, 0);
--- multipath-tools/multipathd/cli.h	2008/09/19 03:27:08	1.5.2.3
+++ multipath-tools/multipathd/cli.h	2012/07/11 23:03:34	1.5.2.4
@@ -7,6 +7,7 @@
 	__RESUME,
 	__REINSTATE,
 	__FAIL,
+	__FORCEQ,
 	__DISABLEQ,
 	__RESTOREQ,
 	__RESIZE,
@@ -16,6 +17,7 @@
 	__MAP,
 	__GROUP,
 	__RECONFIGURE,
+	__MPATH_DAEMON,
 	__STATUS,
 	__STATS,
 	__TOPOLOGY,
@@ -32,6 +34,7 @@
 #define RESUME		(1 << __RESUME)
 #define REINSTATE	(1 << __REINSTATE)
 #define FAIL		(1 << __FAIL)
+#define FORCEQ		(1 << __FORCEQ)
 #define DISABLEQ	(1 << __DISABLEQ)
 #define RESTOREQ	(1 << __RESTOREQ)
 #define RESIZE		(1 << __RESIZE)
@@ -41,6 +44,7 @@
 #define MAP		(1 << __MAP)
 #define GROUP		(1 << __GROUP)
 #define RECONFIGURE	(1 << __RECONFIGURE)
+#define MPATH_DAEMON	(1 << __MPATH_DAEMON)
 #define STATUS		(1 << __STATUS)
 #define STATS		(1 << __STATS)
 #define TOPOLOGY	(1 << __TOPOLOGY)
--- multipath-tools/multipathd/cli_handlers.c	2008/09/19 04:00:21	1.6.2.4
+++ multipath-tools/multipathd/cli_handlers.c	2012/07/11 23:03:34	1.6.2.5
@@ -338,6 +338,25 @@
 }
 
 int
+cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data)
+{
+	condlog(2, "force queue_without_daemon (operator)");
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF ||
+	    conf->queue_without_daemon == QUE_NO_DAEMON_UNDEF)
+		conf->queue_without_daemon = QUE_NO_DAEMON_FORCE;
+	return 0;
+}
+
+int
+cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data)
+{
+	condlog(2, "restore queue_without_daemon (operator)");
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_FORCE)
+		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
+	return 0;
+}
+
+int
 cli_restore_queueing(void *v, char **reply, int *len, void *data)
 {
 	struct vectors * vecs = (struct vectors *)data;
--- multipath-tools/multipathd/cli_handlers.h	2008/09/19 03:27:08	1.3.2.3
+++ multipath-tools/multipathd/cli_handlers.h	2012/07/11 23:03:34	1.3.2.4
@@ -15,6 +15,8 @@
 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_disable_all_queueing(void * v, char ** reply, int * len, void * data);
+int cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data);
+int cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data);
 int cli_restore_queueing(void * v, char ** reply, int * len, void * data);
 int cli_restore_all_queueing(void * v, char ** reply, int * len, void * data);
 int cli_resize(void * v, char ** reply, int * len, void * data);
--- multipath-tools/multipathd/main.c	2012/06/14 21:56:47	1.69.2.41
+++ multipath-tools/multipathd/main.c	2012/07/11 23:03:34	1.69.2.42
@@ -790,6 +790,8 @@
 	add_handler(RESUME+MAP, cli_resume);
 	add_handler(REINSTATE+PATH, cli_reinstate);
 	add_handler(FAIL+PATH, cli_fail);
+	add_handler(FORCEQ+MPATH_DAEMON, cli_force_no_daemon_q);
+	add_handler(RESTOREQ+MPATH_DAEMON, cli_restore_no_daemon_q);
 	add_handler(DISABLEQ+MAP, cli_disable_queueing);
 	add_handler(RESTOREQ+MAP, cli_restore_queueing);
 	add_handler(DISABLEQ+MAPS, cli_disable_all_queueing);
@@ -1423,7 +1425,8 @@
 		    strcmp(mnt, "/usr") == 0 || strncmp(mnt, "/usr/lib", 8) == 0 ||
 		    strcmp(mnt, "/etc") == 0 || strncmp(mnt, "/proc", 5) == 0 ||
 		    strncmp(mnt, "/dev", 4) == 0 || strncmp(mnt, "/sys", 4) == 0 ||
-		    strcmp(mnt, "/var") == 0 || strncmp(mnt, "/var/lib", 8) == 0 ||
+		    strcmp(mnt, "/var") == 0 || strcmp(mnt, "/var/lib") == 0 ||
+		    strcmp(mnt, "/var/lib/multipath") == 0 ||
 		    strncmp(mnt, "/var/run", 8) == 0 || strncmp(mnt, "/lib", 4) == 0 ||
 		    strncmp(mnt, "/lib64", 6) == 0 || strncmp(mnt, "/usr/lib64", 10) == 0 ||
 		    strncmp(mnt, "/ram", 4) == 0)
@@ -1529,6 +1532,9 @@
 	free_strvec(conf->binvec);
 	conf->binvec = NULL;
 
+	if (unmount_extra_devs() < 0)
+		return -1;
+
 	/*
 	 * bind the ramfs to :
 	 * /sbin : default home of multipath ...
@@ -1550,8 +1556,6 @@
 		return -1;
 	}
 	condlog(4, "bind ramfs on /tmp");
-	if (unmount_extra_devs() < 0)
-		return -1;
 	return 0;
 }
 #endif
@@ -1784,7 +1788,8 @@
 	block_signal(SIGHUP, NULL);
 	lock(vecs->lock);
 	exitting = 1;
-	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF ||
+	    conf->queue_without_daemon == QUE_NO_DAEMON_UNDEF)
 		vector_foreach_slot(vecs->mpvec, mpp, i)
 			dm_queue_if_no_path(mpp->alias, 0);
 	remove_maps(vecs, stop_waiter_thread);
--- multipath-tools/multipathd/multipathd.init.redhat	2009/08/31 21:58:52	1.2.4.6
+++ multipath-tools/multipathd/multipathd.init.redhat	2012/07/11 23:03:34	1.2.4.7
@@ -70,14 +70,16 @@
 	echo
 }
 
-stop() {
+check_root() {
         root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
 	dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
 	if [ $? -eq 0 ]; then
 		root_dm_device="dm-$dm_num"
 		[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
 	fi
+}
 
+stop() {
 	echo -n $"Stopping $prog daemon: "
 	killproc $DAEMON
 	RETVAL=$?
@@ -85,7 +87,12 @@
 	echo
 }
 
+force_queue_without_daemon() {
+	$DAEMON -k"forcequeueing daemon"
+}
+
 restart() {
+	force_queue_without_daemon
 	stop
 	start
 }	
@@ -103,6 +110,7 @@
 	start
 	;;
 stop)
+	check_root
 	stop
 	;;
 reload)
--- multipath-tools/path_priority/pp_alua/mpath_prio_alua.8	2006/08/02 21:37:23	1.2
+++ multipath-tools/path_priority/pp_alua/mpath_prio_alua.8	2012/07/11 23:03:34	1.2.2.1
@@ -122,7 +122,7 @@
 group_by_prio
 .TP
 .B  prio_callout
-"/sbin/mpath_prio_alua -d/tmp %d"
+"/sbin/mpath_prio_alua /dev/%n"
 .TP
 .B  features
 "1 queue_if_no_path"
@@ -144,12 +144,6 @@
 .RB "characters long (for " vendor ") and 16 characters long (for " product ")."
 The strings have to be padded with blanks if necessary.
 .IP \(bu
-If you are working with hotpluggable devices whose device nodes are created
-by udev you should use the %d flag in the
-.BR prio_callout " statement."
-This is because a short time elapses between the devices being available
-and udev creating the device nodes.
-.IP \(bu
 If under certain circumstances your storage subsystem temporarily reports
 .RB "failures on all paths, you should use the " features " statement showed"
 in the example.

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

* multipath-tools libmultipath/config.c libmulti ...
@ 2011-10-27 21:36 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2011-10-27 21:36 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-27 21:36:20

Modified files:
	libmultipath   : config.c config.h dict.c print.c 
	multipathd     : main.c 

Log message:
	fix for bz #703277.  When checking for mounts to keep in the multipathd
	namespace, check if a necessary directory is a symlink, and if so, keep mounts
	at its target, or at any parent directories. Also add a new default option,
	keep_dir, to allow users to manually select directories to keep. Mounts at
	these, or their parent directories will also be kept.  Not applicable upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.10&r2=1.19.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.15&r2=1.18.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.21&r2=1.17.2.22
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.3&r2=1.5.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.38&r2=1.69.2.39

--- multipath-tools/libmultipath/config.c	2011/04/05 18:41:45	1.19.2.10
+++ multipath-tools/libmultipath/config.c	2011/10/27 21:36:19	1.19.2.11
@@ -394,6 +394,7 @@
 	free_hwtable(conf->hwtable);
 	free_keywords(conf->keywords);
 	free_strvec(conf->binvec);
+	free_strvec(conf->keep_dirs);
 	FREE(conf);
 }
 
@@ -418,6 +419,9 @@
 	conf->attribute_flags = 0;
 	conf->flush_on_last_del = 0;
 	conf->file_timeout = DEFAULT_FILE_TIMEOUT;
+	conf->keep_dirs = vector_alloc();
+	if (!conf->keep_dirs)
+		goto out;
 
 	/*
 	 * read the config file
--- multipath-tools/libmultipath/config.h	2011/04/05 18:41:45	1.18.2.15
+++ multipath-tools/libmultipath/config.h	2011/10/27 21:36:20	1.18.2.16
@@ -103,6 +103,7 @@
 	vector mptable;
 	vector hwtable;
 	vector binvec;
+	vector keep_dirs;
 
 	vector blist_devnode;
 	vector blist_wwid;
--- multipath-tools/libmultipath/dict.c	2011/10/10 04:18:38	1.17.2.21
+++ multipath-tools/libmultipath/dict.c	2011/10/27 21:36:20	1.17.2.22
@@ -524,6 +524,24 @@
 	return 0;
 }
 
+static int
+keep_dir_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!vector_alloc_slot(conf->keep_dirs)) {
+		free(buff);
+		return 1;
+	}
+	vector_set_slot(conf->keep_dirs, buff);
+
+	return 0;
+}
+
 /*
  * blacklist block handlers
  */
@@ -2117,6 +2135,16 @@
 }
 
 static int
+snprint_keep_dir(char * buff, int len, void * data)
+{
+	char *str = (char *)data;
+
+	if (!str || str[0] == '\0')
+		return 0;
+	return snprintf(buff, len, "\"%s\"", str);
+}
+
+static int
 snprint_ble_simple (char * buff, int len, void * data)
 {
 	struct blentry * ble = (struct blentry *)data;
@@ -2176,6 +2204,7 @@
 	install_keyword("fast_io_fail_tmo", &def_fast_io_fail_handler, &snprint_def_fast_io_fail);
 	install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss);
 	install_keyword("file_timeout", &file_timeout_handler, &snprint_file_timeout);
+	install_keyword_multi("keep_dir", &keep_dir_handler, &snprint_keep_dir);
 	__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);
--- multipath-tools/libmultipath/print.c	2008/08/22 21:55:43	1.5.2.3
+++ multipath-tools/libmultipath/print.c	2011/10/27 21:36:20	1.5.2.4
@@ -853,6 +853,20 @@
 		return len;
 
 	iterate_sub_keywords(rootkw, kw, i) {
+		if (strcmp(kw->string, "keep_dir") == 0) {
+			char *str;
+			int j;
+			if (!conf->keep_dirs)
+				continue;
+			vector_foreach_slot(conf->keep_dirs, str, j) {
+				fwd += snprint_keyword(buff + fwd, len - fwd,
+						       "\t%k %v\n", kw, str);
+				if (fwd > len)
+					return len;
+			}
+			continue;
+
+		}
 		fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
 				kw, NULL);
 		if (fwd > len)
--- multipath-tools/multipathd/main.c	2011/10/24 13:46:54	1.69.2.38
+++ multipath-tools/multipathd/main.c	2011/10/27 21:36:20	1.69.2.39
@@ -1336,6 +1336,43 @@
 }
 
 static int
+find_keep_dirs(void)
+{
+	int i, j, r;
+	char link_target[PATH_MAX];
+	char *dir;
+	char *needed_dirs[15] = { "/sbin", "/bin", "/tmp", "/usr", "/usr/lib",
+				  "/etc", "/proc", "/sys", "/var", "/var/lib",
+				  "/var/run", "/lib", "/lib64", "/usr/lib64",
+				  "/ram" };
+	for (i = 0; i < 15; i++) {
+		r = readlink(needed_dirs[i], link_target, PATH_MAX - 1);
+		if (r <= 0)
+			continue;
+		link_target[r] = '\0';
+		vector_foreach_slot(conf->keep_dirs, dir, j)
+			if (strcmp(dir, link_target) == 0)
+				goto next;
+		dir = strdup(link_target);
+		if (!dir) {
+			condlog(0, "can't allocate symlink space for %s",
+				needed_dirs[i]);
+			return -1;
+		}
+		if (!vector_alloc_slot(conf->keep_dirs)) {
+			condlog(0, "can't store symlink for %s",
+				needed_dirs[i]);
+			free(dir);
+			return -1;
+		}
+		vector_set_slot(conf->keep_dirs, dir);
+next:
+		;
+	}
+	return 0;
+}
+
+static int
 unmount_extra_devs(void)
 {
 	char buf[LINE_MAX];
@@ -1346,8 +1383,10 @@
 		condlog(0, "couldn't open /proc/mounts : %s", strerror(errno));
 		return -1;
 	}
-
+	find_keep_dirs();
 	while (fgets(buf, LINE_MAX, file)) {
+		int i;
+		char *keep;
 		char *end, *mnt = strchr(buf, ' ');
 		if (!mnt)
 			continue;
@@ -1358,6 +1397,17 @@
 			continue;
 		}
 		*end = '\0';
+		if (conf->keep_dirs) {
+			vector_foreach_slot(conf->keep_dirs, keep, i) {
+				int mnt_len = strlen(mnt);
+				int keep_len = strlen(keep);
+				if (strncmp(mnt, keep, mnt_len) == 0 &&
+				    (mnt_len == keep_len ||
+				     (mnt_len < keep_len &&
+				      keep[mnt_len] == '/')))
+					goto next;
+			}
+		}
 		if (strcmp(mnt, "/") == 0 || strcmp(mnt, "/sbin") == 0 ||
 		    strcmp(mnt, "/bin") == 0 || strcmp(mnt, "/tmp") == 0 ||
 		    strcmp(mnt, "/usr") == 0 || strncmp(mnt, "/usr/lib", 8) == 0 ||
@@ -1368,9 +1418,11 @@
 		    strncmp(mnt, "/lib64", 6) == 0 || strncmp(mnt, "/usr/lib64", 10) == 0 ||
 		    strncmp(mnt, "/ram", 4) == 0)
 			continue;
-		if (umount2(mnt, MNT_DETACH) < 0 && errno != ENOENT) {
-			condlog(0, "failed to umount '%s' (%s). skipping", mnt, strerror(errno));
-		}
+		if (umount2(mnt, MNT_DETACH) < 0 && errno != ENOENT)
+			condlog(0, "failed to umount '%s' (%s). skipping", mnt,
+				strerror(errno));
+next:
+		;
 	}
 	fclose(file);
 	return 0;

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

* multipath-tools libmultipath/config.c libmulti ...
@ 2007-12-15  0:27 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2007-12-15  0:27 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2007-12-15 00:27:40

Modified files:
	libmultipath   : config.c config.h dict.c 
	multipathd     : Makefile main.c 
Added files:
	multipathd     : clone_platform.h copy.c copy.h 

Log message:
	Add private namespace and callout cache support back to multipath.  This seems
	less invasive than the libprio work in upstream, which will go into the next
	major release. Fixes bz #355961

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.3&r2=1.19.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.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/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.2&r2=1.17.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/clone_platform.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/copy.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/copy.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.14&r2=1.14.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.2&r2=1.69.2.3

--- multipath-tools/libmultipath/config.c	2007/11/10 00:01:59	1.19.2.3
+++ multipath-tools/libmultipath/config.c	2007/12/15 00:27:39	1.19.2.4
@@ -20,6 +20,57 @@
 #include "blacklist.h"
 #include "defaults.h"
 
+/*
+ * helper function to draw a list of callout binaries found in the config file
+ */
+extern int
+push_callout(char * callout)
+{
+#if DAEMON
+	int i;
+	char *bin;
+	char *p;
+
+	/*
+	 * purge command line arguments
+	 */
+	p = callout;
+
+	while (*p != ' ' && *p != '\0')
+		p++;
+
+	if (!conf->binvec)
+		conf->binvec = vector_alloc();
+
+
+	if (!conf->binvec)
+		return 1;
+
+	/*
+	 * if this callout is already stored in binvec, don't store it twice
+	 */
+	vector_foreach_slot (conf->binvec, bin, i)
+		if (memcmp(bin, callout, p - callout) == 0)
+			return 0;
+
+	/*
+	 * else, store it
+	 */
+	bin = MALLOC((p - callout) + 1);
+
+	if (!bin)
+		return 1;
+
+	strncpy(bin, callout, p - callout);
+
+	if (!vector_alloc_slot(conf->binvec))
+		return 1;
+
+	vector_set_slot(conf->binvec, bin);
+#endif
+	return 0;
+}
+
 static struct hwentry *
 find_hwe_strmatch (vector hwtable, char * vendor, char * product)
 {
@@ -255,10 +306,12 @@
 	if (!dhwe->product || !(hwe->product = set_param_str(dhwe->product)))
 		goto out;
 	
-	if (dhwe->getuid && !(hwe->getuid = set_param_str(dhwe->getuid)))
+	if (dhwe->getuid && (!(hwe->getuid = set_param_str(dhwe->getuid)) ||
+	                     push_callout(dhwe->getuid)))
 		goto out;
 
-	if (dhwe->getprio && !(hwe->getprio = set_param_str(dhwe->getprio)))
+	if (dhwe->getprio && (!(hwe->getprio = set_param_str(dhwe->getprio)) ||
+	                      push_callout(dhwe->getprio)))
 		goto out;
 				
 	if (dhwe->features && !(hwe->features = set_param_str(dhwe->features)))
@@ -337,6 +390,7 @@
 	free_mptable(conf->mptable);
 	free_hwtable(conf->hwtable);
 	free_keywords(conf->keywords);
+	free_strvec(conf->binvec);
 	FREE(conf);
 }
 
@@ -435,8 +489,11 @@
 	if (conf->udev_dir == NULL)
 		conf->udev_dir = set_default(DEFAULT_UDEVDIR);
 
-	if (conf->getuid == NULL)
+	if (conf->getuid == NULL){
 		conf->getuid = set_default(DEFAULT_GETUID);
+		if (push_callout(conf->getuid))
+			goto out;
+	}
 
 	if (conf->features == NULL)
 		conf->features = set_default(DEFAULT_FEATURES);
--- multipath-tools/libmultipath/config.h	2007/01/10 20:08:08	1.18.2.1
+++ multipath-tools/libmultipath/config.h	2007/12/15 00:27:39	1.18.2.2
@@ -76,6 +76,7 @@
 	vector keywords;
 	vector mptable;
 	vector hwtable;
+	vector binvec;
 
 	vector blist_devnode;
 	vector blist_wwid;
@@ -87,6 +88,8 @@
 
 struct config * conf;
 
+extern int push_callout(char * callout);
+
 struct hwentry * find_hwe (vector hwtable, char * vendor, char * product);
 struct mpentry * find_mpe (char * wwid);
 char * get_mpe_wwid (char * alias);
--- multipath-tools/libmultipath/dict.c	2007/11/10 00:01:59	1.17.2.2
+++ multipath-tools/libmultipath/dict.c	2007/12/15 00:27:39	1.17.2.3
@@ -78,7 +78,7 @@
 	if (!conf->getuid)
 		return 1;
 	
-	return 0;
+	return push_callout(conf->getuid);
 }
 
 static int
@@ -93,9 +93,10 @@
 	    !strcmp(conf->getprio, "none")) {
 		FREE(conf->getprio);
 		conf->getprio = NULL;
+		return 0;
 	}
 		
-	return 0;
+	return push_callout(conf->getprio);
 }
 
 static int
@@ -510,7 +511,7 @@
 	if (!hwe->getuid)
 		return 1;
 
-	return 0;
+	return push_callout(hwe->getuid);
 }
 
 static int
@@ -597,9 +598,10 @@
 	if (strlen(hwe->getprio) == 4 && !strcmp(hwe->getprio, "none")) {
 		FREE(hwe->getprio);
 		hwe->getprio = NULL;
+		return 0;
 	}
 
-	return 0;
+	return push_callout(hwe->getprio);
 }
 
 static int
--- multipath-tools/multipathd/Makefile	2006/06/06 18:32:44	1.14
+++ multipath-tools/multipathd/Makefile	2007/12/15 00:27:39	1.14.2.1
@@ -19,7 +19,7 @@
 #
 # object files
 #
-OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o \
+OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o copy.o cli_handlers.o \
        $(MULTIPATHLIB)-glibc.a $(CHECKERSLIB)-glibc.a \
 
 
--- multipath-tools/multipathd/main.c	2007/06/15 19:03:02	1.69.2.2
+++ multipath-tools/multipathd/main.c	2007/12/15 00:27:40	1.69.2.3
@@ -10,6 +10,7 @@
 #include <wait.h>
 #include <sys/mman.h>
 #include <sys/types.h>
+#include <sys/mount.h>
 #include <fcntl.h>
 #include <errno.h>
 
@@ -57,10 +58,14 @@
 #include "cli_handlers.h"
 #include "lock.h"
 #include "waiter.h"
+#include "clone_platform.h"
+#include "copy.h"
 
 #define FILE_NAME_SIZE 256
 #define CMDSIZE 160
 
+#define CALLOUT_DIR "/var/cache/multipathd"
+
 #define LOG_MSG(a,b) \
 	if (strlen(b)) condlog(a, "%s: %s", pp->dev, b);
 
@@ -746,6 +751,9 @@
 	if (status != 0)
 		fprintf(stderr, "bad exit status. see daemon.log\n");
 
+	condlog(3, "umount ramfs");
+	umount(CALLOUT_DIR);
+
 	condlog(3, "unlink pidfile");
 	unlink(DEFAULT_PIDFILE);
 
@@ -1179,6 +1187,108 @@
 	return NULL;
 }
 
+
+#ifdef CLONE_NEWNS
+static int
+prepare_namespace(void)
+{
+	mode_t mode = S_IRWXU;
+	struct stat * buf;
+	char ramfs_args[64];
+	int i;
+	int fd;
+	char * bin;
+	size_t size = 10;
+	struct stat statbuf;
+
+	if (!conf->binvec)
+		return 0;
+	buf = (struct stat *)MALLOC(sizeof(struct stat));
+
+	/*
+	 * create a temp mount point for ramfs
+	 */
+	if (stat(CALLOUT_DIR, buf) < 0) {
+		if (mkdir(CALLOUT_DIR, mode) < 0) {
+			condlog(0, "cannot create " CALLOUT_DIR);
+			FREE(buf);
+			return -1;
+		}
+		condlog(4, "created " CALLOUT_DIR);
+	}
+	FREE(buf);
+
+	/*
+	 * compute the optimal ramdisk size
+	 */
+	vector_foreach_slot (conf->binvec, bin,i) {
+		if ((fd = open(bin, O_RDONLY)) < 0) {
+			condlog(0, "cannot open %s : %s\n", bin,
+				strerror(errno));
+			continue;
+		}
+		if (fstat(fd, &statbuf) < 0) {
+			condlog(0, "cannot stat %s", bin);
+			return -1;
+		}
+		size += statbuf.st_size;
+		close(fd);
+	}
+	condlog(3, "ramfs maxsize is %u", (unsigned int) size);
+
+	/*
+	 * mount the ramfs
+	 */
+	if (safe_sprintf(ramfs_args, "maxsize=%u", (unsigned int) size)) {
+		condlog(0, "ramfs_args too small\n");
+		return -1;
+	}
+	if (mount(NULL, CALLOUT_DIR, "ramfs", MS_SYNCHRONOUS, ramfs_args) < 0) {
+		condlog(0, "cannot mount ramfs on " CALLOUT_DIR);
+		return -1;
+	}
+	condlog(4, "mount ramfs on " CALLOUT_DIR);
+
+	/*
+	 * populate the ramfs with callout binaries
+	 */
+	vector_foreach_slot (conf->binvec, bin,i) {
+		if (copytodir(bin, CALLOUT_DIR) < 0) {
+			condlog(0, "cannot copy %s in ramfs : %s", bin,
+				strerror(errno));
+			continue;
+		}
+		condlog(4, "cp %s in ramfs", bin);
+	}
+	free_strvec(conf->binvec);
+	conf->binvec = NULL;
+
+	/*
+	 * bind the ramfs to :
+	 * /sbin : default home of multipath ...
+	 * /bin  : default home of scsi_id ...
+	 * /tmp  : home of scsi_id temp files
+	 */
+	if (mount(CALLOUT_DIR, "/sbin", NULL, MS_BIND, NULL) < 0) {
+		condlog(0, "cannot bind ramfs on /sbin");
+		return -1;
+	}
+	condlog(4, "bind ramfs on /sbin");
+	if (mount(CALLOUT_DIR, "/bin", NULL, MS_BIND, NULL) < 0) {
+		condlog(0, "cannot bind ramfs on /bin");
+		return -1;
+	}
+	condlog(4, "bind ramfs on /bin");
+	if (mount(CALLOUT_DIR, "/tmp", NULL, MS_BIND, NULL) < 0) {
+		condlog(0, "cannot bind ramfs on /tmp");
+		return -1;
+	}
+	condlog(4, "bind ramfs on /tmp");
+
+	return 0;
+}
+#endif
+
 static void *
 signal_set(int signo, void (*func) (int))
 {
@@ -1263,13 +1373,46 @@
 	fclose(fp);
 }
 	
+static void
+setup_daemon(void)
+{
+	int in_fd, out_fd;
+
+	in_fd = open("/dev/null", O_RDONLY);
+	if (in_fd < 0){
+		fprintf(stderr, "cannot open /dev/null for input : %s\n",
+			strerror(errno));
+		_exit(0);
+	}
+	out_fd = open("/dev/console", O_WRONLY);
+	if (out_fd < 0){
+		fprintf(stderr, "cannot open /dev/console for output : %s\n",
+			strerror(errno));
+		_exit(0);
+	}
+
+	close(STDIN_FILENO);
+	dup(in_fd);
+	close(STDOUT_FILENO);
+	dup(out_fd);
+	close(STDERR_FILENO);
+	dup(out_fd);
+
+	close(in_fd);
+	close(out_fd);
+	chdir("/");
+	umask(0);
+}
+
 static int
 child (void * param)
 {
 	pthread_t check_thr, uevent_thr, uxlsnr_thr;
 	pthread_attr_t attr;
 	struct vectors * vecs;
+	unsigned long new_ns = (unsigned long)param;
 
+	setup_daemon();
 	mlockall(MCL_CURRENT | MCL_FUTURE);
 
 	if (logsink)
@@ -1309,6 +1452,12 @@
 		condlog(0, "can not find sysfs mount point");
 		exit(1);
 	}
+#ifdef CLONE_NEWNS
+	if (new_ns && prepare_namespace() < 0) {
+		condlog(0, "cannot prepare namespace");
+		exit(1);
+	}
+#endif
 
 	/*
 	 * fetch and configure both paths and multipaths
@@ -1376,7 +1525,9 @@
 daemonize(void)
 {
 	int pid;
-	int in_fd, out_fd;
+#ifdef CLONE_NEWNS
+	void *child_stack;
+#endif
 
 	if( (pid = fork()) < 0){
 		fprintf(stderr, "Failed first fork : %s\n", strerror(errno));
@@ -1387,36 +1538,37 @@
 
 	setsid();
 
-	if ( (pid = fork()) < 0)
-		fprintf(stderr, "Failed second fork : %s\n", strerror(errno));
-	else if (pid != 0)
-		_exit(0);
+#ifdef CLONE_NEWNS
 
-	in_fd = open("/dev/null", O_RDONLY);
-	if (in_fd < 0){
-		fprintf(stderr, "cannot open /dev/null for input : %s\n",
+	child_stack = (void *)malloc(CHILD_STACK_SIZE);
+	if (!child_stack) {
+		fprintf(stderr, "Failed to allocate child stack : %s\n",
 			strerror(errno));
-		_exit(0);
+		_exit(1);
 	}
-	out_fd = open("/dev/console", O_WRONLY);
-	if (out_fd < 0){
-		fprintf(stderr, "cannot open /dev/console for output : %s\n",
-			strerror(errno));
-		_exit(0);
+#  if defined(__hppa__) || defined(__powerpc64__)
+	pid = clone(child, child_stack, CLONE_NEWNS, (void *)1);
+#  elif defined(__ia64__)
+	pid = clone2(child, child_stack, CHILD_STACK_SIZE, CLONE_NEWNS,
+	             (void *)1, NULL, NULL, NULL);
+#  else
+	pid = clone(child, child_stack + CHILD_STACK_SIZE, CLONE_NEWNS,
+	            (void *)1);
+#  endif
+	if (pid < 0) {
+		fprintf(stderr, "Clone failed : %s\n", strerror(errno));
+		_exit(1);
+	}
+	_exit(0);
+#else
+	if ( (pid = fork()) < 0){
+		fprintf(stderr, "Failed second fork : %s\n", strerror(errno));
+		_exit(1);
 	}
-
-	close(STDIN_FILENO);
-	dup(in_fd);
-	close(STDOUT_FILENO);
-	dup(out_fd);
-	close(STDERR_FILENO);
-	dup(out_fd);
-
-	close(in_fd);
-	close(out_fd);
-	chdir("/");
-	umask(0);
-	return 0;
+	if (pid != 0)
+		_exit(0);
+	return child((void *)0);
+#endif
 }
 
 int
@@ -1466,18 +1618,14 @@
 	}
 
 	if (!logsink)
-		err = 0;
-	else
+		return child((void *)0);
+	else{
 		err = daemonize();
+	}
 	
 	if (err < 0)
-		/* error */
-		exit(1);
-	else if (err > 0)
-		/* parent dies */
-		exit(0);
-	else
-		/* child lives */
-		return (child(NULL));
+		return 1;
+	/* parent dies */
+	return 0;
 }
 

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

* multipath-tools libmultipath/config.c libmulti ...
@ 2007-11-10  0:02 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2007-11-10  0:02 UTC (permalink / raw)
  To: dm-cvs, dm-devel

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

Modified files:
	libmultipath   : config.c dict.c 
	multipath      : main.c 

Log message:
	Fix for bz #356331. Add bindings_file paramter to /etc/multipath.conf, so that
	you can select an alternative location for the user_friendly_names bindings
	file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.2&r2=1.19.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.1&r2=1.17.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.3&r2=1.44.2.4

--- multipath-tools/libmultipath/config.c	2007/07/13 18:30:24	1.19.2.2
+++ multipath-tools/libmultipath/config.c	2007/11/10 00:01:59	1.19.2.3
@@ -323,6 +323,9 @@
 	if (conf->hwhandler)
 		FREE(conf->hwhandler);
 
+	if (conf->bindings_file)
+		FREE(conf->bindings_file);
+
 	free_blacklist(conf->blist_devnode);
 	free_blacklist(conf->blist_wwid);
 	free_blacklist_device(conf->blist_device);
@@ -354,7 +357,6 @@
 
 	conf->dev_type = DEV_NONE;
 	conf->minio = 1000;
-	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
 	 * read the config file
@@ -442,9 +444,12 @@
 	if (conf->hwhandler == NULL)
 		conf->hwhandler = set_default(DEFAULT_HWHANDLER);
 
+	if (conf->bindings_file == NULL)
+		conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);
+
 	if (!conf->selector  || !conf->udev_dir         ||
 	    !conf->getuid    || !conf->features ||
-	    !conf->hwhandler)
+	    !conf->hwhandler || !conf->bindings_file)
 		goto out;
 
 	if (!conf->checker)
--- multipath-tools/libmultipath/dict.c	2007/01/10 20:08:08	1.17.2.1
+++ multipath-tools/libmultipath/dict.c	2007/11/10 00:01:59	1.17.2.2
@@ -247,6 +247,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
  */
@@ -1489,6 +1500,18 @@
 }
 
 static int
+snprint_def_bindings_file (char * buff, int len, void * data)
+{
+	if (conf->bindings_file == NULL)
+		return 0;
+	if (strlen(conf->bindings_file) == strlen(DEFAULT_BINDINGS_FILE) &&
+	    !strcmp(conf->bindings_file, DEFAULT_BINDINGS_FILE))
+		return 0;
+
+	return snprintf(buff, len, "%s", conf->bindings_file);
+}
+
+static int
 snprint_ble_simple (char * buff, int len, void * data)
 {
 	struct blentry * ble = (struct blentry *)data;
@@ -1532,6 +1555,7 @@
 	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);
 	install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
+	install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
 	__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);
--- multipath-tools/multipath/main.c	2007/06/18 17:37:18	1.44.2.3
+++ multipath-tools/multipath/main.c	2007/11/10 00:01:59	1.44.2.4
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.3 2007/06/18 17:37:18 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.4 2007/11/10 00:01:59 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -335,7 +335,9 @@
 			conf->verbosity = atoi(optarg);
 			break;
 		case 'b':
-			conf->bindings_file = optarg;
+			if (conf->bindings_file)
+				FREE(conf->bindings_file);	
+			conf->bindings_file = STRDUP(optarg);
 			break;
 		case 'd':
 			conf->dry_run = 1;

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

* multipath-tools libmultipath/config.c libmulti ...
@ 2006-12-01 23:45 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2006-12-01 23:45 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL4_FC5
Changes by:	bmarzins@sourceware.org	2006-12-01 23:45:19

Modified files:
	libmultipath   : config.c config.h defaults.h dict.c hwtable.c 
	                 propsel.c propsel.h structs.h 
	multipath      : main.c 
	path_priority/pp_alua: main.c 
	path_priority/pp_hds_modular: pp_hds_modular.c 

Log message:
	Fixes for bugs 217014, 192645, 215509, 187534, and 215505
	
	Applied Dave Wysochanski's patches.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17&r2=1.17.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17&r2=1.17.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/defaults.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.6&r2=1.6.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&r2=1.16.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.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&r2=1.9.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.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/libmultipath/structs.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/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.41.2.3&r2=1.41.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/main.c.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/path_priority/pp_hds_modular/pp_hds_modular.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.1&r2=1.1.2.1

--- multipath-tools/libmultipath/config.c	2006/04/19 18:03:46	1.17
+++ multipath-tools/libmultipath/config.c	2006/12/01 23:45:18	1.17.2.1
@@ -263,7 +263,8 @@
 int
 store_hwe_ext (vector hwtable, char * vendor, char * product, int pgp,
 	   char * getuid, char * getprio, char * hwhandler,
-	   char * features, char * checker, int pgfailback, char * blacklist)
+	   char * features, char * checker, int pgfailback, char * blacklist,
+	   int no_path_retry, int rr_weight, int rr_min_io)
 {
 	struct hwentry * hwe;
 
@@ -329,6 +330,15 @@
 		store_regex(hwe->blist, blacklist);
 	}
 
+	if (no_path_retry)
+		hwe->no_path_retry = no_path_retry;
+
+	if (rr_weight)
+		hwe->rr_weight = rr_weight;
+
+	if (rr_min_io)
+		hwe->rr_min_io = rr_min_io;
+
 	if (!vector_alloc_slot(hwtable))
 		goto out;
 
@@ -395,7 +405,7 @@
 		conf->verbosity = 2;
 
 	conf->dev_type = DEV_NONE;
-	conf->minio = 1000;
+	conf->rr_min_io = DEFAULT_RR_MIN_IO;
 	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
--- multipath-tools/libmultipath/config.h	2006/04/19 18:03:46	1.17
+++ multipath-tools/libmultipath/config.h	2006/12/01 23:45:18	1.17.2.1
@@ -17,6 +17,7 @@
 	int pgpolicy;
 	int checker_index;
 	int pgfailback;
+	int rr_min_io;
 	int rr_weight;
 	int no_path_retry;
 	int pg_timeout;
@@ -36,6 +37,7 @@
 	int selector_args;
 	int pgpolicy;
 	int pgfailback;
+	int rr_min_io;
 	int rr_weight;
 	int no_path_retry;
 	int pg_timeout;
@@ -56,7 +58,7 @@
 	int default_pgpolicy;
 	int default_checker_index;
 	int dev_type;
-	int minio;
+	int rr_min_io;
 	int checkint;
 	int max_checkint;
 	int pgfailback;
@@ -98,7 +100,8 @@
 int store_hwe_ext (vector hwtable, char * vendor, char * product, int pgp,
 		char * getuid, char * getprio, char * hwhandler,
 		char * features, char * checker, int pgfailback,
-		char * blacklist);
+		char * blacklist, int no_path_retry, int rr_weight,
+		int rr_min_io);
 
 int load_config (char * file);
 struct config * alloc_config (void);
--- multipath-tools/libmultipath/defaults.h	2005/10/27 02:16:12	1.6
+++ multipath-tools/libmultipath/defaults.h	2006/12/01 23:45:18	1.6.2.1
@@ -10,5 +10,6 @@
 #define DEFAULT_SOCKET		"/var/run/multipathd.sock"
 #define DEFAULT_CONFIGFILE	"/etc/multipath.conf"
 #define DEFAULT_BINDINGS_FILE	"/var/lib/multipath/bindings"
+#define DEFAULT_RR_MIN_IO       1000
 
 char * set_default (char * str);
--- multipath-tools/libmultipath/dict.c	2006/04/19 18:03:46	1.16
+++ multipath-tools/libmultipath/dict.c	2006/12/01 23:45:18	1.16.2.1
@@ -124,7 +124,7 @@
 }
 
 static int
-def_minio_handler(vector strvec)
+def_rr_min_io_handler(vector strvec)
 {
 	char * buff;
 
@@ -133,7 +133,7 @@
 	if (!buff)
 		return 1;
 
-	conf->minio = atoi(buff);
+	conf->rr_min_io = atoi(buff);
 	FREE(buff);
 
 	return 0;
@@ -794,7 +794,7 @@
 	install_keyword("features", &def_features_handler);
 	install_keyword("path_checker", &def_path_checker_handler);
 	install_keyword("failback", &default_failback_handler);
-	install_keyword("rr_min_io", &def_minio_handler);
+	install_keyword("rr_min_io", &def_rr_min_io_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/hwtable.c	2006/09/19 21:06:40	1.16.2.4
+++ multipath-tools/libmultipath/hwtable.c	2006/12/01 23:45:18	1.16.2.5
@@ -12,6 +12,7 @@
 	int r = 0;
 
 	r += store_hwe(hw, "3PARdata", "VV", MULTIBUS, DEFAULT_GETUID);
+	r += store_hwe(hw, "APPLE*", "Xserve RAID ", MULTIBUS, DEFAULT_GETUID);
 	r += store_hwe(hw, "COMPAQ", "HSV110*", GROUP_BY_SERIAL, DEFAULT_GETUID);
 	r += store_hwe(hw, "COMPAQ", "MSA1000", GROUP_BY_SERIAL, DEFAULT_GETUID);
 	r += store_hwe(hw, "DDN", "SAN DataDirector", MULTIBUS, DEFAULT_GETUID);
@@ -20,7 +21,7 @@
 		       "/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", "{HSV2*,A6189A}", MULTIBUS, 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);
 	r += store_hwe(hw, "SGI", "TP9300", MULTIBUS, DEFAULT_GETUID);
@@ -30,40 +31,63 @@
 
 	r + store_hwe_ext(hw, "GNBD", "GNBD", MULTIBUS,
         		  "/sbin/gnbd_import -q -U /block/%n", NULL, "0", "0",
-			  "directio", FAILBACK_UNDEF, NULL);
+			  "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);
-        r += store_hwe_ext(hw, "HP", "HSV101", GROUP_BY_PRIO, DEFAULT_GETUID,
-		    "/sbin/mpath_prio_alua %d", "0","1 queue_if_no_path", "tur",
-		    FAILBACK_UNDEF, NULL);
-        r += store_hwe_ext(hw, "COMPAQ", "HSV111*", GROUP_BY_PRIO, DEFAULT_GETUID,
-		    "/sbin/mpath_prio_alua %d", "0", "1 queue_if_no_path", "tur",
-		    FAILBACK_UNDEF, NULL);
-	r += store_hwe_ext(hw, "{HITACHI,HP}", "OPEN-*", MULTIBUS, DEFAULT_GETUID, NULL, "0", "0",
-		    "tur", FAILBACK_UNDEF, NULL);
+		   "/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,
+		DEFAULT_GETUID, NULL, "0", "0", "tur", -FAILBACK_IMMEDIATE,
+		NULL, 60, 0, 100);
         r += store_hwe_ext(hw, "HP", "*33[89]0*", MULTIBUS, DEFAULT_GETUID, NULL, "0", "0",
-		    "tur", FAILBACK_UNDEF, NULL);
+		    "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "DGC", "*", GROUP_BY_PRIO,
                    DEFAULT_GETUID, "/sbin/mpath_prio_emc /dev/%n", "1 emc",
-		   "1 queue_if_no_path", "emc_clariion", -FAILBACK_IMMEDIATE, "LUN_Z");
+		   "1 queue_if_no_path", "emc_clariion", -FAILBACK_IMMEDIATE, "LUN_Z",
+		   0, 0, 0);
 	r += store_hwe_ext(hw, "IBM", "3542", GROUP_BY_SERIAL, DEFAULT_GETUID,
-		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL);
+		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
+	r += store_hwe_ext(hw, "IBM", "2105*", GROUP_BY_SERIAL, DEFAULT_GETUID,
+		   NULL, "0", "1 queue_in_no_path", "tur", FAILBACK_UNDEF, NULL,
+		   0, 0, 0);
+	r += store_hwe_ext(hw, "IBM", "1750500", GROUP_BY_PRIO,
+		   DEFAULT_GETUID, "/sbin/mpath_prio_alua /dev/%n", "0",
+		   "1 queue_in_no_path", "tur", -FAILBACK_IMMEDIATE, NULL, 0, 0,
+		   0);
+	r += store_hwe_ext(hw, "IBM", "2107900", GROUP_BY_SERIAL,
+		   DEFAULT_GETUID, NULL, "0", "1 queue_in_no_path", "tur",
+		   FAILBACK_UNDEF, NULL, 0, 0, 0);
+	r += store_hwe_ext(hw, "IBM", "2145", GROUP_BY_PRIO, DEFAULT_GETUID,
+		   "/sbin/mpath_prio_alua /dev/%n", "0", "1 queue_in_no_path",
+		   "tur", -FAILBACK_IMMEDIATE, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "IBM", "S/390 DASD ECKD", MULTIBUS,
 		   "/sbin/dasdview -j /dev/%n", NULL, "0", "0",
-		   "directio", FAILBACK_UNDEF);
+		   "directio", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "NETAPP", "LUN", GROUP_BY_PRIO, DEFAULT_GETUID,
 		  "/sbin/mpath_prio_netapp /dev/%n", NULL,
-		  "1 queue_if_no_path", "readsector0", FAILBACK_UNDEF, NULL);
+		  "1 queue_if_no_path", "readsector0", FAILBACK_UNDEF, NULL, 0, 0, 0);
+	r += store_hwe_ext(hw, "IBM", "Nseries", GROUP_BY_PRIO, DEFAULT_GETUID,
+		  "/sbin/mpath_prio_netapp /dev/%n", NULL,
+		  "1 queue_if_no_path", "readsector0", -FAILBACK_IMMEDIATE,
+		  NULL, 0, 0, 128);
 	r += store_hwe_ext(hw, "Pillar", "Axiom 500", GROUP_BY_PRIO,
 		   DEFAULT_GETUID, "/sbin/mpath_prio_alua %d", "0", "0",
-		   "tur", FAILBACK_UNDEF, NULL);
+		   "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "SGI", "TP9400", MULTIBUS, DEFAULT_GETUID,
-		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL);
+		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "SGI", "TP9500", FAILOVER, DEFAULT_GETUID,
-		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL);
+		   NULL, "0", "0", "tur", FAILBACK_UNDEF, NULL, 0, 0, 0);
 	r += store_hwe_ext(hw, "HITACHI", "DF*", GROUP_BY_PRIO,
 		   DEFAULT_GETUID, "/sbin/mpath/prio_hds_modular %d", "0", "0",
-		   "readsector0", -FAILBACK_IMMEDIATE, NULL);
+		   "readsector0", -FAILBACK_IMMEDIATE, NULL, 0, 0, 0);
 
 	return r;
 }
--- multipath-tools/libmultipath/propsel.c	2005/11/16 20:24:57	1.9
+++ multipath-tools/libmultipath/propsel.c	2006/12/01 23:45:18	1.9.2.1
@@ -11,6 +11,7 @@
 #include "debug.h"
 #include "pgpolicies.h"
 #include "alias.h"
+#include "defaults.h"
 
 #include "../libcheckers/checkers.h"
 
@@ -20,6 +21,33 @@
  * stop at first explicit setting found
  */
 extern int
+select_rr_min_io (struct multipath * mp)
+{
+	if (mp->mpe && mp->mpe->rr_min_io) {
+		mp->rr_min_io = mp->mpe->rr_min_io;
+		condlog(3, "rr_min_io = %i (LUN setting)",
+			mp->rr_min_io);
+		return 0;
+	}
+	if (mp->hwe && mp->hwe->rr_min_io) {
+		mp->rr_min_io = mp->hwe->rr_min_io;
+		condlog(3, "rr_min_io = %i (controler setting)",
+			mp->rr_min_io);
+		return 0;
+	}
+	if (conf->rr_min_io) {
+		mp->rr_min_io = conf->rr_min_io;
+		condlog(3, "rr_min_io = %i (config file default)",
+			mp->rr_min_io);
+		return 0;
+	}
+	mp->rr_min_io = DEFAULT_RR_MIN_IO;
+	condlog(3, "rr_min_io = %i (internal default)",
+		mp->rr_min_io);
+	return 0;
+}
+
+extern int
 select_rr_weight (struct multipath * mp)
 {
 	if (mp->mpe && mp->mpe->rr_weight) {
--- multipath-tools/libmultipath/propsel.h	2005/11/04 23:35:28	1.4
+++ multipath-tools/libmultipath/propsel.h	2006/12/01 23:45:18	1.4.2.1
@@ -10,3 +10,4 @@
 int select_getprio (struct path * pp);
 int select_no_path_retry(struct multipath *mp);
 int select_pg_timeout(struct multipath *mp);
+int select_rr_min_io(struct multipath *mp);
--- multipath-tools/libmultipath/structs.h	2006/09/19 21:06:40	1.17.2.2
+++ multipath-tools/libmultipath/structs.h	2006/12/01 23:45:18	1.17.2.3
@@ -124,6 +124,7 @@
 	int action;
 	int pgfailback;
 	int failback_tick;
+	int rr_min_io;
 	int rr_weight;
 	int nr_active;     /* current available(= not known as failed) paths */
 	int no_path_retry; /* number of retries after all paths are down */
--- multipath-tools/multipath/main.c	2006/09/14 23:25:08	1.41.2.3
+++ multipath-tools/multipath/main.c	2006/12/01 23:45:18	1.41.2.4
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.41.2.3 2006/09/14 23:25:08 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.41.2.4 2006/12/01 23:45:18 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -299,7 +299,7 @@
 {
 	int i, j;
 	int shift, freechar;
-	int minio;
+	int rr_min_io;
 	char * p;
 	struct pathgroup * pgp;
 	struct path * pp;
@@ -330,13 +330,13 @@
 		freechar -= shift;
 
 		vector_foreach_slot (pgp->paths, pp, j) {
-			minio = conf->minio;
+			rr_min_io = mp->rr_min_io;
 			
 			if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
-				minio *= pp->priority;
+				rr_min_io *= pp->priority;
 
 			shift = snprintf(p, freechar, " %s %d",
-					 pp->dev_t, minio);
+					 pp->dev_t, rr_min_io);
 			if (shift >= freechar) {
 				fprintf(stderr, "mp->params too small\n");
 				return 1;
@@ -376,6 +376,7 @@
 	select_features(mpp);
 	select_hwhandler(mpp);
 	select_rr_weight(mpp);
+	select_rr_min_io(mpp);
 	select_no_path_retry(mpp);
 	select_pg_timeout(mpp);
 
--- multipath-tools/path_priority/pp_alua/main.c	2005/10/12 21:57:26	1.2
+++ multipath-tools/path_priority/pp_alua/main.c	2006/12/01 23:45:18	1.2.2.1
@@ -12,8 +12,6 @@
  * 
  * This file is released under the GPL.
  */
-#include <linux/kdev_t.h>
-
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -241,7 +239,7 @@
 			mknod(
 				devicepath,
 				S_IFBLK|S_IRUSR|S_IWUSR,
-				MKDEV(major, minor)
+				makedev(major, minor)
 			);
 			
 		}
--- multipath-tools/path_priority/pp_hds_modular/pp_hds_modular.c	2006/04/24 23:51:28	1.1
+++ multipath-tools/path_priority/pp_hds_modular/pp_hds_modular.c	2006/12/01 23:45:18	1.1.2.1
@@ -187,7 +187,7 @@
 	exit(1);
 	}
 
-print_help() {
+void print_help(void) {
 	printf("\n");
 	printf("Usage:       pp_hds_modular [-v] <device_major:device_minor>\n");
 	printf("Option:      -v verbose mode\n");

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

* multipath-tools libmultipath/config.c libmulti ...
@ 2006-11-30 23:25 bmarzins
  0 siblings, 0 replies; 6+ messages in thread
From: bmarzins @ 2006-11-30 23:25 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Changes by:	bmarzins@sourceware.org	2006-11-30 23:25:13

Modified files:
	libmultipath   : config.c dmparser.c 
	multipath      : Makefile main.c multipath.8 
	path_priority/pp_alua: main.c 

Log message:
	Fixes for bzs 215971, 215973, 216033, 217972, and 215001
	
	215973, 216033, 215001 are SELinux issues. The SELinux policy is fixed in
	selinux-policy-2.4.3-10, this simply makes the multipath install create the
	/var/lib/multipath directory, so that it works with SELinux better.
	
	215971, and 217972 have fixes pulled from upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dmparser.c.diff?cvsroot=dm&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/Makefile.diff?cvsroot=dm&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.8.diff?cvsroot=dm&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/main.c.diff?cvsroot=dm&r1=1.2&r2=1.3

--- multipath-tools/libmultipath/config.c	2006/06/06 18:32:43	1.18
+++ multipath-tools/libmultipath/config.c	2006/11/30 23:25:13	1.19
@@ -20,6 +20,25 @@
 #include "blacklist.h"
 #include "defaults.h"
 
+static struct hwentry *
+find_hwe_strmatch (vector hwtable, char * vendor, char * product)
+{
+	int i;
+	struct hwentry *hwe, *ret = NULL;
+
+	vector_foreach_slot (hwtable, hwe, i) {
+		if (hwe->vendor && vendor && strcmp(hwe->vendor, vendor))
+			continue;
+
+		if (hwe->product && product && strcmp(hwe->product, product))
+			continue;
+
+		ret = hwe;
+		break;
+	}
+	return ret;
+}
+
 struct hwentry *
 find_hwe (vector hwtable, char * vendor, char * product)
 {
@@ -222,7 +241,7 @@
 {
 	struct hwentry * hwe;
 
-	if (dup_hwe(hwtable, dhwe->vendor, dhwe->product))
+	if (find_hwe_strmatch(hwtable, dhwe->vendor, dhwe->product))
 		return 0;
 	
 	if (!(hwe = alloc_hwe()))
--- multipath-tools/libmultipath/dmparser.c	2006/06/06 18:32:43	1.12
+++ multipath-tools/libmultipath/dmparser.c	2006/11/30 23:25:13	1.13
@@ -84,11 +84,14 @@
 		freechar -= shift;
 
 		vector_foreach_slot (pgp->paths, pp, j) {
-			if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
-				minio *= pp->priority;
+			int tmp_minio = minio;
+
+			if (mp->rr_weight == RR_WEIGHT_PRIO
+			    && pp->priority > 0)
+				tmp_minio = minio * pp->priority;
 
 			shift = snprintf(p, freechar, " %s %d",
-					 pp->dev_t, minio);
+					 pp->dev_t, tmp_minio);
 			if (shift >= freechar) {
 				fprintf(stderr, "mp->params too small\n");
 				return 1;
@@ -117,6 +120,7 @@
 	int num_pg_args = 0;
 	int num_paths = 0;
 	int num_paths_args = 0;
+	int def_minio = 0;
 	struct path * pp;
 	struct pathgroup * pgp;
 
@@ -305,12 +309,15 @@
 				if (k == 0 && !strncmp(mpp->selector,
 						       "round-robin", 11)) {
 					p += get_word(p, &word);
-					mpp->minio = atoi(word);
+					def_minio = atoi(word);
 
-					if (mpp->rr_weight)
-						mpp->minio /= mpp->rr_weight;
+					if (mpp->rr_weight == RR_WEIGHT_PRIO
+					    && pp->priority > 0)
+						def_minio /= pp->priority;
 
 					FREE(word);
+					if (def_minio != mpp->minio)
+						mpp->minio = def_minio;
 				}
 				else
 					p += get_word(p, NULL);
--- multipath-tools/multipath/Makefile	2006/10/12 16:16:09	1.16
+++ multipath-tools/multipath/Makefile	2006/11/30 23:25:13	1.17
@@ -44,6 +44,7 @@
 	@if [ ! -e $(DESTDIR)/etc/multipath.conf ]; then \
 		install -m 644 multipath.conf.redhat  $(DESTDIR)/etc/multipath.conf; \
 	fi
+	install -d $(DESTDIR)/var/lib/multipath
 
 uninstall:
 	rm $(DESTDIR)/etc/udev/rules.d/40-multipath.rules
--- multipath-tools/multipath/main.c	2006/09/15 18:08:03	1.43
+++ multipath-tools/multipath/main.c	2006/11/30 23:25:13	1.44
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.43 2006/09/15 18:08:03 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44 2006/11/30 23:25:13 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -72,7 +72,7 @@
 usage (char * progname)
 {
 	fprintf (stderr, VERSION_STRING);
-	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-l|-ll|-f|-F]\n",
+	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F]\n",
 		progname);
 	fprintf (stderr,
 		"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
@@ -83,6 +83,7 @@
 		"\t   1\t\t\tprint created devmap names only\n" \
 		"\t   2\t\t\tdefault verbosity\n" \
 		"\t   3\t\t\tprint debug information\n" \
+		"\t-h\t\tprint this usage text\n" \
 		"\t-b file\t\tbindings file location\n" \
 		"\t-d\t\tdry run, do not create or update devmaps\n" \
 		"\t-l\t\tshow multipath topology (sysfs and DM info)\n" \
@@ -323,7 +324,7 @@
 	if (load_config(DEFAULT_CONFIGFILE))
 		exit(1);
 
-	while ((arg = getopt(argc, argv, ":dl::FfM:v:p:b:")) != EOF ) {
+	while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:")) != EOF ) {
 		switch(arg) {
 		case 1: printf("optarg : %s\n",optarg);
 			break;
@@ -366,6 +367,8 @@
 				usage(argv[0]);
 			}                
 			break;
+		case 'h':
+			usage(argv[0]);
 		case ':':
 			fprintf(stderr, "Missing option arguement\n");
 			usage(argv[0]);        
--- multipath-tools/multipath/multipath.8	2006/09/15 18:08:03	1.8
+++ multipath-tools/multipath/multipath.8	2006/11/30 23:25:13	1.9
@@ -6,7 +6,7 @@
 .RB [\| \-v\ \c
 .IR verbosity \|]
 .RB [\| \-d \|]
-.RB [\| \-l | \-ll | \-f | \-F \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-F \|]
 .RB [\| \-p\ \c
 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
 .RB [\| device \|]
@@ -29,6 +29,9 @@
 print all info : detected paths, coalesced paths (ie multipaths) and device maps
 .RE
 .TP
+.B \-h
+print usage text
+.TP
 .B \-d
 dry run, do not create or update devmaps
 .TP
--- multipath-tools/path_priority/pp_alua/main.c	2005/10/12 21:57:26	1.2
+++ multipath-tools/path_priority/pp_alua/main.c	2006/11/30 23:25:13	1.3
@@ -12,8 +12,6 @@
  * 
  * This file is released under the GPL.
  */
-#include <linux/kdev_t.h>
-
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -241,7 +239,7 @@
 			mknod(
 				devicepath,
 				S_IFBLK|S_IRUSR|S_IWUSR,
-				MKDEV(major, minor)
+				makedev(major, minor)
 			);
 			
 		}

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

end of thread, other threads:[~2012-07-11 23:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 23:03 multipath-tools libmultipath/config.c libmulti bmarzins
  -- strict thread matches above, loose matches on Subject: below --
2011-10-27 21:36 bmarzins
2007-12-15  0:27 bmarzins
2007-11-10  0:02 bmarzins
2006-12-01 23:45 bmarzins
2006-11-30 23:25 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.