All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools libmultipath/config.h libmulti ...
@ 2010-04-24  5:28 bmarzins
  2010-04-24  7:29 ` Christophe Varoqui
  0 siblings, 1 reply; 4+ messages in thread
From: bmarzins @ 2010-04-24  5:28 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2010-04-24 05:28:07

Modified files:
	libmultipath   : config.h configure.c 
	multipath      : main.c 

Log message:
	Changed the fix for 579789.  Multipath now checks if multipathd is running and
	automatically acts accordingly by default.  The -q option overrides this.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.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/libmultipath/configure.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.2.7&r2=1.2.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.9&r2=1.44.2.10

--- multipath-tools/libmultipath/config.h	2010/04/08 19:31:49	1.18.2.10
+++ multipath-tools/libmultipath/config.h	2010/04/24 05:28:06	1.18.2.11
@@ -78,7 +78,7 @@
 	int flush_on_last_del;
 	int queue_without_daemon;
 	int checker_timeout;
-	int override_queueing;
+	int allow_queueing;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/configure.c	2010/04/08 19:31:49	1.2.2.7
+++ multipath-tools/libmultipath/configure.c	2010/04/24 05:28:06	1.2.2.8
@@ -13,6 +13,7 @@
 #include <sys/file.h>
 #include <errno.h>
 #include <libdevmapper.h>
+#include <fcntl.h>
 
 #include <checkers.h>
 
@@ -438,6 +439,35 @@
 	return 1; /* dead */
 }
 
+int
+pidfile_check(const char *file)
+{
+	int fd;
+	struct flock lock;
+
+	fd = open(file, O_RDONLY);
+	if (fd < 0) {
+		if (errno == ENOENT)
+			return 0;
+		condlog(0, "Cannot open pidfile, %s : %s", file,
+			strerror(errno));
+		return -1;
+	}
+	lock.l_type = F_WRLCK;
+	lock.l_start = 0;
+	lock.l_whence = SEEK_SET;
+	lock.l_len = 0;
+
+	if (fcntl(fd, F_GETLK, &lock) < 0) {
+		condlog(0, "Cannot check lock on pidfile, %s : %s", file,
+			strerror(errno));
+		return -1;
+	}
+	if (lock.l_type == F_UNLCK)
+		return 0;
+	return 1;
+}
+
 extern int
 coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid)
 {
@@ -536,15 +566,17 @@
 		}
 		if (r == DOMAP_DRY)
 			continue;
-
-		if (conf->override_queueing)
+#ifndef DAEMON
+		if (!conf->allow_queueing && !pidfile_check(DEFAULT_PIDFILE))
 			dm_queue_if_no_path(mpp->alias, 0);
-		else if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
-			if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
-				dm_queue_if_no_path(mpp->alias, 0);
-			else
-				dm_queue_if_no_path(mpp->alias, 1);
-		}
+		else
+#endif
+			if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
+				if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
+					dm_queue_if_no_path(mpp->alias, 0);
+				else
+					dm_queue_if_no_path(mpp->alias, 1);
+			}
 		if (mpp->pg_timeout != PGTIMEOUT_UNDEF) {
 			if (mpp->pg_timeout == -PGTIMEOUT_NONE)
 				dm_set_pg_timeout(mpp->alias,  0);
--- multipath-tools/multipath/main.c	2010/04/16 22:08:03	1.44.2.9
+++ multipath-tools/multipath/main.c	2010/04/24 05:28:06	1.44.2.10
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.10 2010/04/24 05:28:06 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -72,7 +72,7 @@
 usage (char * progname)
 {
 	fprintf (stderr, VERSION_STRING);
-	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r]\n",
+	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r|-q]\n",
 		progname);
 	fprintf (stderr,
 		"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
@@ -84,7 +84,7 @@
 		"\t   2\t\t\tdefault verbosity\n" \
 		"\t   3\t\t\tprint debug information\n" \
 		"\t-h\t\tprint this usage text\n" \
-		"\t-q\t\tforce all maps to turn off queue_if_no_path\n"\
+		"\t-q\t\tallow queue_if_no_path when multipathd is nor running\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" \
@@ -337,7 +337,7 @@
 			conf->verbosity = atoi(optarg);
 			break;
 		case 'q':
-			conf->override_queueing = 1;
+			conf->allow_queueing = 1;
 			break;
 		case 'b':
 			if (conf->bindings_file)

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

* Re: multipath-tools libmultipath/config.h libmulti ...
  2010-04-24  5:28 multipath-tools libmultipath/config.h libmulti bmarzins
@ 2010-04-24  7:29 ` Christophe Varoqui
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe Varoqui @ 2010-04-24  7:29 UTC (permalink / raw)
  To: device-mapper development

