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

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