git: a3214fbe7fff - main - mount: use pidfile_signal
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Apr 2022 16:02:15 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a3214fbe7fff8b4914f12e187dcc972e52db548d commit a3214fbe7fff8b4914f12e187dcc972e52db548d Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-03-11 11:02:28 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-04-09 15:59:43 +0000 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 --- sbin/mount/mount.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index cbb2a8784e26..79d9d6cb0caf 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -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