Hi Ben,

you have a spelling error in the help message (nor/not).

I like this approach better indeed.

Bye

On sam., 2010-04-24 at 05:28 +0000, bmarzins@sourceware.org wrote:
> CVSROOT:	/cvs/dm
> Module name:	multipath-tools
> Branch: 	RHEL5_FC6
> Changes by:	bmarzins@sourceware.org	2010-04-24 05:28:07
> 
> Modified files:
> 	libmultipath   : config.h configure.c 
> 	multipath      : main.c 
> 
> Log message:
> 	Changed the fix for 579789.  Multipath now checks if multipathd is running and
> 	automatically acts accordingly by default.  The -q option overrides this.
> 
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.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/libmultipath/configure.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.2.7&r2=1.2.2.8
> http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.9&r2=1.44.2.10
> 
> --- multipath-tools/libmultipath/config.h	2010/04/08 19:31:49	1.18.2.10
> +++ multipath-tools/libmultipath/config.h	2010/04/24 05:28:06	1.18.2.11
> @@ -78,7 +78,7 @@
>  	int flush_on_last_del;
>  	int queue_without_daemon;
>  	int checker_timeout;
> -	int override_queueing;
> +	int allow_queueing;
>  	uid_t uid;
>  	gid_t gid;
>  	mode_t mode;
> --- multipath-tools/libmultipath/configure.c	2010/04/08 19:31:49	1.2.2.7
> +++ multipath-tools/libmultipath/configure.c	2010/04/24 05:28:06	1.2.2.8
> @@ -13,6 +13,7 @@
>  #include <sys/file.h>
>  #include <errno.h>
>  #include <libdevmapper.h>
> +#include <fcntl.h>
>  
>  #include <checkers.h>
>  
> @@ -438,6 +439,35 @@
>  	return 1; /* dead */
>  }
>  
> +int
> +pidfile_check(const char *file)
> +{
> +	int fd;
> +	struct flock lock;
> +
> +	fd = open(file, O_RDONLY);
> +	if (fd < 0) {
> +		if (errno == ENOENT)
> +			return 0;
> +		condlog(0, "Cannot open pidfile, %s : %s", file,
> +			strerror(errno));
> +		return -1;
> +	}
> +	lock.l_type = F_WRLCK;
> +	lock.l_start = 0;
> +	lock.l_whence = SEEK_SET;
> +	lock.l_len = 0;
> +
> +	if (fcntl(fd, F_GETLK, &lock) < 0) {
> +		condlog(0, "Cannot check lock on pidfile, %s : %s", file,
> +			strerror(errno));
> +		return -1;
> +	}
> +	if (lock.l_type == F_UNLCK)
> +		return 0;
> +	return 1;
> +}
> +
>  extern int
>  coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid)
>  {
> @@ -536,15 +566,17 @@
>  		}
>  		if (r == DOMAP_DRY)
>  			continue;
> -
> -		if (conf->override_queueing)
> +#ifndef DAEMON
> +		if (!conf->allow_queueing && !pidfile_check(DEFAULT_PIDFILE))
>  			dm_queue_if_no_path(mpp->alias, 0);
> -		else if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
> -			if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
> -				dm_queue_if_no_path(mpp->alias, 0);
> -			else
> -				dm_queue_if_no_path(mpp->alias, 1);
> -		}
> +		else
> +#endif
> +			if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
> +				if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
> +					dm_queue_if_no_path(mpp->alias, 0);
> +				else
> +					dm_queue_if_no_path(mpp->alias, 1);
> +			}
>  		if (mpp->pg_timeout != PGTIMEOUT_UNDEF) {
>  			if (mpp->pg_timeout == -PGTIMEOUT_NONE)
>  				dm_set_pg_timeout(mpp->alias,  0);
> --- multipath-tools/multipath/main.c	2010/04/16 22:08:03	1.44.2.9
> +++ multipath-tools/multipath/main.c	2010/04/24 05:28:06	1.44.2.10
> @@ -1,7 +1,7 @@
>  /*
>   * Soft:        multipath device mapper target autoconfig
>   *
> - * Version:     $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $
> + * Version:     $Id: main.c,v 1.44.2.10 2010/04/24 05:28:06 bmarzins Exp $
>   *
>   * Author:      Christophe Varoqui
>   *
> @@ -72,7 +72,7 @@
>  usage (char * progname)
>  {
>  	fprintf (stderr, VERSION_STRING);
> -	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r]\n",
> +	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r|-q]\n",
>  		progname);
>  	fprintf (stderr,
>  		"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
> @@ -84,7 +84,7 @@
>  		"\t   2\t\t\tdefault verbosity\n" \
>  		"\t   3\t\t\tprint debug information\n" \
>  		"\t-h\t\tprint this usage text\n" \
> -		"\t-q\t\tforce all maps to turn off queue_if_no_path\n"\
> +		"\t-q\t\tallow queue_if_no_path when multipathd is nor running\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" \
> @@ -337,7 +337,7 @@
>  			conf->verbosity = atoi(optarg);
>  			break;
>  		case 'q':
> -			conf->override_queueing = 1;
> +			conf->allow_queueing = 1;
>  			break;
>  		case 'b':
>  			if (conf->bindings_file)
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

* multipath-tools libmultipath/config.h libmulti ...
@ 2010-09-08 21:40 bmarzins
  0 siblings, 0 replies; 4+ messages in thread
From: bmarzins @ 2010-09-08 21:40 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2010-09-08 21:40:30

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

Log message:
	fix for bz #574813.  There is a new default multipath configuration option,
	"log_checker_err", setting this to "once" will cause multipathd to only log the
	first path failure message at verbosity 2.  Further path failure messages are
	logged at verbosity 3.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.12&r2=1.18.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.14&r2=1.17.2.15
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.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/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.29&r2=1.69.2.30

--- multipath-tools/libmultipath/config.h	2010/09/03 20:59:14	1.18.2.12
+++ multipath-tools/libmultipath/config.h	2010/09/08 21:40:29	1.18.2.13
@@ -80,6 +80,7 @@
 	int checker_timeout;
 	int allow_queueing;
 	int pg_prio_calc;
+	int log_checker_err;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
--- multipath-tools/libmultipath/dict.c	2010/09/03 20:59:14	1.17.2.14
+++ multipath-tools/libmultipath/dict.c	2010/09/08 21:40:30	1.17.2.15
@@ -435,7 +435,24 @@
 	return 0;
 }
 	
+static int
+def_log_checker_err_handler(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+
+	if (!buff)
+		return 1;
 
+	if (strlen(buff) == 4 && !strcmp(buff, "once"))
+		conf->log_checker_err = LOG_CHKR_ERR_ONCE;
+	else if (strlen(buff) == 6 && !strcmp(buff, "always"))
+		conf->log_checker_err = LOG_CHKR_ERR_ALWAYS;
+
+	free(buff);
+	return 0;
+}
 static int
 bindings_file_handler(vector strvec)
 {
@@ -2004,6 +2021,14 @@
 }
 
 static int
+snprint_def_log_checker_err (char *buff, int len, void *data)
+{
+	if (conf->log_checker_err == LOG_CHKR_ERR_ONCE)
+		return snprintf(buff, len, "once");
+	return snprintf(buff, len, "always");
+}
+
+static int
 snprint_def_bindings_file (char * buff, int len, void * data)
 {
 	if (conf->bindings_file == NULL)
@@ -2066,6 +2091,7 @@
 	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("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);
 	install_keyword("mode", &def_mode_handler, &snprint_def_mode);
 	install_keyword("uid", &def_uid_handler, &snprint_def_uid);
--- multipath-tools/libmultipath/structs.h	2010/09/03 20:59:14	1.18.2.7
+++ multipath-tools/libmultipath/structs.h	2010/09/08 21:40:30	1.18.2.8
@@ -89,6 +89,11 @@
 	PG_PRIO_CALC_AVG,
 };
 
+enum log_checker_err_states {
+	LOG_CHKR_ERR_ALWAYS,
+	LOG_CHKR_ERR_ONCE,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
--- multipath-tools/multipathd/main.c	2010/09/01 18:29:18	1.69.2.29
+++ multipath-tools/multipathd/main.c	2010/09/08 21:40:30	1.69.2.30
@@ -74,7 +74,10 @@
 #define CALLOUT_DIR "/var/cache/multipathd"
 
 #define LOG_MSG(a,b) \
-	if (strlen(b)) condlog(a, "%s: %s", pp->dev, b);
+do { \
+	if (strlen(b)) \
+		condlog(a, "%s: %s", pp->dev, b); \
+} while(0)
 
 pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER;
 pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -1111,8 +1114,12 @@
 				condlog(4, "%s: delay next check %is",
 						pp->dev_t, pp->tick);
 			}
-			else if (newstate == PATH_DOWN)
-				LOG_MSG(2, checker_message(&pp->checker));
+			else if (newstate == PATH_DOWN) {
+				if (conf->log_checker_err == LOG_CHKR_ERR_ONCE)
+					LOG_MSG(3, checker_message(&pp->checker));
+				else
+					LOG_MSG(2, checker_message(&pp->checker));
+			}
 
 			pp->state = newstate;
 

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

* multipath-tools libmultipath/config.h libmulti ...
@ 2008-08-22 21:55 bmarzins
  0 siblings, 0 replies; 4+ messages in thread
From: bmarzins @ 2008-08-22 21:55 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-22 21:55:44

Modified files:
	libmultipath   : config.h configure.c devmapper.c devmapper.h 
	                 print.c print.h 
	multipath      : main.c 

Log message:
	Fix for bz 444421. Pulled in various patches from upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.3&r2=1.18.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/configure.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.22.2.3&r2=1.22.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/devmapper.h.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/print.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.2&r2=1.5.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/print.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/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.44.2.5&r2=1.44.2.6

--- multipath-tools/libmultipath/config.h	2008/01/15 01:34:36	1.18.2.3
+++ multipath-tools/libmultipath/config.h	2008/08/22 21:55:43	1.18.2.4
@@ -64,6 +64,7 @@
 	int user_friendly_names;
 	int pg_timeout;
 	int max_fds;
+	int force_reload;
 
 	char * dev;
 	char * udev_dir;
--- multipath-tools/libmultipath/configure.c	2007/06/15 19:03:02	1.2.2.1
+++ multipath-tools/libmultipath/configure.c	2008/08/22 21:55:43	1.2.2.2
@@ -169,6 +169,12 @@
 			mpp->alias);
 		return;
 	}
+	if (conf->force_reload) {
+		mpp->action = ACT_RELOAD;
+		condlog(3, "%s: set ACT_RELOAD (forced by user)",
+			mpp->alias);
+		return;
+	}
 	if (cmpp->size != mpp->size) {
 		mpp->action = ACT_RELOAD;
 		condlog(3, "%s: set ACT_RELOAD (size change)",
@@ -329,8 +335,12 @@
 			break;
 
 		r = dm_addmap(DM_DEVICE_CREATE, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, mpp->wwid);
+			      mpp->params, mpp->size, mpp->wwid, 0);
 
+		if (!r)
+			r = dm_addmap(DM_DEVICE_CREATE, mpp->alias,
+				      DEFAULT_TARGET, mpp->params, mpp->size,
+				      mpp->wwid, 1);
 		/*
 		 * DM_DEVICE_CREATE is actually DM_DEV_CREATE plus
 		 * DM_TABLE_LOAD. Failing the second part leaves an
@@ -347,9 +357,14 @@
 		break;
 
 	case ACT_RELOAD:
-		r = (dm_addmap(DM_DEVICE_RELOAD, mpp->alias, DEFAULT_TARGET,
-			      mpp->params, mpp->size, NULL) &&
-		     dm_simplecmd(DM_DEVICE_RESUME, mpp->alias));
+		r = dm_addmap(DM_DEVICE_RELOAD, mpp->alias, DEFAULT_TARGET,
+			      mpp->params, mpp->size, NULL, 0);
+		if (!r)
+			r = dm_addmap(DM_DEVICE_RELOAD, mpp->alias,
+				      DEFAULT_TARGET, mpp->params, mpp->size,
+				      NULL, 1);
+		if (r)
+			r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias);
 		break;
 
 	case ACT_RENAME:
@@ -415,6 +430,10 @@
 
 	memset(empty_buff, 0, WWID_SIZE);
 
+	if (conf->force_reload)
+		vector_foreach_slot (pathvec, pp1, k)
+			pp1->mpp = NULL;
+
 	vector_foreach_slot (pathvec, pp1, k) {
 		/* skip this path for some reason */
 
--- multipath-tools/libmultipath/devmapper.c	2007/08/16 16:41:58	1.22.2.3
+++ multipath-tools/libmultipath/devmapper.c	2008/08/22 21:55:43	1.22.2.4
@@ -153,7 +153,8 @@
 
 extern int
 dm_addmap (int task, const char *name, const char *target,
-	   const char *params, unsigned long long size, const char *uuid) {
+	   const char *params, unsigned long long size, const char *uuid,
+	   int ro) {
 	int r = 0;
 	struct dm_task *dmt;
 	char *prefixed_uuid = NULL;
@@ -167,6 +168,9 @@
 	if (!dm_task_add_target (dmt, 0, size, target, params))
 		goto addout;
 
+	if (ro)
+		dm_task_set_ro(dmt);
+
 	if (uuid){
 		prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(uuid) + 1);
 		if (!prefixed_uuid) {
--- multipath-tools/libmultipath/devmapper.h	2007/06/15 19:03:02	1.11.2.1
+++ multipath-tools/libmultipath/devmapper.h	2008/08/22 21:55:43	1.11.2.2
@@ -2,7 +2,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 long, const char *uuid);
+	       unsigned long long, const char *uuid, int);
 int dm_map_present (char *);
 int dm_get_map(char *, unsigned long long *, char *);
 int dm_get_status(char *, char *);
--- multipath-tools/libmultipath/print.c	2008/07/09 20:11:33	1.5.2.2
+++ multipath-tools/libmultipath/print.c	2008/08/22 21:55:43	1.5.2.3
@@ -94,6 +94,17 @@
 }
 
 static int
