All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] SLES resync
@ 2013-12-13 12:14 Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Hi Christophe,

here are some more patches which have accumulated in my SLES
repository.
Please apply.

Hannes Reinecke (11):
  Remove trailing spaces from sysfs attributes
  Document 'wwids_file' and 'reservation_key'
  libmultipath: Fix typo in retain_attached_hw_handler
  multipath: do not print 'path is up' for removed paths
  libmultipath: proactively remove path
  multipath: do not call tur in sync mode if pthread_cancel fails
  multipathd: Update manpage
  Reset timezone information on reconfigure
  multipathd: Correctly initialize udev context
  multipathd: add path when transitioned from 'blocked' state
  Make 'multipath -t' able to run as normal user

 libmultipath/checkers.c     |  1 +
 libmultipath/checkers.h     |  5 +++++
 libmultipath/checkers/tur.c |  7 +++----
 libmultipath/config.c       |  1 -
 libmultipath/discovery.c    | 17 +++++++++++++----
 libmultipath/log.c          |  1 +
 libmultipath/propsel.c      |  2 +-
 libmultipath/sysfs.c        |  2 +-
 libmultipath/util.c         |  3 ++-
 libmultipath/util.h         |  2 +-
 multipath.conf.annotated    | 17 ++++++++++++++++-
 multipath/main.c            | 22 +++++++++++++---------
 multipathd/main.c           | 35 ++++++++++++++++++++++++++++++-----
 multipathd/multipathd.8     |  6 +++---
 14 files changed, 90 insertions(+), 31 deletions(-)

-- 
1.8.1.4

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

* [PATCH 01/11] Remove trailing spaces from sysfs attributes
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 22:24   ` Christophe Varoqui
  2013-12-13 12:14 ` [PATCH 02/11] Document 'wwids_file' and 'reservation_key' Hannes Reinecke
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Some sysfs attributes may contain trailing spaces, which only
serve to confuse matters. So strip them before continuing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/discovery.c | 2 +-
 libmultipath/util.c      | 3 ++-
 libmultipath/util.h      | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d5557d9..d519c02 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -164,7 +164,7 @@ sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len)	\
 		return -EINVAL;						\
 	}								\
 	ret = strlcpy(buff, attr, len);					\
-	return ret;							\
+	return strchop(buff);						\
 }
 
 declare_sysfs_get_str(devtype);
diff --git a/libmultipath/util.c b/libmultipath/util.c
index a9f5939..e6fd11d 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -10,13 +10,14 @@
 #include "vector.h"
 #include "structs.h"
 
-void
+size_t
 strchop(char *str)
 {
 	int i;
 
 	for (i=strlen(str)-1; i >=0 && isspace(str[i]); --i) ;
 	str[++i] = '\0';
+	return strlen(str);
 }
 
 int
diff --git a/libmultipath/util.h b/libmultipath/util.h
index 44184a1..7b67dff 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -1,7 +1,7 @@
 #ifndef _UTIL_H
 #define _UTIL_H
 
-void strchop(char *);
+size_t strchop(char *);
 int basenamecpy (const char * src, char * dst, int);
 int filepresent (char * run);
 int get_word (char * sentence, char ** word);
-- 
1.8.1.4

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

* [PATCH 02/11] Document 'wwids_file' and 'reservation_key'
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 03/11] libmultipath: Fix typo in retain_attached_hw_handler Hannes Reinecke
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Add documentation for 'wwids_file' and 'reservation_key' to
multipath.conf.annotated.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipath.conf.annotated | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/multipath.conf.annotated b/multipath.conf.annotated
index a20302c..235e130 100644
--- a/multipath.conf.annotated
+++ b/multipath.conf.annotated
@@ -275,7 +275,22 @@
 #	#           the user_friendly_names option.
 #	# values  : <full_pathname>
 #	# default : "/var/lib/multipath/bindings"
