aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_receiver.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2012-08-01 05:41:01 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-09 08:05:45 -0500
commit92f14951c044198306f098e76c56a944cf88867a (patch)
tree2dc02501ff9736b0691065e859f5eabe2b822828 /drivers/block/drbd/drbd_receiver.c
parentb666dbf819f9157a4afef2094ec961d216d802b5 (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/block/drbd/drbd_receiver.c')
-rw-r--r--drivers/block/drbd/drbd_receiver.c16
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)
881 struct drbd_socket sock, msock; 881 struct drbd_socket sock, msock;
882 struct drbd_conf *mdev; 882 struct drbd_conf *mdev;
883 struct net_conf *nc; 883 struct net_conf *nc;
884 int vnr, timeout, try, h, ok; 884 int vnr, timeout, h, ok;
885 bool discard_my_data; 885 bool discard_my_data;
886 enum drbd_state_rv rv; 886 enum drbd_state_rv rv;
887 struct accept_wait_data ad = { 887 struct accept_wait_data ad = {
@@ -912,15 +912,7 @@ static int conn_connect(struct drbd_tconn *tconn)
912 do { 912 do {
913 struct socket *s; 913 struct socket *s;
914 914
915 for (try = 0;;) { 915 s = drbd_try_connect(tconn);
916 /* 3 tries, this should take less than a second! */
917 s = drbd_try_connect(tconn);
918 if (s || ++try >= 3)
919 break;
920 /* give the other side time to call bind() & listen() */
921 schedule_timeout_interruptible(HZ / 10);
922 }
923
924 if (s) { 916 if (s) {
925 if (!sock.socket) { 917 if (!sock.socket) {
926 sock.socket = s; 918 sock.socket = s;
@@ -949,10 +941,10 @@ static int conn_connect(struct drbd_tconn *tconn)
949retry: 941retry:
950 s = drbd_wait_for_connect(tconn, &ad); 942 s = drbd_wait_for_connect(tconn, &ad);
951 if (s) { 943 if (s) {
952 try = receive_first_packet(tconn, s); 944 int fp = receive_first_packet(tconn, s);
953 drbd_socket_okay(&sock.socket); 945 drbd_socket_okay(&sock.socket);
954 drbd_socket_okay(&msock.socket); 946 drbd_socket_okay(&msock.socket);
955 switch (try) { 947 switch (fp) {
956 case P_INITIAL_DATA: 948 case P_INITIAL_DATA:
957 if (sock.socket) { 949 if (sock.socket) {
958 conn_warn(tconn, "initial packet S crossed\n"); 950 conn_warn(tconn, "initial packet S crossed\n");