make it possible to specify how many times ctdb killtcp will try to RST
authorRonnie Sahlberg <sahlberg@ronnie>
Tue, 10 Jul 2007 00:24:20 +0000 (10:24 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Tue, 10 Jul 2007 00:24:20 +0000 (10:24 +1000)
the tcp connection

change the 60.nfs script to run ctdb killtcp in the foreground so we
dont get lots of these running in parallel when there are a lot of tcp
connections to rst

config/events.d/60.nfs
tools/ctdb.c

index 5d03b7c75db8700fd7d02255a0fdae8868aee7bd..7a7dcd389bdca70482fca98f08689ed6d93448b2 100755 (executable)
@@ -70,8 +70,8 @@ case $cmd in
                        srcport=`echo $src | cut -d: -f2`
                        destip=`echo $dest | cut -d: -f1`
                        destport=`echo $dest | cut -d: -f2`
-                       ctdb killtcp $srcip:$srcport $destip:$destport >/dev/null 2>&1 &
-                       ctdb killtcp $destip:$destport $srcip:$srcport >/dev/null 2>&1 &
+                       ctdb killtcp $srcip:$srcport $destip:$destport 1 >/dev/null 2>&1 
+                       ctdb killtcp $destip:$destport $srcip:$srcport 1 >/dev/null 2>&1
                done
        } > /dev/null 2>&1
        /bin/rm -f /etc/ctdb/state/nfs/restart
index 371f6e867a6699e20136b81d61b922b65cb1d1ef..4e0378d7b9c99ed903378408165b351946da50dd 100644 (file)
@@ -308,10 +308,10 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
  */
 static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
 {
-       int i, ret;
+       int i, ret, numrst;
        struct sockaddr_in src, dst;
 
-       if (argc < 2) {
+       if (argc < 3) {
                usage();
        }
 
@@ -325,7 +325,9 @@ static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
                return -1;
        }
 
-       for (i=0;i<5;i++) {
+       numrst = strtoul(argv[2], NULL, 0);
+
+       for (i=0;i<numrst;i++) {
                ret = ctdb_sys_kill_tcp(ctdb->ev, &src, &dst);
 
                printf("ret:%d\n", ret);
@@ -889,7 +891,7 @@ static const struct {
        { "recover",         control_recover,           true,  "force recovery" },
        { "freeze",          control_freeze,            true,  "freeze all databases" },
        { "thaw",            control_thaw,              true,  "thaw all databases" },
-       { "killtcp",         kill_tcp,                  false, "kill a tcp connection", "<srcip:port> <dstip:port>" },
+       { "killtcp",         kill_tcp,                  false, "kill a tcp connection. Try <num> times.", "<srcip:port> <dstip:port> <num>" },
        { "tickle",          tickle_tcp,                false, "send a tcp tickle ack", "<srcip:port> <dstip:port>" },
 };