+snprint_ro (char * buff, size_t len, struct multipath * mpp)
+{
+	if (!mpp->dmi)
+		return snprintf(buff, len, "n/a");
+	if (mpp->dmi->read_only)
+		return snprintf(buff, len, "ro");
+	else
+		return snprintf(buff, len, "rw");
+}
+
+static int
 snprint_progress (char * buff, size_t len, int cur, int total)
 {
 	int i = PROGRESS_LEN * cur / total;
@@ -367,6 +378,7 @@
 	{'F', "failback",      0, snprint_failback},
 	{'Q', "queueing",      0, snprint_queueing},
 	{'N', "paths",         0, snprint_nb_paths},
+	{'r', "write_prot",    0, snprint_ro},
 	{'t', "dm-st",         0, snprint_dm_map_state},
 	{'S', "size",          0, snprint_multipath_size},
 	{'f', "features",      0, snprint_features},
@@ -688,7 +700,7 @@
 	if (fwd > len)
 		return len;
 	fwd += snprint_multipath(buff + fwd, len - fwd,
-				 "[size=%S][features=%f][hwhandler=%h]", mpp);
+				 "[size=%S][features=%f][hwhandler=%h][%r]", mpp);
 	if (fwd > len)
 		return len;
 
--- multipath-tools/libmultipath/print.h	2007/01/10 20:08:08	1.3.2.1
+++ multipath-tools/libmultipath/print.h	2008/08/22 21:55:43	1.3.2.2
@@ -1,7 +1,7 @@
 #define PRINT_PATH_LONG      "%w %i %d %D %p %t%T %s"
 #define PRINT_PATH_INDENT    " \\_ %i %d %D %t%T"
 #define PRINT_PATH_CHECKER   "%i %d %D %p %t%T %C"
