summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver/nfs_srvcache.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
committerdfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
commit666343f7f055c064375d48bb9a608730d7145beb (patch)
tree372bad41f8c547f40d0826ed596c53dc772ab986 /sys/nfsserver/nfs_srvcache.c
parent6da3ef32238f37b3b45cf709205fcff60bcbda7f (diff)
downloadFreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.zip
FreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.tar.gz
Changes to support version 3 of the NFS protocol.
The version 2 support has been tested (client+server) against FreeBSD-2.0, IRIX 5.3 and FreeBSD-current (using a loopback mount). The version 2 support is stable AFAIK. The version 3 support has been tested with a loopback mount and minimally against an IRIX 5.3 server. It needs more testing and may have problems. I have patched amd to support the new variable length filehandles although it will still only use version 2 of the protocol. Before booting a kernel with these changes, nfs clients will need to at least build and install /usr/sbin/mount_nfs. Servers will need to build and install /usr/sbin/mountd. NFS diskless support is untested. Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
Diffstat (limited to 'sys/nfsserver/nfs_srvcache.c')
-rw-r--r--sys/nfsserver/nfs_srvcache.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c
index 0f31ae0..acdce0d 100644
--- a/sys/nfsserver/nfs_srvcache.c
+++ b/sys/nfsserver/nfs_srvcache.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
- * $Id: nfs_srvcache.c,v 1.4 1994/10/02 17:27:00 phk Exp $
+ * $Id: nfs_srvcache.c,v 1.5 1994/10/17 17:47:36 phk Exp $
*/
/*
@@ -59,11 +59,13 @@
#endif
#include <nfs/nfsm_subs.h>
#include <nfs/rpcv2.h>
-#include <nfs/nfsv2.h>
+#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <nfs/nfsrvcache.h>
#include <nfs/nqnfs.h>
+extern struct nfsstats nfsstats;
+extern int nfsv2_procid[NFS_NPROCS];
long numnfsrvcache, desirednfsrvcache = NFSRVCACHESIZ;
#define NFSRCHASH(xid) \
@@ -89,7 +91,6 @@ int nonidempotent[NFS_NPROCS] = {
FALSE,
FALSE,
FALSE,
- FALSE,
TRUE,
TRUE,
TRUE,
@@ -98,6 +99,10 @@ int nonidempotent[NFS_NPROCS] = {
TRUE,
TRUE,
TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ FALSE,
FALSE,
FALSE,
FALSE,
@@ -108,7 +113,7 @@ int nonidempotent[NFS_NPROCS] = {
};
/* True iff the rpc reply is an nfs status ONLY! */
-static int repliesstatus[NFS_NPROCS] = {
+static int nfsv2_repstat[NFS_NPROCS] = {
FALSE,
FALSE,
FALSE,
@@ -127,11 +132,6 @@ static int repliesstatus[NFS_NPROCS] = {
TRUE,
FALSE,
FALSE,
- FALSE,
- FALSE,
- FALSE,
- FALSE,
- TRUE,
};
/*
@@ -160,9 +160,9 @@ nfsrv_initcache()
* Update/add new request at end of lru list
*/
int
-nfsrv_getcache(nam, nd, repp)
- struct mbuf *nam;
- register struct nfsd *nd;
+nfsrv_getcache(nd, slp, repp)
+ register struct nfsrv_descript *nd;
+ struct nfssvc_sock *slp;
struct mbuf **repp;
{
register struct nfsrvcache *rp;
@@ -171,13 +171,17 @@ nfsrv_getcache(nam, nd, repp)
caddr_t bpos;
int ret;
- if (nd->nd_nqlflag != NQL_NOVAL)
+ /*
+ * Don't cache recent requests for reliable transport protocols.
+ * (Maybe we should for the case of a reconnect, but..)
+ */
+ if (!nd->nd_nam2)
return (RC_DOIT);
loop:
for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
rp = rp->rc_hash.le_next) {
if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
- netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nam)) {
+ netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) {
if ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0);
@@ -196,7 +200,7 @@ loop:
ret = RC_DROPIT;
} else if (rp->rc_flag & RC_REPSTATUS) {
nfsstats.srvcache_nonidemdonehits++;
- nfs_rephead(0, nd, rp->rc_status,
+ nfs_rephead(0, nd, slp, rp->rc_status,
0, (u_quad_t *)0, repp, &mb, &bpos);
ret = RC_REPLY;
} else if (rp->rc_flag & RC_REPMBUF) {
@@ -243,7 +247,7 @@ loop:
TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru);
rp->rc_state = RC_INPROG;
rp->rc_xid = nd->nd_retxid;
- saddr = mtod(nam, struct sockaddr_in *);
+ saddr = mtod(nd->nd_nam, struct sockaddr_in *);
switch (saddr->sin_family) {
case AF_INET:
rp->rc_flag |= RC_INETADDR;
@@ -252,7 +256,7 @@ loop:
case AF_ISO:
default:
rp->rc_flag |= RC_NAM;
- rp->rc_nam = m_copym(nam, 0, M_COPYALL, M_WAIT);
+ rp->rc_nam = m_copym(nd->nd_nam, 0, M_COPYALL, M_WAIT);
break;
};
rp->rc_proc = nd->nd_procnum;
@@ -269,21 +273,20 @@ loop:
* Update a request cache entry after the rpc has been done
*/
void
-nfsrv_updatecache(nam, nd, repvalid, repmbuf)
- struct mbuf *nam;
- register struct nfsd *nd;
+nfsrv_updatecache(nd, repvalid, repmbuf)
+ register struct nfsrv_descript *nd;
int repvalid;
struct mbuf *repmbuf;
{
register struct nfsrvcache *rp;
- if (nd->nd_nqlflag != NQL_NOVAL)
+ if (!nd->nd_nam2)
return;
loop:
for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
rp = rp->rc_hash.le_next) {
if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
- netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nam)) {
+ netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) {
if ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0);
@@ -296,7 +299,8 @@ loop:
* the reply for non-idempotent rpc's.
*/
if (repvalid && nonidempotent[nd->nd_procnum]) {
- if (repliesstatus[nd->nd_procnum]) {
+ if ((nd->nd_flag & ND_NFSV3) == 0 &&
+ nfsv2_repstat[nfsv2_procid[nd->nd_procnum]]) {
rp->rc_status = nd->nd_repstat;
rp->rc_flag |= RC_REPSTATUS;
} else {
OpenPOWER on IntegriCloud