c68d736ff4
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
76 lines
1.8 KiB
Diff
76 lines
1.8 KiB
Diff
From a0963a86e12a55d501f421048bd7c09cf4d78b93 Mon Sep 17 00:00:00 2001
|
|
From: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
Date: Wed, 25 Jan 2012 15:18:04 +0100
|
|
Subject: [PATCH 4/4] Spawn mdmon with --offroot if mdadm was launched with
|
|
--offroot
|
|
|
|
Acked-by: Doug Ledford <dledford@redhat.com>
|
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
---
|
|
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.4
|
|
|