summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs.h7
-rw-r--r--sys/nfs/nfs_socket.c36
-rw-r--r--sys/nfs/nfs_subs.c12
-rw-r--r--sys/nfs/nfs_vfsops.c5
-rw-r--r--sys/nfs/nfsmount.h5
5 files changed, 26 insertions, 39 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 1e801af776d..c3bb1ca00a2 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.49 2009/08/20 15:04:24 thib Exp $ */
+/* $OpenBSD: nfs.h,v 1.50 2009/08/25 13:41:29 thib Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -223,11 +223,6 @@ struct nfsreq {
struct proc *r_procp; /* Proc that did I/O system call */
};
-/*
- * Queue head for nfsreq's
- */
-extern TAILQ_HEAD(nfsreqhead, nfsreq) nfs_reqq;
-
/* Flag values for r_flags */
#define R_TIMING 0x01 /* timing request (in mntp) */
#define R_SENT 0x02 /* request has been sent */
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 63f4c2c604d..8825f2e1bc0 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.94 2009/08/10 09:38:44 thib Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.95 2009/08/25 13:41:29 thib Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -76,8 +76,6 @@ extern struct nfsstats nfsstats;
extern int nfsv3_procid[NFS_NPROCS];
extern int nfs_ticks;
-struct nfsreqhead nfs_reqq;
-
extern struct pool nfsrv_descript_pl;
/*
@@ -403,11 +401,9 @@ nfs_reconnect(rep)
* on old socket.
*/
s = splsoftnet();
- TAILQ_FOREACH(rp, &nfs_reqq, r_chain) {
- if (rp->r_nmp == nmp) {
- rp->r_flags |= R_MUSTRESEND;
- rp->r_rexmit = 0;
- }
+ TAILQ_FOREACH(rp, &nmp->nm_reqsq, r_chain) {
+ rp->r_flags |= R_MUSTRESEND;
+ rp->r_rexmit = 0;
}
splx(s);
return (0);
@@ -798,7 +794,7 @@ nfsmout:
* Iff no match, just drop the datagram
*/
s = splsoftnet();
- TAILQ_FOREACH(rep, &nfs_reqq, r_chain) {
+ TAILQ_FOREACH(rep, &nmp->nm_reqsq, r_chain) {
if (rep->r_mrep == NULL && rxid == rep->r_xid) {
/* Found it.. */
rep->r_mrep = info.nmi_mrep;
@@ -919,7 +915,9 @@ tryagain:
* to put it LAST so timer finds oldest requests first.
*/
s = splsoftnet();
- TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
+ if (TAILQ_EMPTY(&nmp->nm_reqsq))
+ timeout_add(&nmp->nm_rtimeout, nfs_ticks);
+ TAILQ_INSERT_TAIL(&nmp->nm_reqsq, rep, r_chain);
/*
* If backing off another request or avoiding congestion, don't
@@ -958,7 +956,9 @@ tryagain:
* RPC done, unlink the request.
*/
s = splsoftnet();
- TAILQ_REMOVE(&nfs_reqq, rep, r_chain);
+ TAILQ_REMOVE(&nmp->nm_reqsq, rep, r_chain);
+ if (TAILQ_EMPTY(&nmp->nm_reqsq))
+ timeout_del(&nmp->nm_rtimeout);
splx(s);
/*
@@ -1141,20 +1141,16 @@ nfs_rephead(siz, nd, slp, err, mrq, mbp)
* Scan the nfsreq list and retranmit any requests that have timed out.
*/
void
-nfs_timer(arg)
- void *arg;
+nfs_timer(void *arg)
{
- struct timeout *to = (struct timeout *)arg;
+ struct nfsmount *nmp = arg;
struct nfsreq *rep;
struct mbuf *m;
struct socket *so;
- struct nfsmount *nmp;
- int timeo;
- int s, error;
+ int timeo, s, error;
s = splsoftnet();
- TAILQ_FOREACH(rep, &nfs_reqq, r_chain) {
- nmp = rep->r_nmp;
+ TAILQ_FOREACH(rep, &nmp->nm_reqsq, r_chain) {
if (rep->r_mrep || (rep->r_flags & R_SOFTTERM))
continue;
if (nfs_sigintr(nmp, rep, rep->r_procp)) {
@@ -1237,7 +1233,7 @@ nfs_timer(arg)
}
}
splx(s);
- timeout_add(to, nfs_ticks);
+ timeout_add(&nmp->nm_rtimeout, nfs_ticks);
}
/*
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index bc845e93895..a55ec8b6158 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.104 2009/08/20 15:04:24 thib Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.105 2009/08/25 13:41:29 thib Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -895,8 +895,6 @@ nfs_adv(mdp, dposp, offs, left)
void
nfs_init()
{
- static struct timeout nfs_timer_to;
-
rpc_vers = txdr_unsigned(RPC_VER2);
rpc_call = txdr_unsigned(RPC_CALL);
rpc_reply = txdr_unsigned(RPC_REPLY);
@@ -919,14 +917,6 @@ nfs_init()
pool_init(&nfsreqpl, sizeof(struct nfsreq), 0, 0, 0, "nfsreqpl",
&pool_allocator_nointr);
-
- /*
- * Initialize reply list and start timer
- */
- TAILQ_INIT(&nfs_reqq);
-
- timeout_set(&nfs_timer_to, nfs_timer, &nfs_timer_to);
- nfs_timer(&nfs_timer_to);
}
#ifdef NFSCLIENT
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index b39688be830..b872cfd2a56 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.89 2009/08/20 15:04:24 thib Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.90 2009/08/25 13:41:29 thib Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -700,6 +700,8 @@ mountnfs(argp, mp, nam, pth, hst)
nfs_decode_args(nmp, argp, &mp->mnt_stat.mount_info.nfs_args);
RB_INIT(&nmp->nm_ntree);
+ TAILQ_INIT(&nmp->nm_reqsq);
+ timeout_set(&nmp->nm_rtimeout, nfs_timer, nmp);
/* Set up the sockets and per-host congestion */
nmp->nm_sotype = argp->sotype;
@@ -748,6 +750,7 @@ nfs_unmount(struct mount *mp, int mntflags, struct proc *p)
nfs_disconnect(nmp);
m_freem(nmp->nm_nam);
+ timeout_del(&nmp->nm_rtimeout);
free(nmp, M_NFSMNT);
return (0);
}
diff --git a/sys/nfs/nfsmount.h b/sys/nfs/nfsmount.h
index 9ba488834d8..2fc13680897 100644
--- a/sys/nfs/nfsmount.h
+++ b/sys/nfs/nfsmount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsmount.h,v 1.22 2009/08/20 15:04:24 thib Exp $ */
+/* $OpenBSD: nfsmount.h,v 1.23 2009/08/25 13:41:29 thib Exp $ */
/* $NetBSD: nfsmount.h,v 1.10 1996/02/18 11:54:03 fvdl Exp $ */
/*
@@ -47,6 +47,9 @@
struct nfsmount {
RB_HEAD(nfs_nodetree, nfsnode)
nm_ntree; /* filehandle/node tree */
+ TAILQ_HEAD(reqs, nfsreq)
+ nm_reqsq; /* request queue for this mount. */
+ struct timeout nm_rtimeout; /* timeout (scans/resends nm_reqsq). */
int nm_flag; /* Flags for soft/hard... */
struct mount *nm_mountp; /* Vfs structure for this filesystem */
int nm_numgrps; /* Max. size of groupslist */