-#	bindings_file "/etc/multipath_bindings"
+#	bindings_file "/etc/multipath/bindings"
+#
+#	# name    : wwids_file
+#	# scope   : multipath
+#	# desc    : The location of the wwids file multipath uses to
+#       #           keep track of the created multipath devices.
+#	# values  : <full_pathname>
+#	# default : "/var/lib/multipath/wwids"
+#	wwids_file "/etc/multipath/wwids"
+#
+#	# name    : reservation_key
+#	# scope   : multipath
+#	# desc    : Service action reservation key used by mpathpersist.
+#	# values  : <key>
+#	# default : (null)
+#	reservation_key "mpathkey"
 #
 #}
 #	
-- 
1.8.1.4

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

* [PATCH 03/11] libmultipath: Fix typo in retain_attached_hw_handler
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 02/11] Document 'wwids_file' and 'reservation_key' Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 04/11] multipath: do not print 'path is up' for removed paths Hannes Reinecke
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/propsel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index f092227..5fe72af 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -680,7 +680,7 @@ select_retain_hwhandler (struct multipath * mp)
 
 	if (!VERSION_GE(conf->version, minv_dm_retain)) {
 		mp->retain_hwhandler = RETAIN_HWHANDLER_OFF;
-		condlog(3, "%s: retain_attached_hw_hander disabled (requires kernel version >= 1.5.0)", mp->alias);
+		condlog(3, "%s: retain_attached_hw_handler disabled (requires kernel version >= 1.5.0)", mp->alias);
 		return 0;
 	}
 
-- 
1.8.1.4

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

* [PATCH 04/11] multipath: do not print 'path is up' for removed paths
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (2 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 03/11] libmultipath: Fix typo in retain_attached_hw_handler Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 05/11] libmultipath: proactively remove path Hannes Reinecke
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

When a path is removed the previous checker message is still
kept in the checker context, and will be printed upon each
check. This causes multipath to print out
'path is up'
even though it already has been removed from sysfs.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 91d7bfc..2633da9 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1124,6 +1124,8 @@ check_path (struct vectors * vecs, struct path * pp)
 	newstate = path_offline(pp);
 	if (newstate == PATH_UP)
 		newstate = get_state(pp, 1);
+	else
+		checker_clear_message(&pp->checker);
 
 	if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
 		condlog(2, "%s: unusable path", pp->dev);
