Blame SOURCES/glibc-fix-test-write-buf-size.patch

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