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

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