Skip to content

Commit 5e57245

Browse files
committed
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 <[email protected]>
1 parent 1ca5c8e commit 5e57245

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mdmon.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ static int mdmon(char *devnm, int must_fork, int takeover)
429429
wait(&status);
430430
status = WEXITSTATUS(status);
431431
}
432+
close(pfd[0]);
432433
return status;
433434
}
434435
} else
@@ -516,10 +517,12 @@ static int mdmon(char *devnm, int must_fork, int takeover)
516517
container->sock = make_control_sock(devnm);
517518

518519
status = 0;
519-
if (write(pfd[1], &status, sizeof(status)) < 0)
520-
pr_err("failed to notify our parent: %d\n",
521-
getppid());
522-
close(pfd[1]);
520+
if (pfd[1] >= 0) {
521+
if (write(pfd[1], &status, sizeof(status)) < 0)
522+
pr_err("failed to notify our parent: %d\n",
523+
getppid());
524+
close(pfd[1]);
525+
}
523526

524527
mlockall(MCL_CURRENT | MCL_FUTURE);
525528

0 commit comments

Comments
 (0)