@@ -1150,7 +1152,9 @@ check_path (struct vectors * vecs, struct path * pp)
 	if (newstate != pp->state) {
 		int oldstate = pp->state;
 		pp->state = newstate;
-		LOG_MSG(1, checker_message(&pp->checker));
+
+		if (strlen(checker_message(&pp->checker)))
+			LOG_MSG(1, checker_message(&pp->checker));
 
 		/*
 		 * upon state change, reset the checkint
@@ -1232,7 +1236,8 @@ check_path (struct vectors * vecs, struct path * pp)
 			pp->tick = pp->checkint;
 		}
 	}
-	else if (newstate == PATH_DOWN) {
+	else if (newstate == PATH_DOWN &&
+		 strlen(checker_message(&pp->checker))) {
 		if (conf->log_checker_err == LOG_CHKR_ERR_ONCE)
 			LOG_MSG(3, checker_message(&pp->checker));
 		else
-- 
1.8.1.4

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

* [PATCH 05/11] libmultipath: proactively remove path
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (3 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 04/11] multipath: do not print 'path is up' for removed paths Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 06/11] multipath: do not call tur in sync mode if pthread_cancel fails Hannes Reinecke
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

When path_offline() detects a removed path we really do not need
to wait for any uevent to arrive, but can remove the path
straightaway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/checkers.c  |  1 +
 libmultipath/checkers.h  |  5 +++++
 libmultipath/discovery.c | 15 ++++++++++++---
 libmultipath/sysfs.c     |  2 +-
 multipathd/main.c        |  5 +++++
 5 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index 47f5c68..4a4cd7c 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -18,6 +18,7 @@ char *checker_state_names[] = {
       "ghost",
       "pending",
       "timeout",
+      "removed",
 };
 
 static LIST_HEAD(checkers);
diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
index 1b6c22d..e62b52f 100644
--- a/libmultipath/checkers.h
+++ b/libmultipath/checkers.h
@@ -50,6 +50,10 @@
  * PATH_TIMEOUT:
  * - Use: Only tur checker
  * - Description: Command timed out
+ *
+ * PATH REMOVED:
+ * - Use: All checkers
+ * - Description: Device has been removed from the system
  */
 enum path_check_state {
 	PATH_WILD,
@@ -60,6 +64,7 @@ enum path_check_state {
 	PATH_GHOST,
 	PATH_PENDING,
 	PATH_TIMEOUT,
+	PATH_REMOVED,
 	PATH_MAX_STATE
 };
 
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d519c02..ccd3b62 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -839,6 +839,7 @@ path_offline (struct path * pp)
 {
 	struct udev_device * parent;
 	char buff[SCSI_STATE_SIZE];
+	int err;
 
 	if (pp->bus != SYSFS_BUS_SCSI)
 		return PATH_UP;
@@ -853,12 +854,18 @@ path_offline (struct path * pp)
 
 	if (!parent) {
 		condlog(1, "%s: failed to get sysfs information", pp->dev);
-		return PATH_DOWN;
+		return PATH_REMOVED;
 	}
 
 	memset(buff, 0x0, SCSI_STATE_SIZE);
-	if (sysfs_attr_get_value(parent, "state", buff, SCSI_STATE_SIZE) <= 0)
-		return PATH_DOWN;
+	err = sysfs_attr_get_value(parent, "state", buff, SCSI_STATE_SIZE);
+	if (err <= 0) {
+		if (err == -ENXIO)
+			return PATH_REMOVED;
+		else
+			return PATH_DOWN;
+	}
+
 
 	condlog(3, "%s: path state = %s", pp->dev, buff);
 
@@ -1084,6 +1091,8 @@ pathinfo (struct path *pp, vector hwtable, int mask)
 	}
 
 	path_state = path_offline(pp);
+	if (path_state == PATH_REMOVED)
+		goto blank;
 
 	/*
 	 * fetch info not available through sysfs
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 8ba27d4..e5834f9 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -59,7 +59,7 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
 	condlog(4, "open '%s'", devpath);
 	if (stat(devpath, &statbuf) != 0) {
 		condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
-		return -errno;
+		return -ENXIO;
 	}
 
 	/* skip directories */
diff --git a/multipathd/main.c b/multipathd/main.c
index 2633da9..96564f8 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1122,6 +1122,11 @@ check_path (struct vectors * vecs, struct path * pp)
 	pp->tick = conf->checkint;
 
 	newstate = path_offline(pp);
+	if (newstate == PATH_REMOVED) {
+		condlog(2, "%s: remove path (checker)", pp->dev);
+		ev_remove_path(pp, vecs);
+		return;
+	}
 	if (newstate == PATH_UP)
 		newstate = get_state(pp, 1);
 	else
-- 
1.8.1.4

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

* [PATCH 06/11] multipath: do not call tur in sync mode if pthread_cancel fails
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (4 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 05/11] libmultipath: proactively remove path Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 07/11] multipathd: Update manpage Hannes Reinecke
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

When pthread_cancel fails the thread is stuck, most likely
during I/O submission. So it would be pointless to call the
tur checker in sync mode here, as this would be stuck, too.
Hence we should rather return 'PATH_TIMEOUT' and hope the
situation resolves itself over time.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/checkers/tur.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index b76dcec..bd7372d 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -298,7 +298,6 @@ libcheck_check (struct checker * c)
 				ct->running = 0;
 				MSG(c, MSG_TUR_TIMEOUT);
 				tur_status = PATH_TIMEOUT;
-				ct->state = PATH_UNCHECKED;
 			} else {
 				condlog(3, "%d:%d: tur checker not finished",
 					TUR_DEVT(ct));
@@ -317,9 +316,9 @@ libcheck_check (struct checker * c)
 		if (ct->thread) {
 			/* pthread cancel failed. continue in sync mode */
 			pthread_mutex_unlock(&ct->lock);
-			condlog(3, "%d:%d: tur thread not responding, "
-				"using sync mode", TUR_DEVT(ct));
-			return tur_check(c->fd, c->timeout, c->message);
+			condlog(3, "%d:%d: tur thread not responding",
+				TUR_DEVT(ct));
+			return PATH_TIMEOUT;
 		}
 		/* Start new TUR checker */
 		ct->state = PATH_UNCHECKED;
-- 
1.8.1.4

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

* [PATCH 07/11] multipathd: Update manpage
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (5 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 06/11] multipath: do not call tur in sync mode if pthread_cancel fails Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 08/11] Reset timezone information on reconfigure Hannes Reinecke
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Some aliases for CLI command arguments were missing from the
manpage.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/multipathd.8 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
index ccc5f54..17bf650 100644
--- a/multipathd/multipathd.8
+++ b/multipathd/multipathd.8
@@ -83,16 +83,16 @@ Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g
 .B remove|del path $path
 Stop monitoring a path. $path is as listed in /sys/block (e.g. sda).
 .TP
