summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2000-12-21 21:44:31 +0000
committerbmilekic <bmilekic@FreeBSD.org>2000-12-21 21:44:31 +0000
commit4b6a7bddad70a11b35893cc1825a768e53fb28c7 (patch)
treecb3615d12a5b91954bedb7d2b4481c994b02b3d6 /sys/nfsserver
parent37eea88efd33920c8d4ef7e41923db5d5eec76cf (diff)
downloadFreeBSD-src-4b6a7bddad70a11b35893cc1825a768e53fb28c7.zip
FreeBSD-src-4b6a7bddad70a11b35893cc1825a768e53fb28c7.tar.gz
* Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.
This is because calls with M_WAIT (now M_TRYWAIT) may not wait forever when nothing is available for allocation, and may end up returning NULL. Hopefully we now communicate more of the right thing to developers and make it very clear that it's necessary to check whether calls with M_(TRY)WAIT also resulted in a failed allocation. M_TRYWAIT basically means "try harder, block if necessary, but don't necessarily wait forever." The time spent blocking is tunable with the kern.ipc.mbuf_wait sysctl. M_WAIT is now deprecated but still defined for the next little while. * Fix a typo in a comment in mbuf.h * Fix some code that was actually passing the mbuf subsystem's M_WAIT to malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the value of the M_WAIT flag, this could have became a big problem.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_serv.c8
-rw-r--r--sys/nfsserver/nfs_srvcache.c4
-rw-r--r--sys/nfsserver/nfs_srvsock.c16
-rw-r--r--sys/nfsserver/nfs_srvsubs.c28
-rw-r--r--sys/nfsserver/nfs_syscalls.c4
-rw-r--r--sys/nfsserver/nfsm_subs.h6
6 files changed, 33 insertions, 33 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index 0334f74..648384e 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -689,8 +689,8 @@ nfsrv_readlink(nfsd, slp, procp, mrq)
len = 0;
i = 0;
while (len < NFS_MAXPATHLEN) {
- MGET(mp, M_WAIT, MT_DATA);
- MCLGET(mp, M_WAIT);
+ MGET(mp, M_TRYWAIT, MT_DATA);
+ MCLGET(mp, M_TRYWAIT);
mp->m_len = NFSMSIZ(mp);
if (len == 0)
mp3 = mp2 = mp;
@@ -940,8 +940,8 @@ nfsrv_read(nfsd, slp, procp, mrq)
i++;
}
if (left > 0) {
- MGET(m, M_WAIT, MT_DATA);
- MCLGET(m, M_WAIT);
+ MGET(m, M_TRYWAIT, MT_DATA);
+ MCLGET(m, M_TRYWAIT);
m->m_len = 0;
m2->m_next = m;
m2 = m;
diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c
index 99fae0e..e7b10dd 100644
--- a/sys/nfsserver/nfs_srvcache.c
+++ b/sys/nfsserver/nfs_srvcache.c
@@ -201,7 +201,7 @@ loop:
} else if (rp->rc_flag & RC_REPMBUF) {
nfsstats.srvcache_nonidemdonehits++;
*repp = m_copym(rp->rc_reply, 0, M_COPYALL,
- M_WAIT);
+ M_TRYWAIT);
ret = RC_REPLY;
} else {
nfsstats.srvcache_idemdonehits++;
@@ -313,7 +313,7 @@ loop:
rp->rc_flag |= RC_REPSTATUS;
} else {
rp->rc_reply = m_copym(repmbuf,
- 0, M_COPYALL, M_WAIT);
+ 0, M_COPYALL, M_TRYWAIT);
rp->rc_flag |= RC_REPMBUF;
}
}
diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c
index f1ace4e..fefeea8 100644
--- a/sys/nfsserver/nfs_srvsock.c
+++ b/sys/nfsserver/nfs_srvsock.c
@@ -590,7 +590,7 @@ tryagain:
goto tryagain;
}
while (rep->r_flags & R_MUSTRESEND) {
- m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
+ m = m_copym(rep->r_mreq, 0, M_COPYALL, M_TRYWAIT);
nfsstats.rpcretries++;
error = nfs_send(so, rep->r_nmp->nm_nam, m, rep);
if (error) {
@@ -1014,7 +1014,7 @@ kerbauth:
* For stream protocols, insert a Sun RPC Record Mark.
*/
if (nmp->nm_sotype == SOCK_STREAM) {
- M_PREPEND(m, NFSX_UNSIGNED, M_WAIT);
+ M_PREPEND(m, NFSX_UNSIGNED, M_TRYWAIT);
*mtod(m, u_int32_t *) = htonl(0x80000000 |
(m->m_pkthdr.len - NFSX_UNSIGNED));
}
@@ -1058,7 +1058,7 @@ tryagain:
if (nmp->nm_soflags & PR_CONNREQUIRED)
error = nfs_sndlock(rep);
if (!error) {
- m2 = m_copym(m, 0, M_COPYALL, M_WAIT);
+ m2 = m_copym(m, 0, M_COPYALL, M_TRYWAIT);
error = nfs_send(nmp->nm_so, nmp->nm_nam, m2, rep);
if (nmp->nm_soflags & PR_CONNREQUIRED)
nfs_sndunlock(rep);
@@ -1237,7 +1237,7 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
caddr_t bpos;
struct mbuf *mb, *mb2;
- MGETHDR(mreq, M_WAIT, MT_DATA);
+ MGETHDR(mreq, M_TRYWAIT, MT_DATA);
mb = mreq;
/*
* If this is a big reply, use a cluster else
@@ -1245,7 +1245,7 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
*/
siz += RPC_REPLYSIZ;
if ((max_hdr + siz) >= MINCLSIZE) {
- MCLGET(mreq, M_WAIT);
+ MCLGET(mreq, M_TRYWAIT);
} else
mreq->m_data += max_hdr;
tl = mtod(mreq, u_int32_t *);
@@ -1686,9 +1686,9 @@ nfs_realign(pm, hsiz)
while ((m = *pm) != NULL) {
if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) {
- MGET(n, M_WAIT, MT_DATA);
+ MGET(n, M_TRYWAIT, MT_DATA);
if (m->m_len >= MINCLSIZE) {
- MCLGET(n, M_WAIT);
+ MCLGET(n, M_TRYWAIT);
}
n->m_len = 0;
break;
@@ -1978,7 +1978,7 @@ nfs_msg(p, server, msg)
* Socket upcall routine for the nfsd sockets.
* The caddr_t arg is a pointer to the "struct nfssvc_sock".
* Essentially do as much as possible non-blocking, else punt and it will
- * be called with M_WAIT from an nfsd.
+ * be called with M_TRYWAIT from an nfsd.
*/
void
nfsrv_rcv(so, arg, waitflag)
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 95138c3..c7e6917 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -588,9 +588,9 @@ nfsm_reqh(vp, procid, hsiz, bposp)
struct nfsmount *nmp;
int nqflag;
- MGET(mb, M_WAIT, MT_DATA);
+ MGET(mb, M_TRYWAIT, MT_DATA);
if (hsiz >= MINCLSIZE)
- MCLGET(mb, M_WAIT);
+ MCLGET(mb, M_TRYWAIT);
mb->m_len = 0;
bpos = mtod(mb, caddr_t);
@@ -646,9 +646,9 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
int siz, grpsiz, authsiz;
authsiz = nfsm_rndup(auth_len);
- MGETHDR(mb, M_WAIT, MT_DATA);
+ MGETHDR(mb, M_TRYWAIT, MT_DATA);
if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) {
- MCLGET(mb, M_WAIT);
+ MCLGET(mb, M_TRYWAIT);
} else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) {
MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED);
} else {
@@ -711,9 +711,9 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
siz = auth_len;
while (siz > 0) {
if (M_TRAILINGSPACE(mb) == 0) {
- MGET(mb2, M_WAIT, MT_DATA);
+ MGET(mb2, M_TRYWAIT, MT_DATA);
if (siz >= MINCLSIZE)
- MCLGET(mb2, M_WAIT);
+ MCLGET(mb2, M_TRYWAIT);
mb->m_next = mb2;
mb = mb2;
mb->m_len = 0;
@@ -744,9 +744,9 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
siz = verf_len;
while (siz > 0) {
if (M_TRAILINGSPACE(mb) == 0) {
- MGET(mb2, M_WAIT, MT_DATA);
+ MGET(mb2, M_TRYWAIT, MT_DATA);
if (siz >= MINCLSIZE)
- MCLGET(mb2, M_WAIT);
+ MCLGET(mb2, M_TRYWAIT);
mb->m_next = mb2;
mb = mb2;
mb->m_len = 0;
@@ -887,9 +887,9 @@ nfsm_uiotombuf(uiop, mq, siz, bpos)
while (left > 0) {
mlen = M_TRAILINGSPACE(mp);
if (mlen == 0) {
- MGET(mp, M_WAIT, MT_DATA);
+ MGET(mp, M_TRYWAIT, MT_DATA);
if (clflg)
- MCLGET(mp, M_WAIT);
+ MCLGET(mp, M_TRYWAIT);
mp->m_len = 0;
mp2->m_next = mp;
mp2 = mp;
@@ -919,7 +919,7 @@ nfsm_uiotombuf(uiop, mq, siz, bpos)
}
if (rem > 0) {
if (rem > M_TRAILINGSPACE(mp)) {
- MGET(mp, M_WAIT, MT_DATA);
+ MGET(mp, M_TRYWAIT, MT_DATA);
mp->m_len = 0;
mp2->m_next = mp;
}
@@ -968,7 +968,7 @@ nfsm_disct(mdp, dposp, siz, left, cp2)
} else if (siz > MHLEN) {
panic("nfs S too big");
} else {
- MGET(mp2, M_WAIT, MT_DATA);
+ MGET(mp2, M_TRYWAIT, MT_DATA);
mp2->m_next = mp->m_next;
mp->m_next = mp2;
mp->m_len -= left;
@@ -1061,9 +1061,9 @@ nfsm_strtmbuf(mb, bpos, cp, siz)
}
/* Loop around adding mbufs */
while (siz > 0) {
- MGET(m1, M_WAIT, MT_DATA);
+ MGET(m1, M_TRYWAIT, MT_DATA);
if (siz > MLEN)
- MCLGET(m1, M_WAIT);
+ MCLGET(m1, M_TRYWAIT);
m1->m_len = NFSMSIZ(m1);
m2->m_next = m1;
m2 = m1;
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index d1a8ead..4eb5c86 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -480,7 +480,7 @@ nfssvc_nfsd(nsd, argp, p)
slp->ns_flag &= ~SLP_NEEDQ;
(void) nfs_slplock(slp, 1);
nfsrv_rcv(slp->ns_so, (caddr_t)slp,
- M_WAIT);
+ M_TRYWAIT);
nfs_slpunlock(slp);
}
error = nfsrv_dorec(slp, nfsd, &nd);
@@ -632,7 +632,7 @@ nfssvc_nfsd(nsd, argp, p)
* Record Mark.
*/
if (sotype == SOCK_STREAM) {
- M_PREPEND(m, NFSX_UNSIGNED, M_WAIT);
+ M_PREPEND(m, NFSX_UNSIGNED, M_TRYWAIT);
*mtod(m, u_int32_t *) = htonl(0x80000000 | siz);
}
if (slp->ns_so->so_proto->pr_flags & PR_CONNREQUIRED)
diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h
index 0990fe4..d58ef15 100644
--- a/sys/nfsserver/nfsm_subs.h
+++ b/sys/nfsserver/nfsm_subs.h
@@ -94,7 +94,7 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
#define nfsm_build(a,c,s) \
do { \
if ((s) > M_TRAILINGSPACE(mb)) { \
- MGET(mb2, M_WAIT, MT_DATA); \
+ MGET(mb2, M_TRYWAIT, MT_DATA); \
if ((s) > MLEN) \
panic("build > MLEN"); \
mb->m_next = mb2; \
@@ -491,8 +491,8 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
if (bp >= be) { \
if (mp == mb) \
mp->m_len += bp-bpos; \
- MGET(mp, M_WAIT, MT_DATA); \
- MCLGET(mp, M_WAIT); \
+ MGET(mp, M_TRYWAIT, MT_DATA); \
+ MCLGET(mp, M_TRYWAIT); \
mp->m_len = NFSMSIZ(mp); \
mp2->m_next = mp; \
mp2 = mp; \
OpenPOWER on IntegriCloud