* Fix some bugs in NQNFS (malformed RPC requests, no directory lease eviction)
* Avoid possible NULL ptr ref in nfs_reply * Don't ever try to sillyrename directories (from FreeBSD)
This commit is contained in:
parent
041fb607e0
commit
be787cc073
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.17 1997/01/31 02:58:48 thorpej Exp $ */
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.18 1997/02/09 21:19:04 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -55,6 +55,7 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
@ -455,9 +456,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_int32_t xid;
|
||||
u_int32_t xid, *tl;
|
||||
int len = 1, ok = 1, i = 0;
|
||||
int sotype, *solockp;
|
||||
|
||||
@ -488,12 +490,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) {
|
||||
@ -833,7 +835,7 @@ nqnfs_getlease(vp, rwflag, cred, p)
|
||||
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
|
||||
int cachable;
|
||||
u_quad_t frev;
|
||||
|
||||
|
||||
nfsstats.rpccnt[NQNFSPROC_GETLEASE]++;
|
||||
mb = mreq = nfsm_reqh(vp, NQNFSPROC_GETLEASE, NFSX_V3FH+2*NFSX_UNSIGNED,
|
||||
&bpos);
|
||||
@ -876,10 +878,10 @@ nqnfs_vacated(vp, cred)
|
||||
struct mbuf *mreq, *mb, *mb2, *mheadend;
|
||||
struct nfsmount *nmp;
|
||||
struct nfsreq myrep;
|
||||
|
||||
|
||||
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;
|
||||
@ -1054,14 +1056,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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_socket.c,v 1.33 1997/02/04 21:33:19 fvdl Exp $ */
|
||||
/* $NetBSD: nfs_socket.c,v 1.34 1997/02/09 21:19:05 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1995
|
||||
@ -1213,7 +1213,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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vnops.c,v 1.69 1996/12/02 22:55:45 thorpej Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.70 1997/02/09 21:19:06 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -1537,7 +1537,7 @@ nfs_rename(v)
|
||||
* rename of the new file over it.
|
||||
*/
|
||||
if (tvp && tvp->v_usecount > 1 && !VTONFS(tvp)->n_sillyrename &&
|
||||
!nfs_sillyrename(tdvp, tvp, tcnp)) {
|
||||
tvp->v_type != VDIR && !nfs_sillyrename(tdvp, tvp, tcnp)) {
|
||||
vrele(tvp);
|
||||
tvp = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user