From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:09:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 141811065686; Tue, 26 May 2009 01:09:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCB4F8FC1F; Tue, 26 May 2009 01:09:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q19XQa041835; Tue, 26 May 2009 01:09:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q19Xl0041834; Tue, 26 May 2009 01:09:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260109.n4Q19Xl0041834@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192780 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 01:09:34 -0000 Author: rmacklem Date: Tue May 26 01:09:33 2009 New Revision: 192780 URL: http://svn.freebsd.org/changeset/base/192780 Log: Fix the experimental nfs server's interface to the new krpc so that it handles the case of a non-exported NFSv4 root correctly. Also, delete handling for the case where nd_repstat is already set in nfs_proc(), since that no longer happens. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 00:23:03 2009 (r192779) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 01:09:33 2009 (r192780) @@ -210,8 +210,15 @@ nfssvc_program(struct svc_req *rqst, SVC #ifdef MAC mac_cred_associate_nfsd(nd.nd_cred); #endif - if ((nd.nd_flag & ND_NFSV4)) + if ((nd.nd_flag & ND_NFSV4) != 0) { nd.nd_repstat = nfsvno_v4rootexport(&nd); + if (nd.nd_repstat != 0) { + svcerr_weakauth(rqst); + svc_freereq(rqst); + m_freem(nd.nd_mrep); + return; + } + } cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, xprt->xp_sockref, &rp); @@ -272,22 +279,17 @@ nfs_proc(struct nfsrv_descript *nd, u_in NFSGETTIME(&nd->nd_starttime); /* - * Several cases: + * Two cases: * 1 - For NFSv2 over UDP, if we are near our malloc/mget * limit, just drop the request. There is no * NFSERR_RESOURCE or NFSERR_DELAY for NFSv2 and the * client will timeout/retry over UDP in a little while. - * 2 - nd_repstat set to some error, so generate the reply now. - * 3 - nd_repstat == 0 && nd_mreq == NULL, which + * 2 - nd_repstat == 0 && nd_mreq == NULL, which * means a normal nfs rpc, so check the cache */ if ((nd->nd_flag & ND_NFSV2) && nd->nd_nam2 != NULL && nfsrv_mallocmget_limit()) { cacherep = RC_DROPIT; - } else if (nd->nd_repstat) { - cacherep = RC_REPLY; - if ((nd->nd_flag & ND_NFSV4) == 0) - panic("nfs_repstat for nfsv2,3"); } else { /* * For NFSv3, play it safe and assume that the client is @@ -315,9 +317,6 @@ nfs_proc(struct nfsrv_descript *nd, u_in else cacherep = RC_REPLY; *rpp = nfsrvd_updatecache(nd, so); - } else if (cacherep == RC_REPLY) { - /* Generate the error reply message for NFSv4 */ - nfsrvd_dorpc(nd, isdgram, td); } return (cacherep); }