Date: Mon, 17 May 2010 01:41:11 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r208177 - stable/8/sys/fs/nfs Message-ID: <201005170141.o4H1fBZC077109@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Mon May 17 01:41:11 2010 New Revision: 208177 URL: http://svn.freebsd.org/changeset/base/208177 Log: MFC: r207764 Patch the experimental NFS client so that it works for NFSv2 by adding the necessary mapping from NFSv3 procedure numbers to NFSv2 procedure numbers when doing NFSv2 RPCs. Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonkrpc.c Mon May 17 01:18:12 2010 (r208176) +++ stable/8/sys/fs/nfs/nfs_commonkrpc.c Mon May 17 01:41:11 2010 (r208177) @@ -97,14 +97,37 @@ static void nfs_up(struct nfsmount *, st int, int); static int nfs_msg(struct thread *, const char *, const char *, int); -extern int nfsv2_procid[]; - struct nfs_cached_auth { int ca_refs; /* refcount, including 1 from the cache */ uid_t ca_uid; /* uid that corresponds to this auth */ AUTH *ca_auth; /* RPC auth handle */ }; +static int nfsv2_procid[NFS_V3NPROCS] = { + NFSV2PROC_NULL, + NFSV2PROC_GETATTR, + NFSV2PROC_SETATTR, + NFSV2PROC_LOOKUP, + NFSV2PROC_NOOP, + NFSV2PROC_READLINK, + NFSV2PROC_READ, + NFSV2PROC_WRITE, + NFSV2PROC_CREATE, + NFSV2PROC_MKDIR, + NFSV2PROC_SYMLINK, + NFSV2PROC_CREATE, + NFSV2PROC_REMOVE, + NFSV2PROC_RMDIR, + NFSV2PROC_RENAME, + NFSV2PROC_LINK, + NFSV2PROC_READDIR, + NFSV2PROC_NOOP, + NFSV2PROC_STATFS, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, +}; + /* * Initialize sockets and congestion for a new NFS connection. * We do not free the sockaddr if error. @@ -533,6 +556,15 @@ newnfs_request(struct nfsrv_descript *nd if (nmp != NULL) { NFSINCRGLOBAL(newnfsstats.rpcrequests); + + /* Map the procnum to the old NFSv2 one, as required. */ + if ((nd->nd_flag & ND_NFSV2) != 0) { + if (nd->nd_procnum < NFS_V3NPROCS) + procnum = nfsv2_procid[nd->nd_procnum]; + else + procnum = NFSV2PROC_NOOP; + } + /* * Now only used for the R_DONTRECOVER case, but until that is * supported within the krpc code, I need to keep a queue of
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005170141.o4H1fBZC077109>