olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

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

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