summaryrefslogtreecommitdiffstats
path: root/managemon.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-10-13 17:41:57 -0700
committerDan Williams <dan.j.williams@intel.com>2009-10-13 17:41:57 -0700
commit96a8270d46faab599b41f1cf78b4331b44c5a6be (patch)
treef41146da4aaff8df940634b0706ef7f972cd0eb3 /managemon.c
parentaae5a11207cf6da1682e6a76e116a19e21473f03 (diff)
downloadmdadm-96a8270d46faab599b41f1cf78b4331b44c5a6be.tar.gz
mdadm-96a8270d46faab599b41f1cf78b4331b44c5a6be.tar.xz
mdadm-96a8270d46faab599b41f1cf78b4331b44c5a6be.zip
mdmon: avoid writes in the startup path for mdmon on root arrays
When killing a previous monitor be careful not to cause writes to the filesystem until the reads necessary to get the monitor operational have completed. The code is already prepared for errors creating the pid and socket files, so simply defer creation of these files until after the first call to manage(). Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'managemon.c')
-rw-r--r--managemon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/managemon.c b/managemon.c
index f9d545d..5958e18 100644
--- a/managemon.c
+++ b/managemon.c
@@ -680,6 +680,12 @@ void do_manager(struct supertype *container)
read_sock(container);
if (container->sock < 0 || socket_hup_requested) {
+ /* If this fails, we hope it already exists
+ * pid file lives in /var/run/mdadm/mdXX.pid
+ */
+ mkdir("/var", 0600);
+ mkdir("/var/run", 0600);
+ mkdir("/var/run/mdadm", 0600);
close(container->sock);
container->sock = make_control_sock(container->devname);
make_pidfile(container->devname, 0);