-#define PRINT_MAP_STATUS     "%n %F %Q %N %t"
+#define PRINT_MAP_STATUS     "%n %F %Q %N %t %r"
 #define PRINT_MAP_STATS      "%n %0 %1 %2 %3 %4"
 #define PRINT_MAP_NAMES      "%n %d %w"
 #define PRINT_PG_INDENT      "\\_ %s [prio=%p]%t"
--- multipath-tools/multipath/main.c	2008/05/12 17:46:41	1.44.2.5
+++ multipath-tools/multipath/main.c	2008/08/22 21:55:43	1.44.2.6
@@ -1,7 +1,7 @@
 /*
  * Soft:        multipath device mapper target autoconfig
  *
- * Version:     $Id: main.c,v 1.44.2.5 2008/05/12 17:46:41 bmarzins Exp $
+ * Version:     $Id: main.c,v 1.44.2.6 2008/08/22 21:55:43 bmarzins Exp $
  *
  * Author:      Christophe Varoqui
  *
@@ -72,7 +72,7 @@
 usage (char * progname)
 {
 	fprintf (stderr, VERSION_STRING);
-	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F]\n",
+	fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r]\n",
 		progname);
 	fprintf (stderr,
 		"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
@@ -90,6 +90,7 @@
 		"\t-ll\t\tshow multipath topology (maximum info)\n" \
 		"\t-f\t\tflush a multipath device map\n" \
 		"\t-F\t\tflush all multipath device maps\n" \
+		"\t-r\t\tforce devmap reload\n" \
 		"\t-p policy\tforce all maps to specified policy :\n" \
 		"\t   failover\t\t1 path per priority group\n" \
 		"\t   multibus\t\tall paths in 1 priority group\n" \
@@ -323,7 +324,7 @@
 	if (load_config(DEFAULT_CONFIGFILE))
 		exit(1);
 
-	while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:")) != EOF ) {
+	while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:r")) != EOF ) {
 		switch(arg) {
 		case 1: printf("optarg : %s\n",optarg);
 			break;
@@ -368,6 +369,9 @@
 				usage(argv[0]);
 			}                
 			break;
+		case 'r':
+			conf->force_reload = 1;
+			break;
 		case 'h':
 			usage(argv[0]);
 		case ':':

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

end of thread, other threads:[~2010-09-08 21:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-24  5:28 multipath-tools libmultipath/config.h libmulti bmarzins
2010-04-24  7:29 ` Christophe Varoqui
  -- strict thread matches above, loose matches on Subject: below --
2010-09-08 21:40 bmarzins
2008-08-22 21:55 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.