From: Ronnie Sahlberg Date: Tue, 10 Jul 2007 00:24:20 +0000 (+1000) Subject: make it possible to specify how many times ctdb killtcp will try to RST X-Git-Tag: tevent-0.9.20~348^2~2462^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d81bca20729759e357ed61781454b601fdb58686;p=thirdparty%2Fsamba.git make it possible to specify how many times ctdb killtcp will try to RST 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 (This used to be ctdb commit d81616214752882242f2886e94681972a790db80) --- diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index 5d03b7c75db..7a7dcd389bd 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -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 diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 371f6e867a6..4e0378d7b9c 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -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;iev, &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", " " }, + { "killtcp", kill_tcp, false, "kill a tcp connection. Try times.", " " }, { "tickle", tickle_tcp, false, "send a tcp tickle ack", " " }, };