diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2014-03-18 14:40:13 +0100 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-07-10 18:35:00 +0200 |
commit | 4920e37a9e851172158ecc0fd7e060712dc1b5e8 (patch) | |
tree | 807be93fb5bace3b1ff596a2338736c867a7e590 /drivers | |
parent | aaaba34576407857f6146ff6c330f06e63fb2bf2 (diff) | |
download | linux-4920e37a9e851172158ecc0fd7e060712dc1b5e8.tar.gz linux-4920e37a9e851172158ecc0fd7e060712dc1b5e8.tar.bz2 linux-4920e37a9e851172158ecc0fd7e060712dc1b5e8.zip |
drbd: Limit the time we are waiting for the first packet on an accepted socket
Before the patch
'drbd: Keep the listening socket open while trying to connect to the peer'
the newly created socket inherited the receive timeout from the listen
socket. The listen socket had a receive timeout of connect-intervall
+- 30% random jitter.
The real issue is that after the mentioned patch we had no timeout at all.
Now use 4 times the ping-timeout.
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 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index d326af67c27e..7da83f3a61eb 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -791,8 +791,18 @@ static int receive_first_packet(struct drbd_connection *connection, struct socke { unsigned int header_size = drbd_header_size(connection); struct packet_info pi; + struct net_conf *nc; int err; + rcu_read_lock(); + nc = rcu_dereference(connection->net_conf); + if (!nc) { + rcu_read_unlock(); + return -EIO; + } + sock->sk->sk_rcvtimeo = nc->ping_timeo * 4 * HZ / 10; + rcu_read_unlock(); + err = drbd_recv_short(sock, connection->data.rbuf, header_size, 0); if (err != header_size) { if (err >= 0) |