From nobody Sat Apr 09 16:02:15 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D582B1A88CD2; Sat, 9 Apr 2022 16:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KbKd35JYSz54kc; Sat, 9 Apr 2022 16:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649520135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mWCmMBavQBO5usaENOcTTLnowJ6775PZpaNKn4ObnEM=; b=p3Owf2fTd40LvrsvOYRRc+OIXNwvR7eqXHQ16PBFKGfBqYdTpDhD1eBdByQBRe2PZKeXMJ v64a1XkBT+/4zq8ExkJQSoy4bWtAKojygU7taLsSzCh0aNwUpNFDNtp32FzY2VOYKO4heP bwELSIuiz5WmnN51EuDWdn9QQpMv4xelqEBr30h+y5FQgbsU6DdtPnduX5r5RKI1tBjlmQ vB+ys26TxrT1SDj/VBdsyagZ+M4D7usCeNPt1R71D+FRi2BPcxC7HZrMTl5KnYrMWNFfwu mx/POTvj4hYlUkodCteDTSya4AlPVhVwoGwN3xRANzZJY8HhWvVoinNHKX9zHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95A7F1CDAA; Sat, 9 Apr 2022 16:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 239G2FZS032967; Sat, 9 Apr 2022 16:02:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 239G2FlT032966; Sat, 9 Apr 2022 16:02:15 GMT (envelope-from git) Date: Sat, 9 Apr 2022 16:02:15 GMT Message-Id: <202204091602.239G2FlT032966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a3214fbe7fff - main - mount: use pidfile_signal List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3214fbe7fff8b4914f12e187dcc972e52db548d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649520135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mWCmMBavQBO5usaENOcTTLnowJ6775PZpaNKn4ObnEM=; b=dARVD7JB0HU6Uva9LFok86u1hgY9SCykCBGnw/WzJ5if+tRNbOiFJ+V/WE23kdqiJFjnKW BF+F9EefJy8VevxE7RKM1ZdCjYr2avNy2NBssroLVLburiPqTut0tS/W3bHb8wTqcuA8G2 Elm58k5yehSwyYtM6KWfcR2gaWhBxDarbSbqx47AfEAm/vJgfrYtEgM2/PyfNETG+eh/Om CcOGOezH7nX3yaHgJsLQi/Rjb0MZYUxuCucx6KW04PIG9shSCC7m6JsorkMJqhcQo5oQYk ddhU1LdmNRdd+N0sE9aFp9DIUute2GmLkVQ/SLEKle/W/Pzj4CeaObn2rGZw0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649520135; a=rsa-sha256; cv=none; b=NQYGxnA57SjboZJc4jbMff7baiNPrUx0wCMxfb6cQnL5GWX1cPAc18ehT+yfZop+640AHH CGbmXBPUDW9G0rXHi9yRX+SZkl5P7vS4sh6ROsGGZXUdl8OAI30ogPus0iacV1tN5dcJJd ojCxJQEN4eX4DcOJzCSiKiu9cZ2llVJsgDivSWozjKvZTeO46+WdFYFqQtog/nN5KsBDs0 nrLLNUayrW8tz1Y2LUCOiCsZ/Z7vzTSCFoE2gnAJIfwQzYwt69ytFHDZF4NBRY1PpBcBlK qhnGLRC87mKUDLKETfDcfPGAZFSPAOL+jKQcZ6yvVhN8DJclheMBb7jo3ArI8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a3214fbe7fff8b4914f12e187dcc972e52db548d commit a3214fbe7fff8b4914f12e187dcc972e52db548d Author: Mateusz Guzik AuthorDate: 2022-03-11 11:02:28 +0000 Commit: Mateusz Guzik 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