|
|
373056 |
From 3e23ba9d7bd3c2a9fbddc286014480672763e563 Mon Sep 17 00:00:00 2001
|
|
|
373056 |
From: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
|
373056 |
Date: Fri, 1 Feb 2013 16:15:17 +0100
|
|
|
373056 |
Subject: [PATCH 1/4] Remove --offroot argument and default to always setting
|
|
|
373056 |
argv[0] to @
|
|
|
373056 |
|
|
|
373056 |
We still allow --offroot to be given - for compatibility with scripts
|
|
|
373056 |
- but ignore it.
|
|
|
373056 |
|
|
|
373056 |
The whole point of --offroot is to get systemd to not auto-kill mdmon,
|
|
|
373056 |
and we always want that.
|
|
|
373056 |
|
|
|
373056 |
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
|
|
|
373056 |
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
|
373056 |
---
|
|
|
373056 |
ReadMe.c | 4 ----
|
|
|
373056 |
mdadm.8.in | 11 -----------
|
|
|
373056 |
mdadm.c | 15 ++++++++-------
|
|
|
373056 |
mdadm.h | 2 --
|
|
|
373056 |
mdmon.8 | 11 +----------
|
|
|
373056 |
mdmon.c | 14 ++++++--------
|
|
|
373056 |
util.c | 13 ++-----------
|
|
|
373056 |
7 files changed, 17 insertions(+), 53 deletions(-)
|
|
|
373056 |
|
|
|
373056 |
diff --git a/ReadMe.c b/ReadMe.c
|
|
|
373056 |
index 4214cb0..c4bb730 100644
|
|
|
373056 |
--- a/ReadMe.c
|
|
|
373056 |
+++ b/ReadMe.c
|
|
|
373056 |
@@ -259,10 +259,6 @@ char OptionHelp[] =
|
|
|
373056 |
" --query -Q : Display general information about how a\n"
|
|
|
373056 |
" device relates to the md driver\n"
|
|
|
373056 |
" --auto-detect : Start arrays auto-detected by the kernel\n"
|
|
|
373056 |
-" --offroot : Set first character of argv[0] to @ to indicate the\n"
|
|
|
373056 |
-" application was launched from initrd/initramfs and\n"
|
|
|
373056 |
-" should not be shutdown by systemd as part of the\n"
|
|
|
373056 |
-" regular shutdown process.\n"
|
|
|
373056 |
;
|
|
|
373056 |
/*
|
|
|
373056 |
"\n"
|
|
|
373056 |
diff --git a/mdadm.8.in b/mdadm.8.in
|
|
|
373056 |
index c1881cd..a3abc2d 100644
|
|
|
373056 |
--- a/mdadm.8.in
|
|
|
373056 |
+++ b/mdadm.8.in
|
|
|
373056 |
@@ -255,17 +255,6 @@ Avoid printing purely informative messages. With this,
|
|
|
373056 |
.I mdadm
|
|
|
373056 |
will be silent unless there is something really important to report.
|
|
|
373056 |
|
|
|
373056 |
-.TP
|
|
|
373056 |
-.BR \-\-offroot
|
|
|
373056 |
-Set first character of argv[0] to @ to indicate mdadm was launched
|
|
|
373056 |
-from initrd/initramfs and should not be shutdown by systemd as part of
|
|
|
373056 |
-the regular shutdown process. This option is normally only used by
|
|
|
373056 |
-the system's initscripts. Please see here for more details on how
|
|
|
373056 |
-systemd handled argv[0]:
|
|
|
373056 |
-.IP
|
|
|
373056 |
-.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
|
|
|
373056 |
-.PP
|
|
|
373056 |
-
|
|
|
373056 |
|
|
|
373056 |
.TP
|
|
|
373056 |
.BR \-f ", " \-\-force
|
|
|
373056 |
diff --git a/mdadm.c b/mdadm.c
|
|
|
373056 |
index 26e8cec..f22fd7b 100644
|
|
|
373056 |
--- a/mdadm.c
|
|
|
373056 |
+++ b/mdadm.c
|
|
|
373056 |
@@ -116,6 +116,13 @@ int main(int argc, char *argv[])
|
|
|
373056 |
ident.container = NULL;
|
|
|
373056 |
ident.member = NULL;
|
|
|
373056 |
|
|
|
373056 |
+ /*
|
|
|
373056 |
+ * set first char of argv[0] to @. This is used by
|
|
|
373056 |
+ * systemd to signal that the task was launched from
|
|
|
373056 |
+ * initrd/initramfs and should be preserved during shutdown
|
|
|
373056 |
+ */
|
|
|
373056 |
+ argv[0][0] = '@';
|
|
|
373056 |
+
|
|
|
373056 |
while ((option_index = -1) ,
|
|
|
373056 |
(opt=getopt_long(argc, argv,
|
|
|
373056 |
shortopt, long_options,
|
|
|
373056 |
@@ -159,14 +166,8 @@ int main(int argc, char *argv[])
|
|
|
373056 |
homehost = optarg;
|
|
|
373056 |
continue;
|
|
|
373056 |
|
|
|
373056 |
- /*
|
|
|
373056 |
- * --offroot sets first char of argv[0] to @. This is used
|
|
|
373056 |
- * by systemd to signal that the tast was launched from
|
|
|
373056 |
- * initrd/initramfs and should be preserved during shutdown
|
|
|
373056 |
- */
|
|
|
373056 |
case OffRootOpt:
|
|
|
373056 |
- argv[0][0] = '@';
|
|
|
373056 |
- __offroot = 1;
|
|
|
373056 |
+ /* Silently ignore old option */
|
|
|
373056 |
continue;
|
|
|
373056 |
|
|
|
373056 |
case Prefer:
|
|
|
373056 |
diff --git a/mdadm.h b/mdadm.h
|
|
|
373056 |
index be760d2..a761f29 100644
|
|
|
373056 |
--- a/mdadm.h
|
|
|
373056 |
+++ b/mdadm.h
|
|
|
373056 |
@@ -1487,5 +1487,3 @@ char *xstrdup(const char *str);
|
|
|
373056 |
* v1.x can support 1920
|
|
|
373056 |
*/
|
|
|
373056 |
#define MAX_DISKS 4096
|
|
|
373056 |
-
|
|
|
373056 |
-extern int __offroot;
|
|
|
373056 |
diff --git a/mdmon.8 b/mdmon.8
|
|
|
373056 |
index 598d904..559dd90 100644
|
|
|
373056 |
--- a/mdmon.8
|
|
|
373056 |
+++ b/mdmon.8
|
|
|
373056 |
@@ -5,7 +5,7 @@ mdmon \- monitor MD external metadata arrays
|
|
|
373056 |
|
|
|
373056 |
.SH SYNOPSIS
|
|
|
373056 |
|
|
|
373056 |
-.BI mdmon " [--all] [--takeover] [--offroot] CONTAINER"
|
|
|
373056 |
+.BI mdmon " [--all] [--takeover] CONTAINER"
|
|
|
373056 |
|
|
|
373056 |
.SH OVERVIEW
|
|
|
373056 |
The 2.6.27 kernel brings the ability to support external metadata arrays.
|
|
|
373056 |
@@ -166,15 +166,6 @@ containers with names longer than 5 characters, this argument can be
|
|
|
373056 |
arbitrarily extended, e.g. to
|
|
|
373056 |
.BR \-\-all-active-arrays .
|
|
|
373056 |
.TP
|
|
|
373056 |
-.BR \-\-offroot
|
|
|
373056 |
-Set first character of argv[0] to @ to indicate mdmon was launched
|
|
|
373056 |
-from initrd/initramfs and should not be shutdown by systemd as part of
|
|
|
373056 |
-the regular shutdown process. This option is normally only used by
|
|
|
373056 |
-the system's initscripts. Please see here for more details on how
|
|
|
373056 |
-systemd handled argv[0]:
|
|
|
373056 |
-.IP
|
|
|
373056 |
-.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
|
|
|
373056 |
-.PP
|
|
|
373056 |
|
|
|
373056 |
.PP
|
|
|
373056 |
Note that
|
|
|
373056 |
diff --git a/mdmon.c b/mdmon.c
|
|
|
373056 |
index 5d5ae94..8720aa5 100644
|
|
|
373056 |
--- a/mdmon.c
|
|
|
373056 |
+++ b/mdmon.c
|
|
|
373056 |
@@ -184,9 +184,6 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
|
|
|
373056 |
buf[sizeof(buf)-1] = 0;
|
|
|
373056 |
close(fd);
|
|
|
373056 |
|
|
|
373056 |
- /* Note that if started with --offroot, the name
|
|
|
373056 |
- * might be "@dmon"
|
|
|
373056 |
- */
|
|
|
373056 |
if (n < 0 || !(strstr(buf, "mdmon") ||
|
|
|
373056 |
strstr(buf, "@dmon")))
|
|
|
373056 |
return;
|
|
|
373056 |
@@ -276,10 +273,6 @@ void usage(void)
|
|
|
373056 |
" --help -h : This message\n"
|
|
|
373056 |
" --all : All devices\n"
|
|
|
373056 |
" --takeover -t : Takeover container\n"
|
|
|
373056 |
-" --offroot : Set first character of argv[0] to @ to indicate the\n"
|
|
|
373056 |
-" application was launched from initrd/initramfs and\n"
|
|
|
373056 |
-" should not be shutdown by systemd as part of the\n"
|
|
|
373056 |
-" regular shutdown process.\n"
|
|
|
373056 |
);
|
|
|
373056 |
exit(2);
|
|
|
373056 |
}
|
|
|
373056 |
@@ -303,6 +296,11 @@ int main(int argc, char *argv[])
|
|
|
373056 |
{NULL, 0, NULL, 0}
|
|
|
373056 |
};
|
|
|
373056 |
|
|
|
373056 |
+ /*
|
|
|
373056 |
+ * Always change process name to @dmon to avoid systemd killing it
|
|
|
373056 |
+ */
|
|
|
373056 |
+ argv[0][0] = '@';
|
|
|
373056 |
+
|
|
|
373056 |
while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
|
|
|
373056 |
switch (opt) {
|
|
|
373056 |
case 'a':
|
|
|
373056 |
@@ -313,7 +311,7 @@ int main(int argc, char *argv[])
|
|
|
373056 |
takeover = 1;
|
|
|
373056 |
break;
|
|
|
373056 |
case OffRootOpt:
|
|
|
373056 |
- argv[0][0] = '@';
|
|
|
373056 |
+ /* silently ignore old option */
|
|
|
373056 |
break;
|
|
|
373056 |
case 'h':
|
|
|
373056 |
default:
|
|
|
373056 |
diff --git a/util.c b/util.c
|
|
|
373056 |
index fc9043b..e75b754 100644
|
|
|
373056 |
--- a/util.c
|
|
|
373056 |
+++ b/util.c
|
|
|
373056 |
@@ -32,8 +32,6 @@
|
|
|
373056 |
#include <dirent.h>
|
|
|
373056 |
#include <signal.h>
|
|
|
373056 |
|
|
|
373056 |
-int __offroot;
|
|
|
373056 |
-
|
|
|
373056 |
/*
|
|
|
373056 |
* following taken from linux/blkpg.h because they aren't
|
|
|
373056 |
* anywhere else and it isn't safe to #include linux/ * stuff.
|
|
|
373056 |
@@ -1674,15 +1672,8 @@ int start_mdmon(int devnum)
|
|
|
373056 |
|
|
|
373056 |
for (i=0; paths[i]; i++)
|
|
|
373056 |
if (paths[i][0]) {
|
|
|
373056 |
- if (__offroot) {
|
|
|
373056 |
- execl(paths[i], "mdmon", "--offroot",
|
|
|
373056 |
- devnum2devname(devnum),
|
|
|
373056 |
- NULL);
|
|
|
373056 |
- } else {
|
|
|
373056 |
- execl(paths[i], "mdmon",
|
|
|
373056 |
- devnum2devname(devnum),
|
|
|
373056 |
- NULL);
|
|
|
373056 |
- }
|
|
|
373056 |
+ execl(paths[i], "mdmon",
|
|
|
373056 |
+ devnum2devname(devnum), NULL);
|
|
|
373056 |
}
|
|
|
373056 |
exit(1);
|
|
|
373056 |
case -1: fprintf(stderr, Name ": cannot run mdmon. "
|
|
|
373056 |
--
|
|
|
373056 |
1.7.11.7
|
|
|
373056 |
|