diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2012-08-01 11:41:01 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-09 14:05:45 +0100 |
commit | 92f14951c044198306f098e76c56a944cf88867a (patch) | |
tree | 2dc02501ff9736b0691065e859f5eabe2b822828 /drivers | |
parent | b666dbf819f9157a4afef2094ec961d216d802b5 (diff) |
drbd: Try to connec to peer only once per cycle
Since now our listening socket is open all the time we will get
connection tries of the peer always in. No need to try it three
times.
This is valid when connecting to older peers as well, it simply
increases the probability that the new version DRBD will accept
a connection instead that it will establish one.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 855cadfe6146..1567e9bb9bde 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -881,7 +881,7 @@ static int conn_connect(struct drbd_tconn *tconn) struct drbd_socket sock, msock; struct drbd_conf *mdev; struct net_conf *nc; - int vnr, timeout, try, h, ok; + int vnr, timeout, h, ok; bool discard_my_data; enum drbd_state_rv rv; struct accept_wait_data ad = { @@ -912,15 +912,7 @@ static int conn_connect(struct drbd_tconn *tconn) do { struct socket *s; - for (try = 0;;) { - /* 3 tries, this should take less than a second! */ - s = drbd_try_connect(tconn); - if (s || ++try >= 3) - break; - /* give the other side time to call bind() & listen() */ - schedule_timeout_interruptible(HZ / 10); - } - + s = drbd_try_connect(tconn); if (s) { if (!sock.socket) { sock.socket = s; @@ -949,10 +941,10 @@ static int conn_connect(struct drbd_tconn *tconn) retry: s = drbd_wait_for_connect(tconn, &ad); if (s) { - try = receive_first_packet(tconn, s); + int fp = receive_first_packet(tconn, s); drbd_socket_okay(&sock.socket); drbd_socket_okay(&msock.socket); - switch (try) { + switch (fp) { case P_INITIAL_DATA: if (sock.socket) { conn_warn(tconn, "initial packet S crossed\n"); |