From nobody Sun Sep 29 20:14:08 2024 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 4XGwQS72JKz5X8hB; Sun, 29 Sep 2024 20:14:08 +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 4XGwQS6TX0z4Pvg; Sun, 29 Sep 2024 20:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727640848; 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=5UWlxzDQwK/91B4wbSvDKH1V9NmCUiL5YOEmDnVQdBA=; b=eaW/ZBV5LbYPgAIJUjT2xxWpgGMbUKN5R49idoz5FrBVq/Ru1BnhDbg1rNJAhehkv26BBF dpNFrzT7SK9NQ32NS6XygQtqgU0subTczA2rfDWJ+kUvYcUXDgxhPvgKaCOQdc/N5KGmJD VLiuNmvJ4Y8IAWBfaQi2gnfIIUXpCBviNVcFynNJQ0MhbA+zfDi/SiW3up0CviRJsG5CHE uY/oaRnhm6F3b0KCkXV6JG7LGHPIQTorfixR+1kTy8A1oDYUwJCq7rp8mMSuGU5L+lRZRC jXxjLkqrYj4FmTMQgG2VvqyP98vLT8x5p/9m+UCsVq9DkCTnPlQJdn5tfyZUbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727640848; 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=5UWlxzDQwK/91B4wbSvDKH1V9NmCUiL5YOEmDnVQdBA=; b=Df1MHUZS/sBZB5qoi2UaPhP7u7lZdo6NfZ06LGo3cPFBXc6a4oZRusLW4Y7n2CH1axS6D5 XxPyGDIiPd85pLNNuz2IRGlgUBx+ceyTwZAx6WDBAiOyl9g38iy9p3DWKNhIbc2uwqfyba jrV/8um0rq8KTEzdPnVjT+0gNZ7oPwIPP+xbmNLjr37JDQbKudCJ94WYFqUy/Cd7npD3bV QNOcVKDrJvL6CcZ246334r9buGySPpwxwhzUB8n49yBNHP4ZgE2TJHpCvoI29lSZ5MaD0S 4pCoQm72tlCnI3umL+G7AHTwdhka/seyFJkqVfWMiro9iLixxcsXcVAyKoHM5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727640848; a=rsa-sha256; cv=none; b=Z0zaCA0tOVNDqMqg/1q14V09LMb1MrnpD6/nBRdt0Pw7XwFomOZnsf5JmYGQtKHr0swU1c QjaPN4cxeMX0uy3Km/eG+N1i4iRd1VqVK664izgdctYtRnIlmWb+CsXFNn3/4aMHnu+KJJ q7rTLT3TBwx4209Moo4aUTt11q+qkT8xRds/cl5jac7f5wsGjl/sB50Yf3lBxKawGfRFRx 4wyb8LYnXpjJGelVueVEu5fggSpV7cptbuviPH2Im7NH8tYhL65dCE7H+2pOKnURWHgK4b FPEi1XMQCXwBhlSQm/NXSHDcPPr23xLlvj+9AdUv8pzrivgPtAVU+TBvgbNtdg== 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 4XGwQS64hMzNVw; Sun, 29 Sep 2024 20:14:08 +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 48TKE8ve021783; Sun, 29 Sep 2024 20:14:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48TKE8Pf021780; Sun, 29 Sep 2024 20:14:08 GMT (envelope-from git) Date: Sun, 29 Sep 2024 20:14:08 GMT Message-Id: <202409292014.48TKE8Pf021780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: f321956d9806 - main - nfsd.c: Synchronize error handling 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f321956d9806bf0c171b9097a25b294c1498c9de Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f321956d9806bf0c171b9097a25b294c1498c9de commit f321956d9806bf0c171b9097a25b294c1498c9de Author: Joyu Liao AuthorDate: 2024-09-29 20:11:54 +0000 Commit: Rick Macklem CommitDate: 2024-09-29 20:11:54 +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. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46442 --- 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 b6c60ce72834..f1f04af192da 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -550,18 +550,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); } } @@ -624,20 +630,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); } } @@ -696,18 +708,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); } } @@ -774,18 +792,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); } }