-.B add map $map
+.B add map|multipath $map
 Add a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0) or it can be the alias for the multipath device (e.g. mpath1) or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa). 
 .TP
-.B remove|del map $map
+.B remove|del map|multipath $map
 Stop monitoring a multipath device.
 .TP
 .B resize map|multipath $map
 Resizes map $map to the given size
 .TP 
-.B switch|switchgroup map $map group $group
+.B switch|switchgroup map|multipath $map group $group
 Force a multipath device to switch to a specific path group. $group is the path group index, starting with 1.
 .TP
 .B reconfigure
-- 
1.8.1.4

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

* [PATCH 08/11] Reset timezone information on reconfigure
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (6 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 07/11] multipathd: Update manpage Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 22:22   ` Christophe Varoqui
  2013-12-13 12:14 ` [PATCH 09/11] multipathd: Correctly initialize udev context Hannes Reinecke
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

Whenever 'reconfigure' is called we need to re-initialize the
timezone information as it might have been changed in the
meantime.

References: bnc#830511

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/log.c | 1 +
 multipathd/main.c  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/libmultipath/log.c b/libmultipath/log.c
index 37c7cd7..74702d8 100644
--- a/libmultipath/log.c
+++ b/libmultipath/log.c
@@ -99,6 +99,7 @@ void log_close (void)
 void log_reset (char *program_name)
 {
 	closelog();
+	tzset();
 	openlog(program_name, 0, LOG_DAEMON);
 }
 
diff --git a/multipathd/main.c b/multipathd/main.c
index 96564f8..1a1aa2d 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1416,6 +1416,9 @@ reconfigure (struct vectors * vecs)
 	vecs->pathvec = NULL;
 	conf = NULL;
 
