Now that we have a non blocking version of nfsm_dissect(), change all the

nfsm_dissect() calls (done under the NFSD lock) to nfsm_dissect_nonblock().

Submitted by:	Mohan Srinivasan
This commit is contained in:
ps 2005-01-19 22:53:40 +00:00
parent 82659e8246
commit 09169053be
3 changed files with 41 additions and 41 deletions

View File

@ -189,7 +189,7 @@ nfsrv3_access(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
panic("nfsrv3_access: v3 proc called on a v2 connection");
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly, TRUE);
if (error) {
nfsm_reply(NFSX_UNSIGNED);
@ -343,14 +343,14 @@ nfsrv_setattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
VATTR_NULL(vap);
if (v3) {
nfsm_srvsattr(vap);
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
gcheck = fxdr_unsigned(int, *tl);
if (gcheck) {
tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 2 * NFSX_UNSIGNED);
fxdr_nfsv3time(tl, &guard);
}
} else {
sp = nfsm_dissect(struct nfsv2_sattr *, NFSX_V2SATTR);
sp = nfsm_dissect_nonblock(struct nfsv2_sattr *, NFSX_V2SATTR);
/*
* Nah nah nah nah na nah
* There is a bug in the Sun client that puts 0xffff in the mode
@ -830,10 +830,10 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
if (v3) {
tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 2 * NFSX_UNSIGNED);
off = fxdr_hyper(tl);
} else {
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
off = (off_t)fxdr_unsigned(u_int32_t, *tl);
}
nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd));
@ -1115,12 +1115,12 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
mtx_unlock(&Giant); /* VFS */
NFSD_LOCK();
if (v3) {
tl = nfsm_dissect(u_int32_t *, 5 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 5 * NFSX_UNSIGNED);
off = fxdr_hyper(tl);
tl += 3;
stable = fxdr_unsigned(int, *tl++);
} else {
tl = nfsm_dissect(u_int32_t *, 4 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 4 * NFSX_UNSIGNED);
off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
tl += 2;
if (nfs_async)
@ -1358,12 +1358,12 @@ nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp,
*/
nfsm_srvmtofh(&nfsd->nd_fh);
if (v3) {
tl = nfsm_dissect(u_int32_t *, 5 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 5 * NFSX_UNSIGNED);
nfsd->nd_off = fxdr_hyper(tl);
tl += 3;
nfsd->nd_stable = fxdr_unsigned(int, *tl++);
} else {
tl = nfsm_dissect(u_int32_t *, 4 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 4 * NFSX_UNSIGNED);
nfsd->nd_off = (off_t)fxdr_unsigned(u_int32_t, *++tl);
tl += 2;
if (nfs_async)
@ -1791,7 +1791,7 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
VATTR_NULL(vap);
if (v3) {
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
how = fxdr_unsigned(int, *tl);
switch (how) {
case NFSV3CREATE_GUARDED:
@ -1804,14 +1804,14 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nfsm_srvsattr(vap);
break;
case NFSV3CREATE_EXCLUSIVE:
cp = nfsm_dissect(caddr_t, NFSX_V3CREATEVERF);
cp = nfsm_dissect_nonblock(caddr_t, NFSX_V3CREATEVERF);
bcopy(cp, cverf, NFSX_V3CREATEVERF);
exclusive_flag = 1;
break;
};
vap->va_type = VREG;
} else {
sp = nfsm_dissect(struct nfsv2_sattr *, NFSX_V2SATTR);
sp = nfsm_dissect_nonblock(struct nfsv2_sattr *, NFSX_V2SATTR);
vap->va_type = IFTOVT(fxdr_unsigned(u_int32_t, sp->sa_mode));
if (vap->va_type == VNON)
vap->va_type = VREG;
@ -2069,7 +2069,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
error = 0;
goto nfsmout;
}
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
vtyp = nfsv3tov_type(*tl);
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
error = NFSERR_BADTYPE;
@ -2078,7 +2078,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
VATTR_NULL(vap);
nfsm_srvsattr(vap);
if (vtyp == VCHR || vtyp == VBLK) {
tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 2 * NFSX_UNSIGNED);
major = fxdr_unsigned(u_int32_t, *tl++);
minor = fxdr_unsigned(u_int32_t, *tl);
vap->va_rdev = makedev(major, minor);
@ -2820,7 +2820,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
io.uio_td = NULL;
nfsm_mtouio(&io, len2);
if (!v3) {
sp = nfsm_dissect(struct nfsv2_sattr *, NFSX_V2SATTR);
sp = nfsm_dissect_nonblock(struct nfsv2_sattr *, NFSX_V2SATTR);
vap->va_mode = nfstov_mode(sp->sa_mode);
}
*(pathcp + len2) = '\0';
@ -3005,7 +3005,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
if (v3) {
nfsm_srvsattr(vap);
} else {
tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, NFSX_UNSIGNED);
vap->va_mode = nfstov_mode(*tl++);
}
@ -3324,13 +3324,13 @@ nfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
if (v3) {
tl = nfsm_dissect(u_int32_t *, 5 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 5 * NFSX_UNSIGNED);
toff = fxdr_hyper(tl);
tl += 2;
verf = fxdr_hyper(tl);
tl += 2;
} else {
tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 2 * NFSX_UNSIGNED);
toff = fxdr_unsigned(u_quad_t, *tl++);
verf = 0; /* shut up gcc */
}
@ -3645,7 +3645,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
panic("nfsrv_readdirplus: v3 proc called on a v2 connection");
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
tl = nfsm_dissect(u_int32_t *, 6 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 6 * NFSX_UNSIGNED);
toff = fxdr_hyper(tl);
tl += 2;
verf = fxdr_hyper(tl);
@ -4012,7 +4012,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
(void) vn_start_write(NULL, &mp, V_WAIT);
mtx_unlock(&Giant); /* VFS */
NFSD_LOCK();
tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 3 * NFSX_UNSIGNED);
/*
* XXX At this time VOP_FSYNC() does not accept offset and byte

View File

@ -297,14 +297,14 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header)
md = nd->nd_md;
dpos = nd->nd_dpos;
if (has_header) {
tl = nfsm_dissect(u_int32_t *, 10 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 10 * NFSX_UNSIGNED);
nd->nd_retxid = fxdr_unsigned(u_int32_t, *tl++);
if (*tl++ != nfsrv_rpc_call) {
m_freem(mrep);
return (EBADRPC);
}
} else
tl = nfsm_dissect(u_int32_t *, 8 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 8 * NFSX_UNSIGNED);
nd->nd_repstat = 0;
nd->nd_flag = 0;
if (*tl++ != nfsrv_rpc_vers) {
@ -360,7 +360,7 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header)
return (EBADRPC);
}
nfsm_adv(nfsm_rndup(len));
tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, 3 * NFSX_UNSIGNED);
/*
* XXX: This credential should be managed using crget(9)
* and related calls. Right now, this tramples on any
@ -377,7 +377,7 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header)
m_freem(mrep);
return (EBADRPC);
}
tl = nfsm_dissect(u_int32_t *, (len + 2) * NFSX_UNSIGNED);
tl = nfsm_dissect_nonblock(u_int32_t *, (len + 2) * NFSX_UNSIGNED);
for (i = 1; i <= len; i++)
if (i < NGROUPS)
nd->nd_cr.cr_groups[i] = fxdr_unsigned(gid_t, *tl++);

View File

@ -1317,7 +1317,7 @@ nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos)
NFSD_LOCK_DONTCARE();
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
*s = fxdr_unsigned(int32_t, *tl);
@ -1333,7 +1333,7 @@ nfsm_srvnamesiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos)
NFSD_LOCK_DONTCARE();
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
*s = fxdr_unsigned(int32_t, *tl);
@ -1385,7 +1385,7 @@ nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, struct mbuf **md,
NFSD_LOCK_DONTCARE();
if (nfsd->nd_flag & ND_NFSV3) {
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
fhlen = fxdr_unsigned(int, *tl);
@ -1395,7 +1395,7 @@ nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, struct mbuf **md,
fhlen = NFSX_V2FH;
}
if (fhlen != 0) {
tl = nfsm_dissect_xx(fhlen, md, dpos);
tl = nfsm_dissect_xx_nonblock(fhlen, md, dpos);
if (tl == NULL)
return EBADRPC;
bcopy((caddr_t)tl, (caddr_t)(f), fhlen);
@ -1412,48 +1412,48 @@ nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos)
NFSD_LOCK_DONTCARE();
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
if (*tl == nfsrv_nfs_true) {
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
(a)->va_mode = nfstov_mode(*tl);
}
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
if (*tl == nfsrv_nfs_true) {
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
(a)->va_uid = fxdr_unsigned(uid_t, *tl);
}
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
if (*tl == nfsrv_nfs_true) {
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
(a)->va_gid = fxdr_unsigned(gid_t, *tl);
}
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
if (*tl == nfsrv_nfs_true) {
tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(2 * NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
(a)->va_size = fxdr_hyper(tl);
}
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
switch (fxdr_unsigned(int, *tl)) {
case NFSV3SATTRTIME_TOCLIENT:
tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(2 * NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
fxdr_nfsv3time(tl, &(a)->va_atime);
@ -1462,12 +1462,12 @@ nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos)
getnanotime(&(a)->va_atime);
break;
}
tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
switch (fxdr_unsigned(int, *tl)) {
case NFSV3SATTRTIME_TOCLIENT:
tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos);
tl = nfsm_dissect_xx_nonblock(2 * NFSX_UNSIGNED, md, dpos);
if (tl == NULL)
return EBADRPC;
fxdr_nfsv3time(tl, &(a)->va_mtime);