summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-08-25 13:59:16 +0000
committerbluhm <bluhm@openbsd.org>2016-08-25 13:59:16 +0000
commit5f0bfc4311544d6042e3fc34335e653cef9ba414 (patch)
tree82e5ac7ebb8b5b3aa4dd391fc11d2b4e32342a59
parentSimplify ip6_getpmtu() to use a 'struct rtentry *' instead of two (diff)
downloadwireguard-openbsd-5f0bfc4311544d6042e3fc34335e653cef9ba414.tar.xz
wireguard-openbsd-5f0bfc4311544d6042e3fc34335e653cef9ba414.zip
Completely revert the M_WAIT change on the cluster allocation and
bring back the behaviour of rev 1.72. Although allocating small mbufs when allocating an mbuf cluster fails seems suboptimal, this should not be changed as a side effect when introducing m_getuio(). OK claudio@
-rw-r--r--sys/kern/uipc_socket.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 498c5c28b48..70079038b0a 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.153 2016/08/22 10:23:42 claudio Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.154 2016/08/25 13:59:16 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -542,14 +542,9 @@ m_getuio(struct mbuf **mp, int atomic, long space, struct uio *uio)
resid = ulmin(resid, space);
if (resid >= MINCLSIZE) {
- mlen = ulmin(resid, MAXMCLBYTES);
- MCLGETI(m, M_NOWAIT, NULL, mlen);
-
- if ((m->m_flags & M_EXT) == 0) {
- /* should not happen */
- m_freem(top);
- return (ENOBUFS);
- }
+ MCLGETI(m, M_NOWAIT, NULL, ulmin(resid, MAXMCLBYTES));
+ if ((m->m_flags & M_EXT) == 0)
+ goto nopages;
mlen = m->m_ext.ext_size;
len = ulmin(mlen, resid);
/*
@@ -559,6 +554,7 @@ m_getuio(struct mbuf **mp, int atomic, long space, struct uio *uio)
if (atomic && top == NULL && len < mlen - max_hdr)
m->m_data += max_hdr;
} else {
+nopages:
len = ulmin(mlen, resid);
/*
* For datagram protocols, leave room