9eca190d93
array assembled- particularly at boot (bnc#793954) - boot.md: make sure systemd-udev-trigger runs before boot.md to avoid races: bnc#793954 - mdmon@.service - new file plus patches to allow mdmon to be started by systemd, so it doesn't kill it (bnc#321366) OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=85
95 lines
2.6 KiB
Diff
95 lines
2.6 KiB
Diff
References: bnc#821366
|
|
Git-commit: 030419821fb77f9955f2017b4a6d3d8139d6db25
|
|
From: NeilBrown <neilb@suse.de>
|
|
Date: Tue, 5 Feb 2013 15:57:09 +1100
|
|
Subject: [PATCH] mdmon: add --foreground option
|
|
|
|
While not strictly necessary for systemd, it is cleaner to avoid
|
|
forking when running from a management daemon. So add a --foreground
|
|
option to mdmon.
|
|
|
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
---
|
|
mdmon.8 | 10 +++++++++-
|
|
mdmon.c | 9 +++++++--
|
|
systemd/mdmon@.service | 2 +-
|
|
3 files changed, 17 insertions(+), 4 deletions(-)
|
|
|
|
--- mdadm-3.2.6.orig/mdmon.8
|
|
+++ mdadm-3.2.6/mdmon.8
|
|
@@ -5,7 +5,7 @@ mdmon \- monitor MD external metadata ar
|
|
|
|
.SH SYNOPSIS
|
|
|
|
-.BI mdmon " [--all] [--takeover] [--offroot] CONTAINER"
|
|
+.BI mdmon " [--all] [--takeover] [--offroot] [--foreground] CONTAINER"
|
|
|
|
.SH OVERVIEW
|
|
The 2.6.27 kernel brings the ability to support external metadata arrays.
|
|
@@ -131,6 +131,14 @@ The
|
|
device to monitor. It can be a full path like /dev/md/container, or a
|
|
simple md device name like md127.
|
|
.TP
|
|
+.B \-\-foreground
|
|
+Normally,
|
|
+.I mdmon
|
|
+will fork and continue in the background. Adding this option will
|
|
+skip that step and run
|
|
+.I mdmon
|
|
+in the foreground.
|
|
+.TP
|
|
.B \-\-takeover
|
|
This instructs
|
|
.I mdmon
|
|
--- mdadm-3.2.6.orig/mdmon.c
|
|
+++ mdadm-3.2.6/mdmon.c
|
|
@@ -295,15 +295,17 @@ int main(int argc, char *argv[])
|
|
int opt;
|
|
int all = 0;
|
|
int takeover = 0;
|
|
+ int dofork = 1;
|
|
static struct option options[] = {
|
|
{"all", 0, NULL, 'a'},
|
|
{"takeover", 0, NULL, 't'},
|
|
{"help", 0, NULL, 'h'},
|
|
{"offroot", 0, NULL, OffRootOpt},
|
|
+ {"foreground", 0, NULL, 'F'},
|
|
{NULL, 0, NULL, 0}
|
|
};
|
|
|
|
- while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
|
|
+ while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) {
|
|
switch (opt) {
|
|
case 'a':
|
|
container_name = argv[optind-1];
|
|
@@ -312,6 +314,9 @@ int main(int argc, char *argv[])
|
|
case 't':
|
|
takeover = 1;
|
|
break;
|
|
+ case 'F':
|
|
+ dofork = 0;
|
|
+ break;
|
|
case OffRootOpt:
|
|
argv[0][0] = '@';
|
|
break;
|
|
@@ -383,7 +388,7 @@ int main(int argc, char *argv[])
|
|
container_name);
|
|
exit(1);
|
|
}
|
|
- return mdmon(devname, devnum, do_fork(), takeover);
|
|
+ return mdmon(devname, devnum, dofork && do_fork(), takeover);
|
|
}
|
|
|
|
static int mdmon(char *devname, int devnum, int must_fork, int takeover)
|
|
--- mdadm-3.2.6.orig/systemd/mdmon@.service
|
|
+++ mdadm-3.2.6/systemd/mdmon@.service
|
|
@@ -11,7 +11,7 @@ DefaultDependencies=no
|
|
Before=initrd-switch-root.target
|
|
|
|
[Service]
|
|
-ExecStart=/sbin/mdmon %I
|
|
+ExecStart=/sbin/mdmon --foreground %I
|
|
StandardInput=null
|
|
StandardOutput=null
|
|
StandardError=null
|