Various fixes from NetBSD:

Use u_int for rpc procedure numbers.
	Some fixes to NQNFS.
	A rare NULL pointer dereference.
	Ignore NFSMNT_NOCONN for TCP mounts.

Obtained from:	NetBSD
This commit is contained in:
Doug Rabson 1997-06-03 17:22:47 +00:00
parent 46c1f176f1
commit 7d6b68c4de
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26420
15 changed files with 63 additions and 43 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
* $Id$
* $Id: nfs_nqlease.c,v 1.24 1997/02/22 09:42:37 peter Exp $
*/
@ -492,9 +492,10 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
struct mbuf *mreq, *mb, *mb2, *nam2, *mheadend;
struct socket *so;
struct sockaddr_in *saddr;
nfsfh_t nfh;
fhandle_t *fhp;
caddr_t bpos, cp;
u_long xid;
u_long xid, *tl;
int len = 1, ok = 1, i = 0;
int sotype, *solockp;
@ -525,12 +526,12 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
else
solockp = (int *)0;
nfsm_reqhead((struct vnode *)0, NQNFSPROC_EVICTED,
NFSX_V3FH);
nfsm_build(cp, caddr_t, NFSX_V3FH);
bzero(cp, NFSX_V3FH);
fhp = (fhandle_t *)cp;
NFSX_V3FH + NFSX_UNSIGNED);
fhp = &nfh.fh_generic;
bzero((caddr_t)fhp, sizeof(nfh));
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
VFS_VPTOFH(vp, &fhp->fh_fid);
nfsm_srvfhtom(fhp, 1);
m = mreq;
siz = 0;
while (m) {
@ -918,7 +919,7 @@ nqnfs_vacated(vp, cred)
nmp = VFSTONFS(vp->v_mount);
nfsstats.rpccnt[NQNFSPROC_VACATED]++;
nfsm_reqhead(vp, NQNFSPROC_VACATED, NFSX_V3FH);
nfsm_reqhead(vp, NQNFSPROC_VACATED, NFSX_FH(1));
nfsm_fhtom(vp, 1);
m = mreq;
i = 0;
@ -1092,14 +1093,16 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
if (vpid == vp->v_id) {
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
np->n_timer.cqe_next = 0;
if ((np->n_flag & (NMODIFIED | NQNFSEVICTED))
&& vp->v_type == VREG) {
if (np->n_flag & (NMODIFIED | NQNFSEVICTED)) {
if (np->n_flag & NQNFSEVICTED) {
if (vp->v_type == VDIR)
nfs_invaldir(vp);
cache_purge(vp);
(void) nfs_vinvalbuf(vp,
V_SAVE, cred, p, 0);
np->n_flag &= ~NQNFSEVICTED;
(void) nqnfs_vacated(vp, cred);
} else {
} else if (vp->v_type == VREG) {
(void) VOP_FSYNC(vp, cred,
MNT_WAIT, p);
np->n_flag &= ~NMODIFIED;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.24 1997/04/27 20:01:21 wollman Exp $
* $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
*/
/*
@ -1264,7 +1264,8 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
*tl = 0;
}
}
*mrq = mreq;
if (mrq != NULL)
*mrq = mreq;
*mbp = mb;
*bposp = bpos;
if (err != 0 && err != NFSERR_RETVOID)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.41 1997/05/11 18:05:38 tegge Exp $
* $Id: nfs_vfsops.c,v 1.42 1997/05/12 19:02:56 tegge Exp $
*/
#include <sys/param.h>
@ -706,6 +706,13 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN);
nmp->nm_nam = nam;
/*
* Silently clear NFSMNT_NOCONN if it's a TCP mount, it makes
* no sense in that context.
*/
if (argp->sotype == SOCK_STREAM)
argp->flags &= ~NFSMNT_NOCONN;
if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) {
nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10;
if (nmp->nm_timeo < NFS_MINTIMEO)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsrtt.h 8.2 (Berkeley) 3/30/95
* $Id$
* $Id: nfsrtt.h,v 1.7 1997/02/22 09:42:50 peter Exp $
*/
@ -58,7 +58,7 @@
struct nfsrtt {
int pos; /* Position in array for next entry */
struct rttl {
int proc; /* NFS procedure number */
u_int32_t proc; /* NFS procedure number */
int rtt; /* Measured round trip time */
int rto; /* Round Trip Timeout */
int sent; /* # rpcs in progress */
@ -94,7 +94,7 @@ struct nfsdrt {
int pos; /* Position of next log entry */
struct drt {
int flag; /* Bits as defined above */
int proc; /* NFS procedure number */
u_int32_t proc; /* NFS procedure number */
u_long ipadr; /* IP address of client */
int resptime; /* Response time (usec) */
struct timeval tstamp; /* Timestamp of log entry */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95
* $Id$
* $Id: nfsrvcache.h,v 1.8 1997/02/22 09:42:51 peter Exp $
*/
@ -56,7 +56,7 @@ struct nfsrvcache {
int ru_repstat; /* Reply status */
} rc_un;
union nethostaddr rc_haddr; /* Host address */
short rc_proc; /* rpc proc number */
u_int32_t rc_proc; /* rpc proc number */
u_char rc_state; /* Current state of request */
u_char rc_flag; /* Flag bits */
};

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.24 1997/04/27 20:01:21 wollman Exp $
* $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
*/
/*
@ -1264,7 +1264,8 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
*tl = 0;
}
}
*mrq = mreq;
if (mrq != NULL)
*mrq = mreq;
*mbp = mb;
*bposp = bpos;
if (err != 0 && err != NFSERR_RETVOID)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.41 1997/05/11 18:05:38 tegge Exp $
* $Id: nfs_vfsops.c,v 1.42 1997/05/12 19:02:56 tegge Exp $
*/
#include <sys/param.h>
@ -706,6 +706,13 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN);
nmp->nm_nam = nam;
/*
* Silently clear NFSMNT_NOCONN if it's a TCP mount, it makes
* no sense in that context.
*/
if (argp->sotype == SOCK_STREAM)
argp->flags &= ~NFSMNT_NOCONN;
if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) {
nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10;
if (nmp->nm_timeo < NFS_MINTIMEO)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.24 1997/04/27 20:01:21 wollman Exp $
* $Id: nfs_socket.c,v 1.25 1997/05/13 17:25:44 dfr Exp $
*/
/*
@ -1264,7 +1264,8 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
*tl = 0;
}
}
*mrq = mreq;
if (mrq != NULL)
*mrq = mreq;
*mbp = mb;
*bposp = bpos;
if (err != 0 && err != NFSERR_RETVOID)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95
* $Id$
* $Id: nfsrvcache.h,v 1.8 1997/02/22 09:42:51 peter Exp $
*/
@ -56,7 +56,7 @@ struct nfsrvcache {
int ru_repstat; /* Reply status */
} rc_un;
union nethostaddr rc_haddr; /* Host address */
short rc_proc; /* rpc proc number */
u_int32_t rc_proc; /* rpc proc number */
u_char rc_state; /* Current state of request */
u_char rc_flag; /* Flag bits */
};

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.26 1997/05/13 17:25:44 dfr Exp $
* $Id: nfs.h,v 1.27 1997/05/19 14:36:46 dfr Exp $
*/
#ifndef _NFS_NFS_H_
@ -333,7 +333,7 @@ struct nfsreq {
int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
u_int32_t r_procnum; /* NFS procedure number */
int r_rtt; /* RTT for rpc */
struct proc *r_procp; /* Proc that did I/O system call */
};
@ -483,7 +483,7 @@ struct nfsrv_descript {
struct mbuf *nd_nam; /* and socket addr */
struct mbuf *nd_nam2; /* return socket addr */
caddr_t nd_dpos; /* Current dissect pos */
int nd_procnum; /* RPC # */
u_int32_t nd_procnum; /* RPC # */
int nd_stable; /* storage type */
int nd_flag; /* nd_flag */
int nd_len; /* Length of this write */