Commit 92f14951 authored by Philipp Reisner's avatar Philipp Reisner

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: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent b666dbf8
...@@ -881,7 +881,7 @@ static int conn_connect(struct drbd_tconn *tconn) ...@@ -881,7 +881,7 @@ static int conn_connect(struct drbd_tconn *tconn)
struct drbd_socket sock, msock; struct drbd_socket sock, msock;
struct drbd_conf *mdev; struct drbd_conf *mdev;
struct net_conf *nc; struct net_conf *nc;
int vnr, timeout, try, h, ok; int vnr, timeout, h, ok;
bool discard_my_data; bool discard_my_data;
enum drbd_state_rv rv; enum drbd_state_rv rv;
struct accept_wait_data ad = { struct accept_wait_data ad = {
...@@ -912,15 +912,7 @@ static int conn_connect(struct drbd_tconn *tconn) ...@@ -912,15 +912,7 @@ static int conn_connect(struct drbd_tconn *tconn)
do { do {
struct socket *s; struct socket *s;
for (try = 0;;) { s = drbd_try_connect(tconn);
/* 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);
}
if (s) { if (s) {
if (!sock.socket) { if (!sock.socket) {
sock.socket = s; sock.socket = s;
...@@ -949,10 +941,10 @@ static int conn_connect(struct drbd_tconn *tconn) ...@@ -949,10 +941,10 @@ static int conn_connect(struct drbd_tconn *tconn)
retry: retry:
s = drbd_wait_for_connect(tconn, &ad); s = drbd_wait_for_connect(tconn, &ad);
if (s) { if (s) {
try = receive_first_packet(tconn, s); int fp = receive_first_packet(tconn, s);
drbd_socket_okay(&sock.socket); drbd_socket_okay(&sock.socket);
drbd_socket_okay(&msock.socket); drbd_socket_okay(&msock.socket);
switch (try) { switch (fp) {
case P_INITIAL_DATA: case P_INITIAL_DATA:
if (sock.socket) { if (sock.socket) {
conn_warn(tconn, "initial packet S crossed\n"); conn_warn(tconn, "initial packet S crossed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment