sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
f57be82572
commit
58b04bcee7
468 changed files with 9958 additions and 7882 deletions
|
@ -179,7 +179,7 @@ krpc_portmap(struct sockaddr_in *sin, u_int prog, u_int vers, u_int16_t *portp)
|
|||
sin->sin_port = htons(PMAPPORT);
|
||||
error = krpc_call(sin, PMAPPROG, PMAPVERS,
|
||||
PMAPPROC_GETPORT, &m, NULL, -1);
|
||||
if (error)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (m->m_len < sizeof(*rdata)) {
|
||||
|
|
|
@ -174,7 +174,7 @@ nfs_set_naiod(int howmany)
|
|||
want = howmany - nfs_numaiods;
|
||||
|
||||
if (want > 0) {
|
||||
/* Add more. */
|
||||
/* Add more. */
|
||||
want = min(want, NFS_MAXASYNCDAEMON);
|
||||
while (want > 0) {
|
||||
error = kthread_create(nfs_aiod, NULL, NULL, "nfsaio");
|
||||
|
|
|
@ -388,7 +388,7 @@ again:
|
|||
}
|
||||
nfs_del_committed_range(vp, bp);
|
||||
rw_exit_write(&np->n_commitlock);
|
||||
} else
|
||||
} else
|
||||
bp->b_flags &= ~B_NEEDCOMMIT;
|
||||
|
||||
if (ioflag & IO_SYNC) {
|
||||
|
|
|
@ -359,7 +359,7 @@ nfs_kqwatch(struct vnode *vp)
|
|||
* Fetch current attributes. It's only needed when the vnode
|
||||
* is not watched yet, but we need to do this without lock
|
||||
* held. This is likely cheap due to attrcache, so do it now.
|
||||
*/
|
||||
*/
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
(void) VOP_GETATTR(vp, &attr, p->p_ucred, p);
|
||||
|
||||
|
|
|
@ -2230,10 +2230,10 @@ again:
|
|||
txdr_hyper(dp->d_fileno, tl);
|
||||
else
|
||||
*tl = txdr_unsigned((u_int32_t)dp->d_fileno);
|
||||
|
||||
|
||||
/* And copy the name */
|
||||
nfsm_strtombuf(&info.nmi_mb, dp->d_name, nlen);
|
||||
|
||||
|
||||
/* Finish off the record */
|
||||
if (info.nmi_v3) {
|
||||
tl = nfsm_build(&info.nmi_mb, 2*NFSX_UNSIGNED);
|
||||
|
@ -2405,7 +2405,7 @@ again:
|
|||
* entryplus3 *entries;
|
||||
* bool eof;
|
||||
* }
|
||||
*/
|
||||
*/
|
||||
dirlen = len = NFSX_V3POSTOPATTR + NFSX_V3COOKIEVERF + 2 * NFSX_UNSIGNED;
|
||||
nfsm_reply(cnt);
|
||||
nfsm_srvpostop_attr(nfsd, getret, &at, &info);
|
||||
|
@ -2519,7 +2519,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|||
int error = 0, rdonly, for_ret = 1, aft_ret = 1, cnt;
|
||||
char *cp2;
|
||||
u_quad_t off;
|
||||
|
||||
|
||||
info.nmi_mreq = NULL;
|
||||
info.nmi_mrep = nfsd->nd_mrep;
|
||||
info.nmi_md = nfsd->nd_md;
|
||||
|
@ -2803,7 +2803,7 @@ nfsrv_null(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|||
int
|
||||
nfsrv_noop(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
||||
struct proc *procp, struct mbuf **mrq)
|
||||
{
|
||||
{
|
||||
struct nfsm_info info;
|
||||
int error;
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ nfs_init_rtt(struct nfsmount *nmp)
|
|||
/*
|
||||
* Update a mount point's RTT estimator state using data from the
|
||||
* passed-in request.
|
||||
*
|
||||
*
|
||||
* Use a gain of 0.125 on the mean and a gain of 0.25 on the deviation.
|
||||
*
|
||||
* NB: Since the timer resolution of NFS_HZ is so course, it can often
|
||||
|
@ -244,7 +244,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
|
|||
|
||||
nmp->nm_so = NULL;
|
||||
saddr = mtod(nmp->nm_nam, struct sockaddr *);
|
||||
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
|
||||
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
|
||||
nmp->nm_soproto);
|
||||
if (error) {
|
||||
nfs_disconnect(nmp);
|
||||
|
@ -557,7 +557,7 @@ tryagain:
|
|||
}
|
||||
so = rep->r_nmp->nm_so;
|
||||
if (!so) {
|
||||
error = nfs_reconnect(rep);
|
||||
error = nfs_reconnect(rep);
|
||||
if (error) {
|
||||
nfs_sndunlock(&rep->r_nmp->nm_flag);
|
||||
return (error);
|
||||
|
@ -771,7 +771,7 @@ nfs_reply(struct nfsreq *myrep)
|
|||
return (error);
|
||||
}
|
||||
m_freem(nam);
|
||||
|
||||
|
||||
/*
|
||||
* Get the xid and check that it is an rpc reply
|
||||
*/
|
||||
|
|
|
@ -520,7 +520,7 @@ nfsm_reqhead(int hsiz)
|
|||
if (hsiz > MLEN)
|
||||
MCLGET(mb, M_WAIT);
|
||||
mb->m_len = 0;
|
||||
|
||||
|
||||
/* Finally, return values */
|
||||
return (mb);
|
||||
}
|
||||
|
@ -981,7 +981,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp,
|
|||
|
||||
/*
|
||||
* If v_type == VNON it is a new node, so fill in the v_type,
|
||||
* n_mtime fields. Check to see if it represents a special
|
||||
* n_mtime fields. Check to see if it represents a special
|
||||
* device, and if so, check for a possible alias. Once the
|
||||
* correct vnode has been obtained, fill in the rest of the
|
||||
* information.
|
||||
|
|
|
@ -248,7 +248,7 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam)
|
|||
else
|
||||
siz = NFS_MAXPACKET;
|
||||
solock(so);
|
||||
error = soreserve(so, siz, siz);
|
||||
error = soreserve(so, siz, siz);
|
||||
if (error) {
|
||||
sounlock(so);
|
||||
m_freem(mynam);
|
||||
|
@ -592,7 +592,7 @@ nfssvc_iod(void *arg)
|
|||
if (nfs_bufqmax > bcstats.kvaslots / 4) {
|
||||
nfs_bufqmax = bcstats.kvaslots / 4;
|
||||
bufcount = 0;
|
||||
}
|
||||
}
|
||||
if (nfs_bufqmax > bcstats.numbufs / 4) {
|
||||
nfs_bufqmax = bcstats.numbufs / 4;
|
||||
bufcount = 0;
|
||||
|
@ -616,7 +616,7 @@ nfssvc_iod(void *arg)
|
|||
(void) nfs_doio(bp, NULL);
|
||||
else do {
|
||||
/*
|
||||
* Look for a delayed write for the same vnode, so I can do
|
||||
* Look for a delayed write for the same vnode, so I can do
|
||||
* it now. We must grab it before calling nfs_doio() to
|
||||
* avoid any risk of the vnode getting vclean()'d while
|
||||
* we are doing the write rpc.
|
||||
|
@ -659,7 +659,7 @@ void
|
|||
nfs_getset_niothreads(int set)
|
||||
{
|
||||
int i, have, start;
|
||||
|
||||
|
||||
for (have = 0, i = 0; i < NFS_MAXASYNCDAEMON; i++)
|
||||
if (nfs_asyncdaemon[i] != NULL)
|
||||
have++;
|
||||
|
|
|
@ -178,7 +178,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
|
|||
}
|
||||
copy_statfs_info(sbp, mp);
|
||||
m_freem(info.nmi_mrep);
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
vput(vp);
|
||||
crfree(cred);
|
||||
return (error);
|
||||
|
@ -245,7 +245,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred,
|
|||
nmp->nm_flag |= NFSMNT_GOTFSINFO;
|
||||
|
||||
m_freem(info.nmi_mrep);
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -589,7 +589,7 @@ nfs_getattr(void *v)
|
|||
if (!error)
|
||||
nfsm_loadattr(vp, ap->a_vap);
|
||||
m_freem(info.nmi_mrep);
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -732,7 +732,7 @@ nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
|
|||
nfsm_loadattr(vp, NULL);
|
||||
|
||||
m_freem(info.nmi_mrep);
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ dorpc:
|
|||
*vpp = newvp;
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
if (error) {
|
||||
/*
|
||||
* We get here only because of errors returned by
|
||||
|
@ -1099,7 +1099,7 @@ nfs_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
|
|||
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -1364,7 +1364,7 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
if (error) {
|
||||
if (newvp)
|
||||
vput(newvp);
|
||||
|
@ -1472,7 +1472,7 @@ again:
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
if (error) {
|
||||
if (newvp) {
|
||||
vput(newvp);
|
||||
|
@ -1623,7 +1623,7 @@ nfs_removerpc(struct vnode *dvp, char *name, int namelen, struct ucred *cred,
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
NFS_INVALIDATE_ATTRCACHE(VTONFS(dvp));
|
||||
|
@ -1741,7 +1741,7 @@ nfs_renamerpc(struct vnode *fdvp, char *fnameptr, int fnamelen,
|
|||
}
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
VTONFS(fdvp)->n_flag |= NMODIFIED;
|
||||
VTONFS(tdvp)->n_flag |= NMODIFIED;
|
||||
if (!fwccflag)
|
||||
|
@ -1803,7 +1803,7 @@ nfs_link(void *v)
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
}
|
||||
m_freem(info.nmi_mrep);
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
pool_put(&namei_pool, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!attrflag)
|
||||
|
@ -1868,7 +1868,7 @@ nfs_symlink(void *v)
|
|||
}
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
if (newvp)
|
||||
vput(newvp);
|
||||
pool_put(&namei_pool, cnp->cn_pnbuf);
|
||||
|
@ -1931,7 +1931,7 @@ nfs_mkdir(void *v)
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
NFS_INVALIDATE_ATTRCACHE(VTONFS(dvp));
|
||||
|
@ -1990,7 +1990,7 @@ nfs_rmdir(void *v)
|
|||
nfsm_wcc_data(dvp, wccflag);
|
||||
m_freem(info.nmi_mrep);
|
||||
|
||||
nfsmout:
|
||||
nfsmout:
|
||||
pool_put(&namei_pool, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
|
@ -2012,7 +2012,7 @@ nfsmout:
|
|||
|
||||
|
||||
/*
|
||||
* The readdir logic below has a big design bug. It stores the NFS cookie in
|
||||
* The readdir logic below has a big design bug. It stores the NFS cookie in
|
||||
* the returned uio->uio_offset but does not store the verifier (it cannot).
|
||||
* Instead, the code stores the verifier in the nfsnode and applies that
|
||||
* verifies to all cookies, no matter what verifier was originally with
|
||||
|
@ -2058,7 +2058,7 @@ nfs_readdir(void *v)
|
|||
/*
|
||||
* First, check for hit on the EOF offset cache
|
||||
*/
|
||||
if (np->n_direofoffset != 0 &&
|
||||
if (np->n_direofoffset != 0 &&
|
||||
uio->uio_offset == np->n_direofoffset) {
|
||||
if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_procp) == 0 &&
|
||||
timespeccmp(&np->n_mtime, &vattr.va_mtime, ==)) {
|
||||
|
|
|
@ -51,7 +51,7 @@ struct nfsm_info {
|
|||
struct mbuf *nmi_mb;
|
||||
caddr_t nmi_dpos;
|
||||
|
||||
int nmi_v3;
|
||||
int nmi_v3;
|
||||
};
|
||||
|
||||
#define nfsm_dissect(a, c, s) { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue