Author: eelco
Date: 2010-06-20 20:52:08 +0000 (Sun, 20 Jun 2010)
New Revision: 22347

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22347&view=rev

Added:
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/cifs-timeout.patch
Modified:
   nixpkgs/trunk/pkgs/build-support/vm/default.nix
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/patches.nix

Log:
* In the VM tests, apply a patch to increase the 15s timeout on CIFS
  operations to 120s.  This is necessary if the host is heavily
  loaded.  For instance, in the Hydra build farm, if there are many
  concurrent jobs, VM builds often fail because they hit the timeout.


Changes:

Modified: nixpkgs/trunk/pkgs/build-support/vm/default.nix
===================================================================
--- nixpkgs/trunk/pkgs/build-support/vm/default.nix     2010-06-20 19:22:23 UTC 
(rev 22346)
+++ nixpkgs/trunk/pkgs/build-support/vm/default.nix     2010-06-20 20:52:08 UTC 
(rev 22347)
@@ -4,7 +4,12 @@
 
 rec {
 
-  inherit (linuxPackages_2_6_32) kernel;
+  # The 15 second CIFS timeout is too short if the host if heavily
+  # loaded (e.g., in the Hydra build farm when it's running many jobs
+  # in parallel).  So apply a patch to increase the timeout to 120s.
+  kernel = pkgs.linux.override (orig: {
+    kernelPatches = orig.kernelPatches ++ [ kernelPatches.cifs_timeout ];
+  });
 
   kvm = pkgs.qemu_kvm;
 
@@ -135,10 +140,8 @@
     mkdir -p /fs/dev
     mount -o bind /dev /fs/dev
 
-    for ((n = 0; n < 10; n++)); do
-      echo "mounting host filesystem, attempt $n..."
-      mount -t cifs //10.0.2.4/qemu /fs/hostfs -o guest,username=nobody && 
break
-    done
+    echo "mounting host filesystem..."
+    mount -t cifs //10.0.2.4/qemu /fs/hostfs -o guest,username=nobody
 
     mkdir -p /fs/nix/store
     mount -o bind /fs/hostfs/nix/store /fs/nix/store
@@ -225,7 +228,6 @@
 
 
   startSamba =
-    let sambaScript = writeScript "run-smbd" "while ${samba}/sbin/smbd -s 
$TMPDIR/smb.conf; do true; done"; in
     ''
       cat > $TMPDIR/smb.conf <<SMB
       [global]
@@ -244,7 +246,7 @@
       SMB
 
       rm -f ./samba
-      ${socat}/bin/socat unix-listen:./samba exec:'/bin/sh -c 
${sambaScript}',nofork > /dev/null 2>&1 &
+      ${socat}/bin/socat unix-listen:./samba exec:'${samba}/sbin/smbd -s 
$TMPDIR/smb.conf',nofork > /dev/null 2>&1 &
       while [ ! -e ./samba ]; do sleep 0.1; done # ugly
     '';
 

Added: nixpkgs/trunk/pkgs/os-specific/linux/kernel/cifs-timeout.patch
===================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/cifs-timeout.patch              
                (rev 0)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/cifs-timeout.patch      
2010-06-20 20:52:08 UTC (rev 22347)
@@ -0,0 +1,47 @@
+diff -ru -x '*~' /tmp/linux-2.6.32.14/fs/cifs/transport.c 
linux-2.6.32.14/fs/cifs/transport.c
+--- /tmp/linux-2.6.32.14/fs/cifs/transport.c   2010-05-26 23:29:57.000000000 
+0200
++++ linux-2.6.32.14/fs/cifs/transport.c        2010-06-20 22:03:13.000000000 
+0200
+@@ -166,9 +166,9 @@
+                          after the retries we will kill the socket and
+                          reconnect which may clear the network problem.
+                       */
+-                      if ((i >= 14) || (!server->noblocksnd && (i > 2))) {
++                      if ((i >= 119) || (!server->noblocksnd && (i > 2))) {
+                               cERROR(1,
+-                                 ("sends on sock %p stuck for 15 seconds",
++                                 ("sends on sock %p stuck for 120 seconds",
+                                   ssocket));
+                               rc = -EAGAIN;
+                               break;
+@@ -459,11 +459,11 @@
+               goto out;
+ 
+       if (long_op == CIFS_STD_OP)
+-              timeout = 15 * HZ;
++              timeout = 120 * HZ;
+       else if (long_op == CIFS_VLONG_OP) /* e.g. slow writes past EOF */
+               timeout = 180 * HZ;
+       else if (long_op == CIFS_LONG_OP)
+-              timeout = 45 * HZ; /* should be greater than
++              timeout = 120 * HZ; /* should be greater than
+                       servers oplock break timeout (about 43 seconds) */
+       else if (long_op == CIFS_ASYNC_OP)
+               goto out;
+@@ -651,7 +651,7 @@
+               goto out;
+ 
+       if (long_op == CIFS_STD_OP)
+-              timeout = 15 * HZ;
++              timeout = 120 * HZ;
+       /* wait for 15 seconds or until woken up due to response arriving or
+          due to last connection to this server being unmounted */
+       else if (long_op == CIFS_ASYNC_OP)
+@@ -659,7 +659,7 @@
+       else if (long_op == CIFS_VLONG_OP) /* writes past EOF can be slow */
+               timeout = 180 * HZ;
+       else if (long_op == CIFS_LONG_OP)
+-              timeout = 45 * HZ; /* should be greater than
++              timeout = 120 * HZ; /* should be greater than
+                       servers oplock break timeout (about 43 seconds) */
+       else if (long_op == CIFS_BLOCKING_OP)
+               timeout = 0x7FFFFFFF; /* large but no so large as to wrap */

Modified: nixpkgs/trunk/pkgs/os-specific/linux/kernel/patches.nix
===================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/patches.nix     2010-06-20 
19:22:23 UTC (rev 22346)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/patches.nix     2010-06-20 
20:52:08 UTC (rev 22347)
@@ -155,4 +155,11 @@
       features.aufsBase = true;
     };
 
+  # Increase the timeout on CIFS requests from 15 to 120 seconds to
+  # make CIFS more resilient to high load on the CIFS server.
+  cifs_timeout =
+    { name = "cifs-timeout";
+      patch = ./cifs-timeout.patch;
+    };
+  
 }

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to