+	/* Re-read any timezone changes */
+	tzset();
+
 	if (!load_config(DEFAULT_CONFIGFILE, udev)) {
 		conf->verbosity = old->verbosity;
 		conf->daemon = 1;
-- 
1.8.1.4

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

* [PATCH 09/11] multipathd: Correctly initialize udev context
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (7 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 08/11] Reset timezone information on reconfigure Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:14 ` [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state Hannes Reinecke
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

The udev context is passed as argument to ueventloop(), so
we should be using that instead of the global variable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/multipathd/main.c b/multipathd/main.c
index 1a1aa2d..7058147 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -836,6 +836,8 @@ out:
 static void *
 ueventloop (void * ap)
 {
+	struct udev *udev = ap;
+
 	if (uevent_listen(udev))
 		condlog(0, "error starting uevent listener");
 
-- 
1.8.1.4

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

* [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (8 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 09/11] multipathd: Correctly initialize udev context Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 22:02   ` Christophe Varoqui
  2013-12-13 12:14 ` [PATCH 11/11] Make 'multipath -t' able to run as normal user Hannes Reinecke
  2013-12-13 12:17 ` [PATCH 00/11] SLES resync Hannes Reinecke
  11 siblings, 1 reply; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

When a path is discovered in 'blocked' state it won't be added
to the path list as we cannot get the path uuid.
And any further check will fail here as the uuid won't be
recovered. So add a check in checkerloop() to re-add the
path if it gets out of a 'blocked' state.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/main.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 7058147..cc5cf67 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1111,9 +1111,6 @@ check_path (struct vectors * vecs, struct path * pp)
 	int chkr_new_path_up = 0;
 	int oldchkrstate = pp->chkrstate;
 
-	if (!pp->mpp)
-		return;
-
 	if (pp->tick && --pp->tick)
 		return; /* don't check this path yet */
 
@@ -1139,6 +1136,17 @@ check_path (struct vectors * vecs, struct path * pp)
 		pathinfo(pp, conf->hwtable, 0);
 		return;
 	}
