All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: dm-devel@redhat.com
Subject: [PATCH 11/11] Make 'multipath -t' able to run as normal user
Date: Fri, 13 Dec 2013 13:14:14 +0100	[thread overview]
Message-ID: <1386936854-8399-12-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1386936854-8399-1-git-send-email-hare@suse.de>

'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

  parent reply	other threads:[~2013-12-13 12:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Hannes Reinecke [this message]
2013-12-13 12:17 ` [PATCH 00/11] SLES resync Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386936854-8399-12-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.