From owner-svn-src-head@freebsd.org Tue Sep 3 14:06:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28809DC591; Tue, 3 Sep 2019 14:06:14 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7z90ymkz4PKj; Tue, 3 Sep 2019 14:06:13 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id F19CC1A336; Tue, 3 Sep 2019 14:06:01 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 68C791DFC6; Thu, 4 Apr 2019 23:30:31 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36F306B001; Thu, 4 Apr 2019 23:30:31 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1D03D1DFC4; Thu, 4 Apr 2019 23:30:31 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id C021D1DFC0 for ; Thu, 4 Apr 2019 23:30:28 +0000 (UTC) (envelope-from rmacklem@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89AF76AFFD; Thu, 4 Apr 2019 23:30:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26DFB4B01; Thu, 4 Apr 2019 23:30:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x34NUSPv024210; Thu, 4 Apr 2019 23:30:28 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x34NURAA024207; Thu, 4 Apr 2019 23:30:27 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201904042330.x34NURAA024207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345895 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 345895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 36F306B001 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:21 -0000 X-Original-Date: Thu, 4 Apr 2019 23:30:27 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:06:21 -0000 Author: rmacklem Date: Thu Apr 4 23:30:27 2019 New Revision: 345895 URL: https://svnweb.freebsd.org/changeset/base/345895 Log: Revert r320698, since the related userland changes were reverted by r338192. r338192 reverted the changes to nfsuserd so that it could use an AF_LOCAL socket, since it resulted in a vnode locking panic(). Post r338192 nfsuserd daemons use the old AF_INET socket for upcalls and do not use these kernel changes. I left them in for a while, so that nfsuserd daemons built from head sources between r320757 (Jul. 6, 2017) and r338192 (Aug. 22, 2018) would need them by default. This only affects head, since the changes were never MFC'd. I will add an UPDATING entry, since an nfsuserd daemon built from head sources between r320757 and r338192 will not run unless the "-use-udpsock" option is specified. (This command line option is only in the affected revisions of the nfsuserd daemon.) I suspect few will be affected by this, since most who run systems built from head sources (not stable or releases) will have rebuilt their nfsuserd daemon from sources post r338192 (Aug. 22, 2018) This is being reverted in preparation for an update to include AF_INET6 support to the code. Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Thu Apr 4 23:16:36 2019 (r345894) +++ head/sys/fs/nfs/nfs_commonkrpc.c Thu Apr 4 23:30:27 2019 (r345895) @@ -208,8 +208,6 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq nconf = getnetconfigent("udp"); else nconf = getnetconfigent("tcp"); - else if (saddr->sa_family == AF_LOCAL) - nconf = getnetconfigent("local"); else if (nrp->nr_sotype == SOCK_DGRAM) nconf = getnetconfigent("udp6"); Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Thu Apr 4 23:16:36 2019 (r345894) +++ head/sys/fs/nfs/nfs_commonport.c Thu Apr 4 23:30:27 2019 (r345895) @@ -631,30 +631,14 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, goto out; } else if (uap->flag & NFSSVC_NFSUSERDPORT) { u_short sockport; - struct sockaddr *sad; - struct sockaddr_un *sun; - if ((uap->flag & NFSSVC_NEWSTRUCT) != 0) { - /* New nfsuserd using an AF_LOCAL socket. */ - sun = malloc(sizeof(struct sockaddr_un), M_SONAME, - M_WAITOK | M_ZERO); - error = copyinstr(uap->argp, sun->sun_path, - sizeof(sun->sun_path), NULL); - if (error != 0) { - free(sun, M_SONAME); - return (error); - } - sun->sun_family = AF_LOCAL; - sun->sun_len = SUN_LEN(sun); - sockport = 0; - sad = (struct sockaddr *)sun; - } else { + if ((uap->flag & NFSSVC_NEWSTRUCT) == 0) error = copyin(uap->argp, (caddr_t)&sockport, sizeof (u_short)); - sad = NULL; - } - if (error == 0) - error = nfsrv_nfsuserdport(sad, sockport, p); + else + error = ENXIO; + if (!error) + error = nfsrv_nfsuserdport(sockport, p); } else if (uap->flag & NFSSVC_NFSUSERDDELPORT) { nfsrv_nfsuserddelport(); error = 0; Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Apr 4 23:16:36 2019 (r345894) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Apr 4 23:30:27 2019 (r345895) @@ -3504,7 +3504,7 @@ nfsrv_cmpmixedcase(u_char *cp, u_char *cp2, int len) * Set the port for the nfsuserd. */ APPLESTATIC int -nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, NFSPROC_T *p) +nfsrv_nfsuserdport(u_short port, NFSPROC_T *p) { struct nfssockreq *rp; struct sockaddr_in *ad; @@ -3514,7 +3514,6 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, if (nfsrv_nfsuserd) { NFSUNLOCKNAMEID(); error = EPERM; - free(sad, M_SONAME); goto out; } nfsrv_nfsuserd = 1; @@ -3524,25 +3523,16 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, */ rp = &nfsrv_nfsuserdsock; rp->nr_client = NULL; - rp->nr_cred = NULL; + rp->nr_sotype = SOCK_DGRAM; + rp->nr_soproto = IPPROTO_UDP; rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST); - if (sad != NULL) { - /* Use the AF_LOCAL socket address passed in. */ - rp->nr_sotype = SOCK_STREAM; - rp->nr_soproto = 0; - rp->nr_nam = sad; - } else { - /* Use the port# for a UDP socket (old nfsuserd). */ - rp->nr_sotype = SOCK_DGRAM; - rp->nr_soproto = IPPROTO_UDP; - rp->nr_nam = malloc(sizeof(*rp->nr_nam), M_SONAME, M_WAITOK | - M_ZERO); - NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in)); - ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *); - ad->sin_family = AF_INET; - ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001); - ad->sin_port = port; - } + rp->nr_cred = NULL; + rp->nr_nam = malloc(sizeof(*rp->nr_nam), M_SONAME, M_WAITOK | M_ZERO); + NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in)); + ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *); + ad->sin_family = AF_INET; + ad->sin_addr.s_addr = htonl((u_int32_t)0x7f000001); /* 127.0.0.1 */ + ad->sin_port = port; rp->nr_prog = RPCPROG_NFSUSERD; rp->nr_vers = RPCNFSUSERD_VERS; error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0); Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu Apr 4 23:16:36 2019 (r345894) +++ head/sys/fs/nfs/nfs_var.h Thu Apr 4 23:30:27 2019 (r345895) @@ -136,7 +136,7 @@ int nfsrv_checksetattr(vnode_t, struct nfsrv_descript NFSPROC_T *); int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *, NFSPROC_T *); -int nfsrv_nfsuserdport(struct sockaddr *, u_short, NFSPROC_T *); +int nfsrv_nfsuserdport(u_short, NFSPROC_T *); void nfsrv_nfsuserddelport(void); void nfsrv_throwawayallstate(NFSPROC_T *); int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,