+	if (!pp->mpp) {
+		if (!strlen(pp->wwid) &&
+		    (newstate == PATH_UP || newstate == PATH_GHOST)) {
+			condlog(2, "%s: add missing path", pp->dev);
+			if (pathinfo(pp, conf->hwtable, DI_ALL) == 0) {
+				ev_add_path(pp, vecs);
+				pp->tick = 1;
+			}
+		}
+		return;
+	}
 	/*
 	 * Async IO in flight. Keep the previous path state
 	 * and reschedule as soon as possible
-- 
1.8.1.4

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

* [PATCH 11/11] Make 'multipath -t' able to run as normal user
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (9 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state Hannes Reinecke
@ 2013-12-13 12:14 ` Hannes Reinecke
  2013-12-13 12:17 ` [PATCH 00/11] SLES resync Hannes Reinecke
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:14 UTC (permalink / raw
  To: dm-devel

'multipath -t' should be run as normal user, as we might be
needing it to update the default configuration.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/config.c |  1 -
 multipath/main.c      | 22 +++++++++++++---------
 multipathd/main.c     |  2 ++
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/libmultipath/config.c b/libmultipath/config.c
index 9b7adda..e13c307 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -543,7 +543,6 @@ load_config (char * file, struct udev *udev)
 		conf->verbosity = DEFAULT_VERBOSITY;
 
 	conf->udev = udev;
-	dm_drv_version(conf->version, TGT_MPATH);
 	conf->dev_type = DEV_NONE;
 	conf->minio = DEFAULT_MINIO;
 	conf->minio_rq = DEFAULT_MINIO_RQ;
diff --git a/multipath/main.c b/multipath/main.c
index 842a787..c351507 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -447,16 +447,8 @@ main (int argc, char *argv[])
 	extern int optind;
 	int r = 1;
 
-	if (getuid() != 0) {
-		fprintf(stderr, "need to be root\n");
-		exit(1);
-	}
-
 	udev = udev_new();
 
-	if (dm_prereq())
-		exit(1);
-
 	if (load_config(DEFAULT_CONFIGFILE, udev))
 		exit(1);
 
@@ -521,7 +513,7 @@ main (int argc, char *argv[])
 			break;
 		case 't':
 			r = dump_config();
-			goto out;
+			goto out_free_config;
 		case 'h':
 			usage(argv[0]);
 			exit(0);
@@ -544,6 +536,16 @@ main (int argc, char *argv[])
 			exit(1);
 		}
 	}
+
+	if (getuid() != 0) {
+		fprintf(stderr, "need to be root\n");
+		exit(1);
+	}
+
+	if (dm_prereq())
+		exit(1);
+	dm_drv_version(conf->version, TGT_MPATH);
+
 	if (optind < argc) {
 		conf->dev = MALLOC(FILE_NAME_SIZE);
 
@@ -630,6 +632,8 @@ out:
 
 	cleanup_prio();
 	cleanup_checkers();
+
+out_free_config:
 	/*
 	 * Freeing config must be done after dm_lib_exit(), because
 	 * the logging function (dm_write_log()), which is called there,
diff --git a/multipathd/main.c b/multipathd/main.c
index cc5cf67..7f59c6d 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1430,6 +1430,7 @@ reconfigure (struct vectors * vecs)
 	tzset();
 
 	if (!load_config(DEFAULT_CONFIGFILE, udev)) {
+		dm_drv_version(conf->version, TGT_MPATH);
 		conf->verbosity = old->verbosity;
 		conf->daemon = 1;
 		configure(vecs, 1);
@@ -1634,6 +1635,7 @@ child (void * param)
 	if (load_config(DEFAULT_CONFIGFILE, udev))
 		exit(1);
 
+	dm_drv_version(conf->version, TGT_MPATH);
 	if (init_checkers()) {
 		condlog(0, "failed to initialize checkers");
 		exit(1);
-- 
1.8.1.4

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

* Re: [PATCH 00/11] SLES resync
  2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
                   ` (10 preceding siblings ...)
  2013-12-13 12:14 ` [PATCH 11/11] Make 'multipath -t' able to run as normal user Hannes Reinecke
@ 2013-12-13 12:17 ` Hannes Reinecke
  11 siblings, 0 replies; 16+ messages in thread
From: Hannes Reinecke @ 2013-12-13 12:17 UTC (permalink / raw
  To: Christophe Varoqui; +Cc: dm-devel

On 12/13/2013 01:14 PM, Hannes Reinecke wrote:
> Hi Christophe,
> 
> here are some more patches which have accumulated in my SLES
> repository.
> Please apply.
> 
And with that I don't have patches pending anymore, so now would be
a good time to cut a new version.

(Provided those patches will be applied, of course :-)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

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

* Re: [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state
  2013-12-13 12:14 ` [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state Hannes Reinecke
@ 2013-12-13 22:02   ` Christophe Varoqui
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe Varoqui @ 2013-12-13 22:02 UTC (permalink / raw
  To: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 2172 bytes --]

Hannes,

I merged the patchset.

Can you post a patch to set return values to the
multipathd/main.c::patch_check() exit points where it is not present.
This 11/12 patch adds one, and the "proactive path removal" patch adds the
other.
This requirement was introduced by your earlier "check timing" patch.

Thanks,
Christophe Varoqui


On Fri, Dec 13, 2013 at 1:14 PM, Hannes Reinecke <hare@suse.de> wrote:

> When a path is discovered in 'blocked' state it won't be added
> to the path list as we cannot get the path uuid.
> And any further check will fail here as the uuid won't be
> recovered. So add a check in checkerloop() to re-add the
> path if it gets out of a 'blocked' state.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  multipathd/main.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 7058147..cc5cf67 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1111,9 +1111,6 @@ check_path (struct vectors * vecs, struct path * pp)
>         int chkr_new_path_up = 0;
>         int oldchkrstate = pp->chkrstate;
>
> -       if (!pp->mpp)
> -               return;
> -
>         if (pp->tick && --pp->tick)
>                 return; /* don't check this path yet */
>
> @@ -1139,6 +1136,17 @@ check_path (struct vectors * vecs, struct path * pp)
>                 pathinfo(pp, conf->hwtable, 0);
>                 return;
>         }
> +       if (!pp->mpp) {
> +               if (!strlen(pp->wwid) &&
> +                   (newstate == PATH_UP || newstate == PATH_GHOST)) {
> +                       condlog(2, "%s: add missing path", pp->dev);
> +                       if (pathinfo(pp, conf->hwtable, DI_ALL) == 0) {
> +                               ev_add_path(pp, vecs);
> +                               pp->tick = 1;
> +                       }
> +               }
> +               return;
> +       }
>         /*
>          * Async IO in flight. Keep the previous path state
>          * and reschedule as soon as possible
> --
> 1.8.1.4
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>

[-- Attachment #1.2: Type: text/html, Size: 3042 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH 08/11] Reset timezone information on reconfigure
  2013-12-13 12:14 ` [PATCH 08/11] Reset timezone information on reconfigure Hannes Reinecke
@ 2013-12-13 22:22   ` Christophe Varoqui
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe Varoqui @ 2013-12-13 22:22 UTC (permalink / raw
  To: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 2099 bytes --]

Hannes,

FYI, related to your latest patchset,

commit dd205886ed2d41bb8e2602cb9771be403a99cd27
Author: Christophe Varoqui <christophe.varoqui@opensvc.com>
Date:   Fri Dec 13 23:20:40 2013 +0100

    Add missing includes to support tzget() usage

diff --git a/libmultipath/log.c b/libmultipath/log.c
index 74702d8..ab92e2a 100644
--- a/libmultipath/log.c
+++ b/libmultipath/log.c
@@ -8,6 +8,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <syslog.h>
+#include <time.h>

 #include "memory.h"
 #include "log.h"
diff --git a/multipathd/main.c b/multipathd/main.c
index 37a9bc2..fd70b70 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -22,6 +22,7 @@
 #endif
 #include <semaphore.h>
 #include <mpath_persist.h>
+#include <time.h>

 /*
  * libcheckers


Best regards,
Christophe Varoqui


On Fri, Dec 13, 2013 at 1:14 PM, Hannes Reinecke <hare@suse.de> wrote:

> Whenever 'reconfigure' is called we need to re-initialize the
> timezone information as it might have been changed in the
> meantime.
>
> References: bnc#830511
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  libmultipath/log.c | 1 +
>  multipathd/main.c  | 3 +++
>  2 files changed, 4 insertions(+)
>
> diff --git a/libmultipath/log.c b/libmultipath/log.c
> index 37c7cd7..74702d8 100644
> --- a/libmultipath/log.c
> +++ b/libmultipath/log.c
> @@ -99,6 +99,7 @@ void log_close (void)
>  void log_reset (char *program_name)
>  {
>         closelog();
> +       tzset();
>         openlog(program_name, 0, LOG_DAEMON);
>  }
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 96564f8..1a1aa2d 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1416,6 +1416,9 @@ reconfigure (struct vectors * vecs)
>         vecs->pathvec = NULL;
>         conf = NULL;
>
> +       /* Re-read any timezone changes */
> +       tzset();
> +
>         if (!load_config(DEFAULT_CONFIGFILE, udev)) {
>                 conf->verbosity = old->verbosity;
>                 conf->daemon = 1;
> --
> 1.8.1.4
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>

[-- Attachment #1.2: Type: text/html, Size: 3295 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH 01/11] Remove trailing spaces from sysfs attributes
  2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
@ 2013-12-13 22:24   ` Christophe Varoqui
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe Varoqui @ 2013-12-13 22:24 UTC (permalink / raw
  To: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 3763 bytes --]

Hannes,

FYI, related to this patch,

commit 3e7763345a31e81318b70d7af68902984312f624
Author: Christophe Varoqui <christophe.varoqui@opensvc.com>
Date:   Fri Dec 13 23:10:27 2013 +0100

    [libmultipath] Fix a compilation warning

    Now that we chop the sysfs attribute strings, the size returned
    by strlcpy is not used anymore. Remove the variable to tame
    the compiler warning.

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ccd3b62..b7470f8 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -143,7 +143,6 @@ path_discovery (vector pathvec, struct config * conf,
int flag)
 extern ssize_t                                                         \
 sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \
 {                                                                      \
-       ssize_t ret;                                                    \
        const char * attr;                                              \
        const char * devname;                                           \
                                                                        \
@@ -163,7 +162,7 @@ sysfs_get_##fname (struct udev_device * udev, char *
buff, size_t len)      \
                        devname, #fname);                               \
                return -EINVAL;                                         \
        }                                                               \
-       ret = strlcpy(buff, attr, len);                                 \
+       strlcpy(buff, attr, len);                                       \
        return strchop(buff);                                           \
 }

Best regards,
Christophe Varoqui


On Fri, Dec 13, 2013 at 1:14 PM, Hannes Reinecke <hare@suse.de> wrote:

> Some sysfs attributes may contain trailing spaces, which only
> serve to confuse matters. So strip them before continuing.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  libmultipath/discovery.c | 2 +-
>  libmultipath/util.c      | 3 ++-
>  libmultipath/util.h      | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index d5557d9..d519c02 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -164,7 +164,7 @@ sysfs_get_##fname (struct udev_device * udev, char *
> buff, size_t len)      \
>                 return -EINVAL;                                         \
>         }                                                               \
>         ret = strlcpy(buff, attr, len);                                 \
> -       return ret;                                                     \
> +       return strchop(buff);                                           \
>  }
>
>  declare_sysfs_get_str(devtype);
> diff --git a/libmultipath/util.c b/libmultipath/util.c
> index a9f5939..e6fd11d 100644
> --- a/libmultipath/util.c
> +++ b/libmultipath/util.c
> @@ -10,13 +10,14 @@
>  #include "vector.h"
>  #include "structs.h"
>
> -void
> +size_t
>  strchop(char *str)
>  {
>         int i;
>
>         for (i=strlen(str)-1; i >=0 && isspace(str[i]); --i) ;
>         str[++i] = '\0';
> +       return strlen(str);
>  }
>
>  int
> diff --git a/libmultipath/util.h b/libmultipath/util.h
> index 44184a1..7b67dff 100644
> --- a/libmultipath/util.h
> +++ b/libmultipath/util.h
> @@ -1,7 +1,7 @@
>  #ifndef _UTIL_H
>  #define _UTIL_H
>
> -void strchop(char *);
> +size_t strchop(char *);
>  int basenamecpy (const char * src, char * dst, int);
>  int filepresent (char * run);
>  int get_word (char * sentence, char ** word);
> --
> 1.8.1.4
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>

[-- Attachment #1.2: Type: text/html, Size: 4964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-12-13 22:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13 12:14 [PATCH 00/11] SLES resync Hannes Reinecke
2013-12-13 12:14 ` [PATCH 01/11] Remove trailing spaces from sysfs attributes Hannes Reinecke
2013-12-13 22:24   ` Christophe Varoqui
2013-12-13 12:14 ` [PATCH 02/11] Document 'wwids_file' and 'reservation_key' Hannes Reinecke
2013-12-13 12:14 ` [PATCH 03/11] libmultipath: Fix typo in retain_attached_hw_handler Hannes Reinecke
2013-12-13 12:14 ` [PATCH 04/11] multipath: do not print 'path is up' for removed paths Hannes Reinecke
2013-12-13 12:14 ` [PATCH 05/11] libmultipath: proactively remove path Hannes Reinecke
2013-12-13 12:14 ` [PATCH 06/11] multipath: do not call tur in sync mode if pthread_cancel fails Hannes Reinecke
2013-12-13 12:14 ` [PATCH 07/11] multipathd: Update manpage Hannes Reinecke
2013-12-13 12:14 ` [PATCH 08/11] Reset timezone information on reconfigure Hannes Reinecke
2013-12-13 22:22   ` Christophe Varoqui
2013-12-13 12:14 ` [PATCH 09/11] multipathd: Correctly initialize udev context Hannes Reinecke
2013-12-13 12:14 ` [PATCH 10/11] multipathd: add path when transitioned from 'blocked' state Hannes Reinecke
2013-12-13 22:02   ` Christophe Varoqui
2013-12-13 12:14 ` [PATCH 11/11] Make 'multipath -t' able to run as normal user Hannes Reinecke
2013-12-13 12:17 ` [PATCH 00/11] SLES resync Hannes Reinecke

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.