summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-06-05 21:41:48 +0000
committerdg <dg@FreeBSD.org>1998-06-05 21:41:48 +0000
commit6ffbdd6b2ef5cc383625d4dfb241ed44ba5d5df3 (patch)
treeada90fad85de1e7bd6b21e100a2543d414dc5d9f /sys/kern/uipc_mbuf.c
parentff5abf883c9c6ce6eb1460ed1785468bbc47e9e8 (diff)
downloadFreeBSD-src-6ffbdd6b2ef5cc383625d4dfb241ed44ba5d5df3.zip
FreeBSD-src-6ffbdd6b2ef5cc383625d4dfb241ed44ba5d5df3.tar.gz
If we are out of mb_map space and we failed to m_reclaim() anything and
the alloc is not M_DONTWAIT, then panic with "Out of mbuf clusters". Callers that specify M_WAIT can't deal with getting a NULL buffer, so this is a more graceful failure than randomly page faulting in the socket code or elsewhere.
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 567fd81..b033b1e 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
- * $Id: uipc_mbuf.c,v 1.33 1997/12/28 01:01:13 bde Exp $
+ * $Id: uipc_mbuf.c,v 1.34 1998/02/20 13:37:38 bde Exp $
*/
#include <sys/param.h>
@@ -255,10 +255,14 @@ m_retry(i, t)
#define m_retry(i, t) (struct mbuf *)0
MGET(m, i, t);
#undef m_retry
- if (m != NULL)
+ if (m != NULL) {
mbstat.m_wait++;
- else
- mbstat.m_drops++;
+ } else {
+ if (i == M_DONTWAIT)
+ mbstat.m_drops++;
+ else
+ panic("Out of mbuf clusters");
+ }
return (m);
}
@@ -275,10 +279,14 @@ m_retryhdr(i, t)
#define m_retryhdr(i, t) (struct mbuf *)0
MGETHDR(m, i, t);
#undef m_retryhdr
- if (m != NULL)
+ if (m != NULL) {
mbstat.m_wait++;
- else
- mbstat.m_drops++;
+ } else {
+ if (i == M_DONTWAIT)
+ mbstat.m_drops++;
+ else
+ panic("Out of mbuf clusters");
+ }
return (m);
}
OpenPOWER on IntegriCloud