summaryrefslogtreecommitdiff
path: root/mdmon.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-08-01 15:59:24 +1000
committerNeilBrown <neilb@suse.de>2013-08-01 15:59:24 +1000
commita9c15847579ce3ac210b2dcc41e2af6c5f8bd65c (patch)
tree53e93dfc5cf25eafcda33ac609187500df617328 /mdmon.c
parent2ef219630b7e1baa72fce420b6bc41cf8071c5e8 (diff)
mdmon: don't lie to systemd.
Now that mdmon responds fairly well to SIGTERM, stop lying to systemd about being started on the initrd. Note that if mdmon is rerun (--takeover) for some reason, and systemd chooses to kill processes before remounting / readonly, then the unmount will hang. If systemd ever lets us tell it that we don't want to be killed until root is readonly, then we should do that. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdmon.c')
-rw-r--r--mdmon.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mdmon.c b/mdmon.c
index 13f95109..f0b06237 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -298,10 +298,14 @@ int main(int argc, char *argv[])
{NULL, 0, NULL, 0}
};
- /*
- * Always change process name to @dmon to avoid systemd killing it
- */
- argv[0][0] = '@';
+ if (in_initrd()) {
+ /*
+ * set first char of argv[0] to @. This is used by
+ * systemd to signal that the task was launched from
+ * initrd/initramfs and should be preserved during shutdown
+ */
+ argv[0][0] = '@';
+ }
while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) {
switch (opt) {