From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com, kay@redhat.com,
harald@redhat.com, lpoetter@redhat.com, mschmidt@redhat.com
Subject: [PATCH 4/4] Spawn mdmon with --offroot if mdadm was launched with --offroot
Date: Wed, 25 Jan 2012 16:18:04 +0100 [thread overview]
Message-ID: <1327504684-9219-5-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1327504684-9219-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
mdadm.c | 1 +
mdadm.h | 2 ++
util.c | 17 +++++++++++++----
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/mdadm.c b/mdadm.c
index 78f28d5..1efa3e8 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -181,6 +181,7 @@ int main(int argc, char *argv[])
*/
case OffRootOpt:
argv[0][0] = '@';
+ __offroot = 1;
continue;
case ':':
diff --git a/mdadm.h b/mdadm.h
index fec93aa..d862b3e 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1383,3 +1383,5 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
#define PROCESS_DELAYED -2
#define PROCESS_PENDING -3
+
+extern int __offroot;
diff --git a/util.c b/util.c
index 6985a70..4ba44e6 100644
--- a/util.c
+++ b/util.c
@@ -32,6 +32,8 @@
#include <dirent.h>
#include <signal.h>
+int __offroot;
+
/*
* following taken from linux/blkpg.h because they aren't
* anywhere else and it isn't safe to #include linux/ * stuff.
@@ -1622,10 +1624,17 @@ int start_mdmon(int devnum)
skipped = 0;
for (i=0; paths[i]; i++)
- if (paths[i][0])
- execl(paths[i], "mdmon",
- devnum2devname(devnum),
- NULL);
+ if (paths[i][0]) {
+ if (__offroot) {
+ execl(paths[i], "mdmon", "--offroot",
+ devnum2devname(devnum),
+ NULL);
+ } else {
+ execl(paths[i], "mdmon",
+ devnum2devname(devnum),
+ NULL);
+ }
+ }
exit(1);
case -1: fprintf(stderr, Name ": cannot run mdmon. "
"Array remains readonly\n");
--
1.7.8.3
next prev parent reply other threads:[~2012-01-25 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 15:18 [PATCH v3 0/4] add --offroot argument to mdadm/mdmon Jes.Sorensen
2012-01-25 15:18 ` [PATCH 1/4] mdmon: Use getopt_long() to parse command line options Jes.Sorensen
2012-01-25 15:18 ` [PATCH 2/4] Add --offroot argument to mdadm Jes.Sorensen
2012-01-25 15:18 ` [PATCH 3/4] Add --offroot argument to mdmon Jes.Sorensen
2012-01-25 15:18 ` Jes.Sorensen [this message]
2012-01-30 1:10 ` [PATCH 4/4] Spawn mdmon with --offroot if mdadm was launched with --offroot NeilBrown
2012-01-30 9:06 ` Jes Sorensen
2012-01-25 16:02 ` [PATCH v3 0/4] add --offroot argument to mdadm/mdmon Doug Ledford
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=1327504684-9219-5-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=harald@redhat.com \
--cc=kay@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=lpoetter@redhat.com \
--cc=mschmidt@redhat.com \
--cc=neilb@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).