From nobody Sun Oct 13 21:00:29 2024 X-Original-To: dev-commits-src-all@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 4XRXnT5DRsz5YXTK; Sun, 13 Oct 2024 21:00:29 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XRXnT3Kx5z4bWX; Sun, 13 Oct 2024 21:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728853229; 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=SJv2MTGK9UFtbb7jtZ+1yGQKhVPIknAnv6ustbgq/Dw=; b=hzakKrm8bdorkOOGfseEX5u9FDnsnDDZ9NZoFZVDbNIo4rv6FdVBK9+3Sdh/hGxlzjrFQd BPTB8Eb70lKJsji4JMn3KwyfPq39EL4KeLtiUF2cih30h6zXFKp59qwg49XJtpWc8XJX1O 6T4vusxz+v2/zyN+puYbb1o6/kleJFZGR/A6GQ4QyqvWLMZserxb6f4/Aw1QJ7Eh5LlQ3Q XjXdyNlXEMXHu/oZfArja6s5tfccfnvDkzj+/fkPYgZMx9clv/tTgBrvj9hyq/YdmZx2mt UDY6sKDZ4B+K/9KtUeFcyjJBHT1ZvlnkfHJydoj+2U3/Y8RJxxKva8PyUMP7ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728853229; 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=SJv2MTGK9UFtbb7jtZ+1yGQKhVPIknAnv6ustbgq/Dw=; b=ZPDcR3Y3j6cynO8GvHcQo6IOrOzTMGk3qnmh3vZ3kyD30+L/yjKLGDyCFrQahU1PPvMnc2 42ReOrYbBNxhkfEi0S142rpEoTLMwFwvPeuLwR0XoWSxT2n0yyi0fH/O3IUKigHJYv4gBK KsRdMTw9LQI+lObf5J6pRT3Ga0efIckeCS4gGRH7ZtOZTCbdtPc72Ild6yg9EaYjuvl8LQ 1MpLs215/A4fGMv/bcXU/iW7hSwB7AsLWHhQoo/BPafClF7tBM+xwMCOY6tLzy1qtKSMh4 t/ZW9RhZKvvmRHTHupfs0wqLZvzSus5fSq6YeBjWBfAns4z5G2ghZ3JMVCzQjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728853229; a=rsa-sha256; cv=none; b=c9Vmc2jnROouoaTgMXF0Gtf58wOpFy+3SWkQgOnSstmZ66WfRt8O9RO5lKReb/aICcxcJZ dcxbJ7bVSbG+hx32vxCsgDAdDprTMwYX7pOPtIF8b/gfTdkEAdECLSoEBhWj82tzZQnVl9 oGlyZrYSzTScHvUq6JCn23eBCz7DHYuS9WJECQRUQtlpMnWku+yxPKw8XSvEkAJjSkop00 98vXELqkP5XggS2Ng71++ZMjh1u6jy+faJZ/3fFzZ1vwlRhw2PXHzP5BpnXgAyZSOKB55H ILG/uBxhIeBtwBQ74VHE/sW/bYXcb2eeVb0jcUTxXRsLYAqXO0TelPukwZhm+w== 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 4XRXnT2fdCz18DM; Sun, 13 Oct 2024 21:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49DL0Tk8086766; Sun, 13 Oct 2024 21:00:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49DL0T6A086763; Sun, 13 Oct 2024 21:00:29 GMT (envelope-from git) Date: Sun, 13 Oct 2024 21:00:29 GMT Message-Id: <202410132100.49DL0T6A086763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 6b0b026ae1a4 - stable/13 - nfsd.c: Synchronize error handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b0b026ae1a492736e955bda60a60d1b5aecea5d Auto-Submitted: auto-generated The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6b0b026ae1a492736e955bda60a60d1b5aecea5d commit 6b0b026ae1a492736e955bda60a60d1b5aecea5d Author: Joyu Liao AuthorDate: 2024-09-29 20:11:54 +0000 Commit: Rick Macklem CommitDate: 2024-10-13 20:58:47 +0000 nfsd.c: Synchronize error handling Synchronize the error handling in nfsd. If you check other error handlings in those same condition blocks, it uses nfsd_exit instead, which will call killchildren() and call the rpcbind service to do the service un-mapping. --- usr.sbin/nfsd/nfsd.c | 72 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c index be26e0be77e8..c1995580e142 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -558,18 +558,24 @@ main(int argc, char **argv) nfsd_exit(1); } nconf_udp = getnetconfigent("udp"); - if (nconf_udp == NULL) - err(1, "getnetconfigent udp failed"); + if (nconf_udp == NULL) { + syslog(LOG_ERR, "getnetconfigent udp failed"); + nfsd_exit(1); + } nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; if (nfs_minvers == NFS_VER2) if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp, - &nb_udp)) - err(1, "rpcb_set udp failed"); + &nb_udp)) { + syslog(LOG_ERR, "rpcb_set udp failed"); + nfsd_exit(1); + } if (nfs_minvers <= NFS_VER3) if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, - &nb_udp)) - err(1, "rpcb_set udp failed"); + &nb_udp)) { + syslog(LOG_ERR, "rpcb_set udp failed"); + nfsd_exit(1); + } freeaddrinfo(ai_udp); } } @@ -632,20 +638,26 @@ main(int argc, char **argv) nfsd_exit(1); } nconf_udp6 = getnetconfigent("udp6"); - if (nconf_udp6 == NULL) - err(1, "getnetconfigent udp6 failed"); + if (nconf_udp6 == NULL) { + syslog(LOG_ERR, "getnetconfigent udp6 failed"); + nfsd_exit(1); + } nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; if (nfs_minvers == NFS_VER2) if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, - &nb_udp6)) - err(1, + &nb_udp6)) { + syslog(LOG_ERR, "rpcb_set udp6 failed"); + nfsd_exit(1); + } if (nfs_minvers <= NFS_VER3) if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, - &nb_udp6)) - err(1, + &nb_udp6)) { + syslog(LOG_ERR, "rpcb_set udp6 failed"); + nfsd_exit(1); + } freeaddrinfo(ai_udp6); } } @@ -704,18 +716,24 @@ main(int argc, char **argv) nfsd_exit(1); } nconf_tcp = getnetconfigent("tcp"); - if (nconf_tcp == NULL) - err(1, "getnetconfigent tcp failed"); + if (nconf_tcp == NULL) { + syslog(LOG_ERR, "getnetconfigent tcp failed"); + nfsd_exit(1); + } nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; if (nfs_minvers == NFS_VER2) if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, - &nb_tcp)) - err(1, "rpcb_set tcp failed"); + &nb_tcp)) { + syslog(LOG_ERR, "rpcb_set tcp failed"); + nfsd_exit(1); + } if (nfs_minvers <= NFS_VER3) if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, - &nb_tcp)) - err(1, "rpcb_set tcp failed"); + &nb_tcp)) { + syslog(LOG_ERR, "rpcb_set tcp failed"); + nfsd_exit(1); + } freeaddrinfo(ai_tcp); } } @@ -782,18 +800,24 @@ main(int argc, char **argv) nfsd_exit(1); } nconf_tcp6 = getnetconfigent("tcp6"); - if (nconf_tcp6 == NULL) - err(1, "getnetconfigent tcp6 failed"); + if (nconf_tcp6 == NULL) { + syslog(LOG_ERR, "getnetconfigent tcp6 failed"); + nfsd_exit(1); + } nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; if (nfs_minvers == NFS_VER2) if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, - &nb_tcp6)) - err(1, "rpcb_set tcp6 failed"); + &nb_tcp6)) { + syslog(LOG_ERR, "rpcb_set tcp6 failed"); + nfsd_exit(1); + } if (nfs_minvers <= NFS_VER3) if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, - &nb_tcp6)) - err(1, "rpcb_set tcp6 failed"); + &nb_tcp6)) { + syslog(LOG_ERR, "rpcb_set tcp6 failed"); + nfsd_exit(1); + } freeaddrinfo(ai_tcp6); } }