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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to