Date: Mon, 22 Jan 2007 10:54:33 -0500 From: John Baldwin <jhb@freebsd.org> To: Andre Oppermann <andre@freebsd.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern uipc_socket.c Message-ID: <200701221054.33982.jhb@freebsd.org> In-Reply-To: <45B4D1AF.9070101@freebsd.org> References: <200611021745.kA2HjSZC018731@repoman.freebsd.org> <200701121206.47308.jhb@freebsd.org> <45B4D1AF.9070101@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 22 January 2007 10:01, Andre Oppermann wrote: > John Baldwin wrote: > > Also, you've introduced another regression in that if the m_get2m() fails it > > should be returning ENOBUFS and not EFAULT to userland. The comments in > > sosend_*() about 'EFAULT being the only possible error' are obviously > > wrong. :) > > We're always calling with M_WAITOK because we're coming from userland and > may sleep forever. Bah, ok. I was confused because I guess TRYWAIT can't return NULL anymore, but sosend_copyin() still has: MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; } although it would seem that the ZERO_COPY_SOCKETS code just needs to be updated. Maybe like so: Index: uipc_socket.c =================================================================== RCS file: /usr/cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.288 diff -u -r1.288 uipc_socket.c --- uipc_socket.c 8 Jan 2007 17:49:59 -0000 1.288 +++ uipc_socket.c 22 Jan 2007 15:52:06 -0000 @@ -857,20 +857,11 @@ if (resid >= MINCLSIZE) { #ifdef ZERO_COPY_SOCKETS if (top == NULL) { - MGETHDR(m, M_TRYWAIT, MT_DATA); - if (m == NULL) { - error = ENOBUFS; - goto out; - } + m = m_gethdr(M_TRYWAIT, MT_DATA); m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = NULL; - } else { - MGET(m, M_TRYWAIT, MT_DATA); - if (m == NULL) { - error = ENOBUFS; - goto out; - } - } + } else + m = m_get(M_TRYWAIT, MT_DATA); if (so_zero_copy_send && resid>=PAGE_SIZE && *space>=PAGE_SIZE && @@ -881,14 +872,8 @@ len = cow_send; } if (!cow_send) { - MCLGET(m, M_TRYWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - m = NULL; - } else { - len = min(min(MCLBYTES, resid), - *space); - } + m_clget(m, M_TRYWAIT); + len = min(min(MCLBYTES, resid), *space); } #else /* ZERO_COPY_SOCKETS */ if (top == NULL) { -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701221054.33982.jhb>