mount: use pidfile_signal

This fixes a performance problem where poudriere -j 104 keeps remounting
filesystems, which induce wanting to signal mountd, if running. The
current code tries to do it by creating the pidfile in /var/run and
unlinking it if the operation succeeds, inducing contention against
anything doing an exec as it tries to look up /var/run/ld-elf.so.hints

Differential Revision:	https://reviews.freebsd.org/D34681
This commit is contained in:
Mateusz Guzik 2022-03-11 11:02:28 +00:00
parent 287451fd01
commit a3214fbe7f

View file

@ -207,33 +207,8 @@ specified_ro(const char *arg)
static void
restart_mountd(void)
{
struct pidfh *pfh;
pid_t mountdpid;
mountdpid = 0;
pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
if (pfh != NULL) {
/* Mountd is not running. */
pidfile_remove(pfh);
return;
}
if (errno != EEXIST) {
/* Cannot open pidfile for some reason. */
return;
}
/*
* Refuse to send broadcast or group signals, this has
* happened due to the bugs in pidfile(3).
*/
if (mountdpid <= 0) {
xo_warnx("mountd pid %d, refusing to send SIGHUP", mountdpid);
return;
}
/* We have mountd(8) PID in mountdpid varible, let's signal it. */
if (kill(mountdpid, SIGHUP) == -1)
xo_err(1, "signal mountd");
pidfile_signal(_PATH_MOUNTDPID, SIGHUP, NULL);
}
int