Date: Tue, 30 Jun 2009 19:03:27 +0000 (UTC) From: Doug Rabson <dfr@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r195202 - in head/sys: conf i386/i386 modules/nfsclient modules/nfsserver nfs nfsclient nfsserver Message-ID: <200906301903.n5UJ3RrE089516@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dfr Date: Tue Jun 30 19:03:27 2009 New Revision: 195202 URL: http://svn.freebsd.org/changeset/base/195202 Log: Remove the old kernel RPC implementation and the NFS_LEGACYRPC option. Approved by: re Deleted: head/sys/nfs/rpcv2.h head/sys/nfsclient/nfs_socket.c head/sys/nfsserver/nfs_srvcache.c head/sys/nfsserver/nfs_srvsock.c head/sys/nfsserver/nfs_syscalls.c Modified: head/sys/conf/files head/sys/conf/options head/sys/i386/i386/genassym.c head/sys/modules/nfsclient/Makefile head/sys/modules/nfsserver/Makefile head/sys/nfs/nfs_common.c head/sys/nfsclient/bootp_subr.c head/sys/nfsclient/krpc_subr.c head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_diskless.c head/sys/nfsclient/nfs_krpc.c head/sys/nfsclient/nfs_lock.c head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfs_node.c head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsclient/nfsm_subs.h head/sys/nfsclient/nfsmount.h head/sys/nfsserver/nfs.h head/sys/nfsserver/nfs_fha.c head/sys/nfsserver/nfs_serv.c head/sys/nfsserver/nfs_srvkrpc.c head/sys/nfsserver/nfs_srvsubs.c head/sys/nfsserver/nfsrvcache.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/conf/files Tue Jun 30 19:03:27 2009 (r195202) @@ -2490,7 +2490,6 @@ nfsclient/krpc_subr.c optional bootp nf nfsclient/nfs_bio.c optional nfsclient nfsclient/nfs_diskless.c optional nfsclient nfs_root nfsclient/nfs_node.c optional nfsclient -nfsclient/nfs_socket.c optional nfsclient nfsclient/nfs_krpc.c optional nfsclient nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient @@ -2500,10 +2499,7 @@ nfsclient/nfs_lock.c optional nfsclient nfsserver/nfs_fha.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver -nfsserver/nfs_srvsock.c optional nfsserver -nfsserver/nfs_srvcache.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver -nfsserver/nfs_syscalls.c optional nfsserver nfs/nfs_nfssvc.c optional nfsserver | nfscl | nfsd nlm/nlm_advlock.c optional nfslockd nfsclient | nfsd nfsclient nlm/nlm_prot_clnt.c optional nfslockd | nfsd Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/conf/options Tue Jun 30 19:03:27 2009 (r195202) @@ -228,11 +228,6 @@ KGSSAPI_DEBUG opt_kgssapi.h NFSCLIENT opt_nfs.h NFSSERVER opt_nfs.h -# Use this option to compile both NFS client and server using the -# legacy RPC implementation instead of the newer KRPC system (which -# supports modern features such as RPCSEC_GSS -NFS_LEGACYRPC opt_nfs.h - # Use these options to compile the experimental nfs client and/or # server that supports NFSv4 into a kernel. # NFSCL - client Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/i386/i386/genassym.c Tue Jun 30 19:03:27 2009 (r195202) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <netinet/in.h> #include <nfs/nfsproto.h> -#include <nfs/rpcv2.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsdiskless.h> #ifdef DEV_APIC Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/modules/nfsclient/Makefile Tue Jun 30 19:03:27 2009 (r195202) @@ -4,7 +4,7 @@ KMOD= nfsclient SRCS= vnode_if.h \ - nfs_bio.c nfs_lock.c nfs_node.c nfs_socket.c nfs_subs.c nfs_nfsiod.c \ + nfs_bio.c nfs_lock.c nfs_node.c nfs_subs.c nfs_nfsiod.c \ nfs_vfsops.c nfs_vnops.c nfs_common.c nfs_krpc.c \ opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h Modified: head/sys/modules/nfsserver/Makefile ============================================================================== --- head/sys/modules/nfsserver/Makefile Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/modules/nfsserver/Makefile Tue Jun 30 19:03:27 2009 (r195202) @@ -3,8 +3,8 @@ .PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs KMOD= nfsserver SRCS= vnode_if.h \ - nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsock.c nfs_srvcache.c \ - nfs_srvsubs.c nfs_syscalls.c nfs_common.c \ + nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c nfs_common.c \ + opt_mac.h \ opt_kgssapi.h \ opt_nfs.h SRCS+= opt_inet6.h Modified: head/sys/nfs/nfs_common.c ============================================================================== --- head/sys/nfs/nfs_common.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfs/nfs_common.c Tue Jun 30 19:03:27 2009 (r195202) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_extern.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsserver/nfs.h> #include <nfs/xdr_subs.h> Modified: head/sys/nfsclient/bootp_subr.c ============================================================================== --- head/sys/nfsclient/bootp_subr.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/bootp_subr.c Tue Jun 30 19:03:27 2009 (r195202) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include <net/if_dl.h> #include <net/vnet.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsdiskless.h> @@ -1776,6 +1775,13 @@ md_mount(struct sockaddr_in *mdsin, char int authcount; int authver; +#define RPCPROG_MNT 100005 +#define RPCMNT_VER1 1 +#define RPCMNT_VER3 3 +#define RPCMNT_MOUNT 1 +#define AUTH_SYS 1 /* unix style (uid, gids) */ +#define AUTH_UNIX AUTH_SYS + /* XXX honor v2/v3 flags in args->flags? */ #ifdef BOOTP_NFSV3 /* First try NFS v3 */ @@ -1836,7 +1842,7 @@ md_mount(struct sockaddr_in *mdsin, char while (authcount > 0) { if (xdr_int_decode(&m, &authver) != 0) goto bad; - if (authver == RPCAUTH_UNIX) + if (authver == AUTH_UNIX) authunixok = 1; authcount--; } Modified: head/sys/nfsclient/krpc_subr.c ============================================================================== --- head/sys/nfsclient/krpc_subr.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/krpc_subr.c Tue Jun 30 19:03:27 2009 (r195202) @@ -57,7 +57,9 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <netinet/in.h> -#include <nfs/rpcv2.h> +#include <rpc/types.h> +#include <rpc/auth.h> +#include <rpc/rpc_msg.h> #include <nfsclient/krpc.h> #include <nfs/xdr_subs.h> @@ -284,7 +286,7 @@ krpc_call(struct sockaddr_in *sa, u_int call->rp_vers = txdr_unsigned(vers); call->rp_proc = txdr_unsigned(func); /* rpc_auth part (auth_unix as root) */ - call->rpc_auth.authtype = txdr_unsigned(RPCAUTH_UNIX); + call->rpc_auth.authtype = txdr_unsigned(AUTH_UNIX); call->rpc_auth.authlen = txdr_unsigned(sizeof(struct auth_unix)); /* rpc_verf part (auth_null) */ call->rpc_verf.authtype = 0; @@ -359,7 +361,7 @@ krpc_call(struct sockaddr_in *sa, u_int reply = mtod(m, struct krpc_reply *); /* Is it the right reply? */ - if (reply->rp_direction != txdr_unsigned(RPC_REPLY)) + if (reply->rp_direction != txdr_unsigned(REPLY)) continue; if (reply->rp_xid != txdr_unsigned(xid)) @@ -375,7 +377,7 @@ krpc_call(struct sockaddr_in *sa, u_int /* Did the call succeed? */ if (reply->rp_status != 0) { error = fxdr_unsigned(u_int32_t, reply->rp_status); - if (error == RPC_PROGMISMATCH) { + if (error == PROG_MISMATCH) { error = EBADRPC; goto out; } Modified: head/sys/nfsclient/nfs.h ============================================================================== --- head/sys/nfsclient/nfs.h Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs.h Tue Jun 30 19:03:27 2009 (r195202) @@ -123,9 +123,6 @@ MALLOC_DECLARE(M_NFSDIRECTIO); extern struct uma_zone *nfsmount_zone; -#ifdef NFS_LEGACYRPC -extern struct callout nfs_callout; -#endif extern struct nfsstats nfsstats; extern struct mtx nfs_iod_mtx; @@ -150,49 +147,6 @@ extern int nfsv3_procid[NFS_NPROCS]; (e) != ERESTART && (e) != EWOULDBLOCK && \ ((s) & PR_CONNREQUIRED) == 0) -#ifdef NFS_LEGACYRPC - -/* - * Nfs outstanding request list element - */ -struct nfsreq { - TAILQ_ENTRY(nfsreq) r_chain; - struct mbuf *r_mreq; - struct mbuf *r_mrep; - struct mbuf *r_md; - caddr_t r_dpos; - struct nfsmount *r_nmp; - struct vnode *r_vp; - u_int32_t r_xid; - int r_flags; /* flags on request, see below */ - int r_retry; /* max retransmission count */ - int r_rexmit; /* current retrans count */ - int r_timer; /* tick counter on reply */ - u_int32_t r_procnum; /* NFS procedure number */ - int r_rtt; /* RTT for rpc */ - int r_lastmsg; /* last tprintf */ - struct thread *r_td; /* Proc that did I/O system call */ - struct mtx r_mtx; /* Protects nfsreq fields */ -}; - -/* - * Queue head for nfsreq's - */ -extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq; - -/* Flag values for r_flags */ -#define R_TIMING 0x01 /* timing request (in mntp) */ -#define R_SENT 0x02 /* request has been sent */ -#define R_SOFTTERM 0x04 /* soft mnt, too many retries */ -#define R_RESENDERR 0x08 /* Resend failed */ -#define R_SOCKERR 0x10 /* Fatal error on socket */ -#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ -#define R_MUSTRESEND 0x40 /* Must resend request */ -#define R_GETONEREP 0x80 /* Probe for one reply only */ -#define R_PIN_REQ 0x100 /* Pin request down (rexmit in prog or other) */ - -#else - /* * This is only needed to keep things working while we support * compiling for both RPC implementations. @@ -200,8 +154,6 @@ extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_ struct nfsreq; struct nfsmount; -#endif - struct buf; struct socket; struct uio; @@ -297,19 +249,6 @@ vfs_init_t nfs_init; vfs_uninit_t nfs_uninit; int nfs_mountroot(struct mount *mp); -#ifdef NFS_LEGACYRPC -#ifndef NFS4_USE_RPCCLNT -int nfs_send(struct socket *, struct sockaddr *, struct mbuf *, - struct nfsreq *); -int nfs_connect_lock(struct nfsreq *); -void nfs_connect_unlock(struct nfsreq *); -void nfs_up(struct nfsreq *, struct nfsmount *, struct thread *, - const char *, int); -void nfs_down(struct nfsreq *, struct nfsmount *, struct thread *, - const char *, int, int); -#endif /* ! NFS4_USE_RPCCLNT */ -#endif - void nfs_purgecache(struct vnode *); int nfs_vinvalbuf(struct vnode *, int, struct thread *, int); int nfs_readrpc(struct vnode *, struct uio *, struct ucred *); Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_bio.c Tue Jun 30 19:03:27 2009 (r195202) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_pager.h> #include <vm/vnode_pager.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsmount.h> Modified: head/sys/nfsclient/nfs_diskless.c ============================================================================== --- head/sys/nfsclient/nfs_diskless.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_diskless.c Tue Jun 30 19:03:27 2009 (r195202) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include <net/vnet.h> #include <netinet/in.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsdiskless.h> Modified: head/sys/nfsclient/nfs_krpc.c ============================================================================== --- head/sys/nfsclient/nfs_krpc.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_krpc.c Tue Jun 30 19:03:27 2009 (r195202) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <rpc/rpc.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfs/xdr_subs.h> @@ -69,8 +68,6 @@ __FBSDID("$FreeBSD$"); #include <nfsclient/nfsmount.h> #include <nfsclient/nfsnode.h> -#ifndef NFS_LEGACYRPC - #ifdef KDTRACE_HOOKS #include <sys/dtrace_bsd.h> @@ -899,5 +896,3 @@ nfs_up(struct nfsmount *nmp, struct thre } else mtx_unlock(&nmp->nm_mtx); } - -#endif /* !NFS_LEGACYRPC */ Modified: head/sys/nfsclient/nfs_lock.c ============================================================================== --- head/sys/nfsclient/nfs_lock.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_lock.c Tue Jun 30 19:03:27 2009 (r195202) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsmount.h> Modified: head/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- head/sys/nfsclient/nfs_nfsiod.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_nfsiod.c Tue Jun 30 19:03:27 2009 (r195202) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/tcp.h> #include <nfs/xdr_subs.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsm_subs.h> Modified: head/sys/nfsclient/nfs_node.c ============================================================================== --- head/sys/nfsclient/nfs_node.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_node.c Tue Jun 30 19:03:27 2009 (r195202) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include <vm/uma.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_subs.c Tue Jun 30 19:03:27 2009 (r195202) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/uma.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> @@ -105,8 +104,6 @@ uint32_t nfsclient_attrcache_load_done_i * This is kinda hokey, but may save a little time doing byte swaps */ u_int32_t nfs_xdrneg1; -u_int32_t rpc_call, rpc_vers, rpc_reply, rpc_msgdenied, rpc_autherr, - rpc_mismatch, rpc_auth_unix, rpc_msgaccepted; u_int32_t nfs_true, nfs_false; /* And other global data */ @@ -118,10 +115,6 @@ static enum vtype nv2tov_type[8]= { int nfs_ticks; int nfs_pbuf_freecnt = -1; /* start out unlimited */ -#ifdef NFS_LEGACYRPC -struct nfs_reqq nfs_reqq; -struct mtx nfs_reqq_mtx; -#endif struct nfs_bufq nfs_bufq; static struct mtx nfs_xid_mtx; @@ -194,87 +187,6 @@ nfsm_reqhead(struct vnode *vp, u_long pr } /* - * Build the RPC header and fill in the authorization info. - * The authorization string argument is only used when the credentials - * come from outside of the kernel. - * Returns the head of the mbuf list. - */ -struct mbuf * -nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type, - int auth_len, struct mbuf *mrest, int mrest_len, struct mbuf **mbp, - u_int32_t **xidpp) -{ - struct mbuf *mb; - u_int32_t *tl; - caddr_t bpos; - int i; - struct mbuf *mreq; - int grpsiz, authsiz; - - authsiz = nfsm_rndup(auth_len); - MGETHDR(mb, M_WAIT, MT_DATA); - if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) { - MCLGET(mb, M_WAIT); - } else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) { - MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); - } else { - MH_ALIGN(mb, 8 * NFSX_UNSIGNED); - } - mb->m_len = 0; - mreq = mb; - bpos = mtod(mb, caddr_t); - - /* - * First the RPC header. - */ - tl = nfsm_build(u_int32_t *, 8 * NFSX_UNSIGNED); - - *xidpp = tl; - *tl++ = txdr_unsigned(nfs_xid_gen()); - *tl++ = rpc_call; - *tl++ = rpc_vers; - *tl++ = txdr_unsigned(NFS_PROG); - if (nmflag & NFSMNT_NFSV3) { - *tl++ = txdr_unsigned(NFS_VER3); - *tl++ = txdr_unsigned(procid); - } else { - *tl++ = txdr_unsigned(NFS_VER2); - *tl++ = txdr_unsigned(nfsv2_procid[procid]); - } - - /* - * And then the authorization cred. - */ - *tl++ = txdr_unsigned(auth_type); - *tl = txdr_unsigned(authsiz); - switch (auth_type) { - case RPCAUTH_UNIX: - tl = nfsm_build(u_int32_t *, auth_len); - *tl++ = 0; /* stamp ?? */ - *tl++ = 0; /* NULL hostname */ - *tl++ = txdr_unsigned(cr->cr_uid); - *tl++ = txdr_unsigned(cr->cr_groups[0]); - grpsiz = (auth_len >> 2) - 5; - *tl++ = txdr_unsigned(grpsiz); - for (i = 1; i <= grpsiz; i++) - *tl++ = txdr_unsigned(cr->cr_groups[i]); - break; - } - - /* - * And the verifier... - */ - tl = nfsm_build(u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(RPCAUTH_NULL); - *tl = 0; - mb->m_next = mrest; - mreq->m_pkthdr.len = authsiz + 10 * NFSX_UNSIGNED + mrest_len; - mreq->m_pkthdr.rcvif = NULL; - *mbp = mb; - return (mreq); -} - -/* * copies a uio scatter/gather list to an mbuf chain. * NOTE: can ony handle iovcnt == 1 */ @@ -427,14 +339,6 @@ nfs_init(struct vfsconf *vfsp) nfsmount_zone = uma_zcreate("NFSMOUNT", sizeof(struct nfsmount), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - rpc_vers = txdr_unsigned(RPC_VER2); - rpc_call = txdr_unsigned(RPC_CALL); - rpc_reply = txdr_unsigned(RPC_REPLY); - rpc_msgdenied = txdr_unsigned(RPC_MSGDENIED); - rpc_msgaccepted = txdr_unsigned(RPC_MSGACCEPTED); - rpc_mismatch = txdr_unsigned(RPC_MISMATCH); - rpc_autherr = txdr_unsigned(RPC_AUTHERR); - rpc_auth_unix = txdr_unsigned(RPCAUTH_UNIX); nfs_true = txdr_unsigned(TRUE); nfs_false = txdr_unsigned(FALSE); nfs_xdrneg1 = txdr_unsigned(-1); @@ -451,11 +355,6 @@ nfs_init(struct vfsconf *vfsp) /* * Initialize reply list and start timer */ -#ifdef NFS_LEGACYRPC - TAILQ_INIT(&nfs_reqq); - mtx_init(&nfs_reqq_mtx, "NFS reqq lock", NULL, MTX_DEF); - callout_init(&nfs_callout, CALLOUT_MPSAFE); -#endif mtx_init(&nfs_iod_mtx, "NFS iod lock", NULL, MTX_DEF); mtx_init(&nfs_xid_mtx, "NFS xid lock", NULL, MTX_DEF); @@ -469,13 +368,6 @@ nfs_uninit(struct vfsconf *vfsp) { int i; -#ifdef NFS_LEGACYRPC - callout_stop(&nfs_callout); - - KASSERT(TAILQ_EMPTY(&nfs_reqq), - ("nfs_uninit: request queue not empty")); -#endif - /* * Tell all nfsiod processes to exit. Clear nfs_iodmax, and wakeup * any sleeping nfsiods so they check nfs_iodmax and exit. Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_vfsops.c Tue Jun 30 19:03:27 2009 (r195202) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include <rpc/rpc.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> @@ -142,9 +141,7 @@ VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK); /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfs, 1); -#ifndef NFS_LEGACYRPC MODULE_DEPEND(nfs, krpc, 1, 1, 1); -#endif #ifdef KGSSAPI MODULE_DEPEND(nfs, kgssapi, 1, 1, 1); #endif @@ -551,7 +548,6 @@ nfs_mountdiskless(char *path, return (0); } -#ifndef NFS_LEGACYRPC static int nfs_sec_name_to_num(char *sec) { @@ -569,7 +565,6 @@ nfs_sec_name_to_num(char *sec) */ return (AUTH_SYS); } -#endif static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, @@ -579,10 +574,8 @@ nfs_decode_args(struct mount *mp, struct int adjsock; int maxio; char *p; -#ifndef NFS_LEGACYRPC char *secname; char *principal; -#endif s = splnet(); @@ -734,13 +727,7 @@ nfs_decode_args(struct mount *mp, struct nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; - if ( -#ifdef NFS_LEGACYRPC - nmp->nm_so -#else - nmp->nm_client -#endif - && adjsock) { + if (nmp->nm_client && adjsock) { nfs_safedisconnect(nmp); if (nmp->nm_sotype == SOCK_DGRAM) while (nfs_connect(nmp, NULL)) { @@ -757,7 +744,6 @@ nfs_decode_args(struct mount *mp, struct *p = '\0'; } -#ifndef NFS_LEGACYRPC if (vfs_getopt(mp->mnt_optnew, "sec", (void **) &secname, NULL) == 0) { nmp->nm_secflavor = nfs_sec_name_to_num(secname); @@ -773,7 +759,6 @@ nfs_decode_args(struct mount *mp, struct snprintf(nmp->nm_principal, sizeof(nmp->nm_principal), "nfs@%s", nmp->nm_hostname); } -#endif } static const char *nfs_opts[] = { "from", "nfs_args", Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfs_vnops.c Tue Jun 30 19:03:27 2009 (r195202) @@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$"); #include <fs/fifofs/fifo.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> @@ -3193,7 +3192,7 @@ loop: &np->n_mtx, slpflag | (PRIBIO + 1), "nfsfsync", 0); if (error) { - if (nfs_sigintr(nmp, (struct nfsreq *)0, td)) { + if (nfs_sigintr(nmp, NULL, td)) { mtx_unlock(&np->n_mtx); error = EINTR; goto done; Modified: head/sys/nfsclient/nfsm_subs.h ============================================================================== --- head/sys/nfsclient/nfsm_subs.h Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfsm_subs.h Tue Jun 30 19:03:27 2009 (r195202) @@ -54,10 +54,6 @@ struct vnode; */ u_int32_t nfs_xid_gen(void); struct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz); -struct mbuf *nfsm_rpchead(struct ucred *cr, int nmflag, int procid, - int auth_type, int auth_len, - struct mbuf *mrest, int mrest_len, - struct mbuf **mbp, u_int32_t **xidpp); #define M_HASCL(m) ((m)->m_flags & M_EXT) #define NFSMINOFF(m) \ Modified: head/sys/nfsclient/nfsmount.h ============================================================================== --- head/sys/nfsclient/nfsmount.h Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsclient/nfsmount.h Tue Jun 30 19:03:27 2009 (r195202) @@ -36,36 +36,11 @@ #ifndef _NFSCLIENT_NFSMOUNT_H_ #define _NFSCLIENT_NFSMOUNT_H_ -#ifndef NFS_LEGACYRPC - -#undef RPC_SUCCESS -#undef RPC_PROGUNAVAIL -#undef RPC_PROCUNAVAIL -#undef AUTH_OK -#undef AUTH_BADCRED -#undef AUTH_BADVERF -#undef AUTH_TOOWEAK - #include <rpc/types.h> #include <rpc/auth.h> #include <rpc/clnt.h> #include <rpc/rpcsec_gss.h> -#endif - -#ifdef NFS_LEGACYRPC - -struct nfs_tcp_mountstate { - int rpcresid; -#define NFS_TCP_EXPECT_RPCMARKER 0x0001 /* Expect to see a RPC/TCP marker next */ -#define NFS_TCP_FORCE_RECONNECT 0x0002 /* Force a TCP reconnect */ -#define NFS_TCP_WAIT_WRITE_DRAIN 0x0004 /* Waiting for socket writers to finish */ - int flags; - int sock_send_inprog; -}; - -#endif - /* * Mount structure. * One allocated on every NFS mount. @@ -79,22 +54,12 @@ struct nfsmount { int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_V4FH]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ -#ifdef NFS_LEGACYRPC - struct socket *nm_so; /* Rpc socket */ -#endif int nm_sotype; /* Type of socket */ int nm_soproto; /* and protocol */ int nm_soflags; /* pr_flags for socket protocol */ struct sockaddr *nm_nam; /* Addr of server */ int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ int nm_retry; /* Max retries */ -#ifdef NFS_LEGACYRPC - int nm_srtt[NFS_MAX_TIMER], /* RTT Timers for rpcs */ - nm_sdrtt[NFS_MAX_TIMER]; - int nm_sent; /* Request send count */ - int nm_cwnd; /* Request send window */ - int nm_timeouts; /* Request timeouts */ -#endif int nm_deadthresh; /* Threshold of timeouts-->dead server*/ int nm_rsize; /* Max size of read rpc */ int nm_wsize; /* Max size of write rpc */ @@ -114,17 +79,12 @@ struct nfsmount { struct nfs_rpcops *nm_rpcops; int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ -#ifdef NFS_LEGACYRPC - struct nfs_tcp_mountstate nm_nfstcpstate; -#endif char nm_hostname[MNAMELEN]; /* server's name */ -#ifndef NFS_LEGACYRPC int nm_secflavor; /* auth flavor to use for rpc */ struct __rpc_client *nm_client; struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ char nm_principal[MNAMELEN]; /* GSS-API principal of server */ gss_OID nm_mech_oid; /* OID of selected GSS-API mechanism */ -#endif /* NFSv4 */ uint64_t nm_clientid; Modified: head/sys/nfsserver/nfs.h ============================================================================== --- head/sys/nfsserver/nfs.h Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsserver/nfs.h Tue Jun 30 19:03:27 2009 (r195202) @@ -176,82 +176,10 @@ extern int32_t (*nfsrv3_procs[NFS_NPROCS #define NWDELAYHASH(sock, f) \ (&(sock)->ns_wdelayhashtbl[(*((u_int32_t *)(f))) % NFS_WDELAYHASHSIZ]) -#ifdef NFS_LEGACYRPC -/* - * Network address hash list element - */ -union nethostaddr { - u_int32_t had_inetaddr; - struct sockaddr *had_nam; -}; - -struct nfsrv_rec { - STAILQ_ENTRY(nfsrv_rec) nr_link; - struct sockaddr *nr_address; - struct mbuf *nr_packet; -}; - -struct nfssvc_sock { - TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ - struct file *ns_fp; - struct socket *ns_so; - struct sockaddr *ns_nam; - struct mbuf *ns_raw; - struct mbuf *ns_rawend; - STAILQ_HEAD(, nfsrv_rec) ns_rec; - struct mbuf *ns_frag; - int ns_flag; - int ns_solock; - int ns_cc; - int ns_reclen; - u_int32_t ns_sref; - LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */ - LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ]; -}; - -/* Bits for "ns_flag" */ -#define SLP_VALID 0x01 /* Socket valid for use (XXX) */ -#define SLP_DOREC 0x02 /* Socket ready for processing */ -#define SLP_NEEDQ 0x04 /* Socket has request queued */ -#define SLP_DISCONN 0x08 /* Error received from stream socket */ -#define SLP_GETSTREAM 0x10 /* nfsrv_getstream in prog on sock */ -#define SLP_LASTFRAG 0x20 /* Socket received end-of-record */ -#define SLP_ALLFLAGS 0xff - -extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead; -extern int nfssvc_sockhead_flag; -#define SLP_INIT 0x01 -#define SLP_WANTINIT 0x02 - -/* - * One of these structures is allocated for each nfsd. - */ -struct nfsd { - TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ - int nfsd_flag; /* NFSD_ flags */ - struct nfssvc_sock *nfsd_slp; /* Current socket */ - int nfsd_authlen; /* Authenticator len */ - u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ - int nfsd_verflen; /* and the Verifier */ - u_char nfsd_verfstr[RPCVERF_MAXSIZ]; - struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ -}; - -/* Bits for "nfsd_flag" */ -#define NFSD_WAITING 0x01 -#define NFSD_REQINPROG 0x02 - /* * This structure is used by the server for describing each request. - * Some fields are used only when write request gathering is performed. */ struct nfsrv_descript { - u_quad_t nd_time; /* Write deadline (usec) */ - off_t nd_off; /* Start byte offset */ - off_t nd_eoff; /* and end byte offset */ - LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */ - LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */ - LIST_HEAD(, nfsrv_descript) nd_coalesce;/* coalesced writes */ struct mbuf *nd_mrep; /* Request mbuf list */ struct mbuf *nd_md; /* Current dissect mbuf */ struct mbuf *nd_mreq; /* Reply mbuf list */ @@ -261,56 +189,15 @@ struct nfsrv_descript { u_int32_t nd_procnum; /* RPC # */ int nd_stable; /* storage type */ int nd_flag; /* nd_flag */ - int nd_len; /* Length of this write */ int nd_repstat; /* Reply status */ - u_int32_t nd_retxid; /* Reply xid */ - struct timeval nd_starttime; /* Time RPC initiated */ fhandle_t nd_fh; /* File handle */ struct ucred *nd_cr; /* Credentials */ int nd_credflavor; /* Security flavor */ }; -#else - -/* - * This structure is used by the server for describing each request. - */ -struct nfsrv_descript { - struct mbuf *nd_mrep; /* Request mbuf list */ - struct mbuf *nd_md; /* Current dissect mbuf */ - struct mbuf *nd_mreq; /* Reply mbuf list */ - struct sockaddr *nd_nam; /* and socket addr */ - struct sockaddr *nd_nam2; /* return socket addr */ - caddr_t nd_dpos; /* Current dissect pos */ - u_int32_t nd_procnum; /* RPC # */ - int nd_stable; /* storage type */ - int nd_flag; /* nd_flag */ - int nd_repstat; /* Reply status */ - fhandle_t nd_fh; /* File handle */ - struct ucred *nd_cr; /* Credentials */ - int nd_credflavor; /* Security flavor */ -}; - -#endif - /* Bits for "nd_flag" */ #define ND_NFSV3 0x08 -#ifdef NFS_LEGACYRPC - -extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head; -extern int nfsd_head_flag; -#define NFSD_CHECKSLP 0x01 - -/* - * These macros compare nfsrv_descript structures. - */ -#define NFSW_CONTIG(o, n) \ - ((o)->nd_eoff >= (n)->nd_off && \ - !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH)) - -#endif - /* * Defines for WebNFS */ @@ -353,26 +240,6 @@ extern int nfs_debug; #endif -#ifdef NFS_LEGACYRPC -int netaddr_match(int, union nethostaddr *, struct sockaddr *); -int nfs_getreq(struct nfsrv_descript *, struct nfsd *, int); -int nfsrv_send(struct socket *, struct sockaddr *, struct mbuf *); -int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *, - struct nfsrv_descript **); -int nfs_slplock(struct nfssvc_sock *, int); -void nfs_slpunlock(struct nfssvc_sock *); -void nfsrv_initcache(void); -void nfsrv_destroycache(void); -void nfsrv_timer(void *); -int nfsrv_getcache(struct nfsrv_descript *, struct mbuf **); -void nfsrv_updatecache(struct nfsrv_descript *, int, struct mbuf *); -void nfsrv_cleancache(void); -int nfsrv_rcv(struct socket *so, void *arg, int waitflag); -void nfsrv_slpderef(struct nfssvc_sock *slp); -void nfsrv_wakenfsd(struct nfssvc_sock *slp); -int nfsrv_writegather(struct nfsrv_descript **, struct nfssvc_sock *, - struct mbuf **); -#endif struct mbuf *nfs_rephead(int, struct nfsrv_descript *, int, struct mbuf **, caddr_t *); void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *, Modified: head/sys/nfsserver/nfs_fha.c ============================================================================== --- head/sys/nfsserver/nfs_fha.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsserver/nfs_fha.c Tue Jun 30 19:03:27 2009 (r195202) @@ -39,14 +39,11 @@ __FBSDID("$FreeBSD$"); #include <rpc/rpc.h> #include <nfs/xdr_subs.h> -#include <nfs/rpcv2.h> #include <nfs/nfsproto.h> #include <nfsserver/nfs.h> #include <nfsserver/nfsm_subs.h> #include <nfsserver/nfs_fha.h> -#ifndef NFS_LEGACYRPC - static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); /* Sysctl defaults. */ @@ -598,5 +595,3 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS) sbuf_delete(&sb); return (error); } - -#endif /* !NFS_LEGACYRPC */ Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Tue Jun 30 18:52:36 2009 (r195201) +++ head/sys/nfsserver/nfs_serv.c Tue Jun 30 19:03:27 2009 (r195202) @@ -93,7 +93,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <nfs/nfsproto.h> -#include <nfs/rpcv2.h> #include <nfsserver/nfs.h> #include <nfs/xdr_subs.h> #include <nfsserver/nfsm_subs.h> @@ -142,10 +141,6 @@ SYSCTL_STRUCT(_vfs_nfsrv, NFS_NFSRVSTATS static int nfsrv_access(struct vnode *, accmode_t, struct ucred *, int, int); -#ifdef NFS_LEGACYRPC -static void nfsrvw_coalesce(struct nfsrv_descript *, - struct nfsrv_descript *); -#endif /* * Clear nameidata fields that are tested in nsfmout cleanup code prior @@ -1229,425 +1224,6 @@ nfsmout: return(error); } -#ifdef NFS_LEGACYRPC - -/* - * XXX dfr - write gathering isn't supported by the new RPC code since - * its really only useful for NFSv2. If there is a real need, we could - * attempt to fit it into the filehandle affinity system, e.g. by - * looking to see if there are queued write requests that overlap this - * one. - */ - -/* - * For the purposes of write gathering, we must decide if the credential - * associated with two pending requests have equivilent privileges. Since - * NFS only uses a subset of the BSD ucred -- the effective uid and group - * IDs -- we have a compare routine that checks only the relevant fields. - */ -static int -nfsrv_samecred(struct ucred *cr1, struct ucred *cr2) -{ - int i; - - if (cr1->cr_uid != cr2->cr_uid) - return (0); - if (cr1->cr_ngroups != cr2->cr_ngroups) - return (0); - for (i = 0; i < cr1->cr_ngroups; i++) { - if (cr1->cr_groups[i] != cr2->cr_groups[i]) - return (0); - } - return (1); -} - -/* - * NFS write service with write gathering support. Called when - * nfsrvw_procrastinate > 0. - * See: Chet Juszczak, "Improving the Write Performance of an NFS Server", - * in Proc. of the Winter 1994 Usenix Conference, pg. 247-259, San Franscisco, - * Jan. 1994. - */ -int -nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp, - struct mbuf **mrq) -{ - struct iovec *ivp; - struct mbuf *mp; - struct nfsrv_descript *wp, *nfsd, *owp, *swp; - struct nfs_fattr *fp; - int i; - struct iovec *iov; - struct nfsrvw_delayhash *wpp; - struct ucred *cred; - struct vattr va, forat; - u_int32_t *tl; - caddr_t bpos, dpos; - int error = 0, rdonly, len, forat_ret = 1; - int ioflags, aftat_ret = 1, s, adjust, v3, zeroing; - struct mbuf *mb, *mreq, *mrep, *md; - struct vnode *vp = NULL; - struct uio io, *uiop = &io; - u_quad_t cur_usec; - struct mount *mntp = NULL; - int mvfslocked; - int vfslocked; - - nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); -#ifndef nolint - i = 0; - len = 0; -#endif - vfslocked = 0; - *mrq = NULL; - if (*ndp) { - nfsd = *ndp; - *ndp = NULL; - mrep = nfsd->nd_mrep; - md = nfsd->nd_md; - dpos = nfsd->nd_dpos; - cred = nfsd->nd_cr; - v3 = (nfsd->nd_flag & ND_NFSV3); - LIST_INIT(&nfsd->nd_coalesce); - nfsd->nd_mreq = NULL; - nfsd->nd_stable = NFSV3WRITE_FILESYNC; - cur_usec = nfs_curusec(); - nfsd->nd_time = cur_usec + - (v3 ? nfsrvw_procrastinate_v3 : nfsrvw_procrastinate); - - /* - * Now, get the write header.. - */ - nfsm_srvmtofh(&nfsd->nd_fh); - if (v3) { - tl = nfsm_dissect_nonblock(u_int32_t *, 5 * NFSX_UNSIGNED); - nfsd->nd_off = fxdr_hyper(tl); - tl += 3; - nfsd->nd_stable = fxdr_unsigned(int, *tl++); - } else { - tl = nfsm_dissect_nonblock(u_int32_t *, 4 * NFSX_UNSIGNED); - nfsd->nd_off = (off_t)fxdr_unsigned(u_int32_t, *++tl); - tl += 2; - if (nfs_async) - nfsd->nd_stable = NFSV3WRITE_UNSTABLE; - } - len = fxdr_unsigned(int32_t, *tl); - nfsd->nd_len = len; - nfsd->nd_eoff = nfsd->nd_off + len; - - /* - * Trim the header out of the mbuf list and trim off any trailing - * junk so that the mbuf list has only the write data. - */ - zeroing = 1; - i = 0; - mp = mrep; - while (mp) { - if (mp == md) { - zeroing = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906301903.n5UJ3RrE089516>