mdmon: don't complain about notifying parent when there is no need

When run with --foreground mdmon has no need to notify any
parent, so it shouldn't even try, let alone complain when it fails.

Also close an end of a pipe which is no longer used.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2014-01-21 09:43:31 +11:00
parent 1ca5c8e0c7
commit 5e57245e3f
1 changed files with 7 additions and 4 deletions

11
mdmon.c
View File

@ -429,6 +429,7 @@ static int mdmon(char *devnm, int must_fork, int takeover)
wait(&status);
status = WEXITSTATUS(status);
}
close(pfd[0]);
return status;
}
} else
@ -516,10 +517,12 @@ static int mdmon(char *devnm, int must_fork, int takeover)
container->sock = make_control_sock(devnm);
status = 0;
if (write(pfd[1], &status, sizeof(status)) < 0)
pr_err("failed to notify our parent: %d\n",
getppid());
close(pfd[1]);
if (pfd[1] >= 0) {
if (write(pfd[1], &status, sizeof(status)) < 0)
pr_err("failed to notify our parent: %d\n",
getppid());
close(pfd[1]);
}
mlockall(MCL_CURRENT | MCL_FUTURE);