arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
Blob Blame History Raw
# This patch fixes tst-cancel4, tst-cancel5, tst-cancelx4 and tst-cancelx5
# failures on newer kernels where the write buffers are larger. 
#
# commit e7074e4c5edb0acaa979ea08e533736f906a9d68
# Author: David S. Miller <davem@davemloft.net>
# Date:   Tue Jul 23 02:31:37 2013 -0700
# 
#     Increase nptl test case buffer size so we really block on current Linux kernels.
#     
#         * tst-cancel4.c (WRITE_BUFFER_SIZE): Increase to 16384.
# 
# commit 135529b443631f840cc66d0cc395f79c416434d9
# Author: David S. Miller <davem@davemloft.net>
# Date:   Tue Jul 23 11:31:39 2013 -0700
# 
#     Remove Linux kernel version ambiguity in comment added by previous commit.
#     
#         * tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
# 
diff -urN glibc-2.17-c758a686/nptl/tst-cancel4.c glibc-2.17-c758a686/nptl/tst-cancel4.c
--- glibc-2.17-c758a686/nptl/tst-cancel4.c	2014-07-25 22:07:09.130021164 -0400
+++ glibc-2.17-c758a686/nptl/tst-cancel4.c	2014-07-25 22:12:07.580022919 -0400
@@ -83,7 +83,30 @@
 # define IPC_ADDVAL 0
 #endif
 
-#define WRITE_BUFFER_SIZE 4096
+/* The WRITE_BUFFER_SIZE value needs to be choosen such that if we set
+   the socket send buffer size to '1', a write of this size on that
+   socket will block.
+
+   The Linux kernel imposes a minimum send socket buffer size which
+   has changed over the years.  As of Linux 3.10 the value is:
+
+     2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff)))
+
+   which is attempting to make sure that with standard MTUs,
+   TCP can always queue up at least 2 full sized packets.
+
+   Furthermore, there is logic in the socket send paths that
+   will allow one more packet (of any size) to be queued up as
+   long as some socket buffer space remains.   Blocking only
+   occurs when we try to queue up a new packet and the send
+   buffer space has already been fully consumed.
+
+   Therefore we must set this value to the largest possible value of
+   the formula above (and since it depends upon the size of "struct
+   sk_buff", it is dependent upon machine word size etc.) plus some
+   slack space.  */
+
+#define WRITE_BUFFER_SIZE 16384
 
 /* Cleanup handling test.  */
 static int cl_called;