aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-05-10 18:26:00 -0400
committerDavid Howells <dhowells@redhat.com>2018-05-10 18:26:00 -0400
commitc54e43d752c7187595c8c62a231e0b0d53c7fded (patch)
tree3e813d2af3416daf069285dbaefced6e2cc89982
parent4a026da91caaa36004a53a844dd00959370ea8fc (diff)
rxrpc: Fix missing start of call timeout
The expect_rx_by call timeout is supposed to be set when a call is started to indicate that we need to receive a packet by that point. This is currently put back every time we receive a packet, but it isn't started when we first send a packet. Without this, the call may wait forever if the server doesn't deign to reply. Fix this by setting the timeout upon a successful UDP sendmsg call for the first DATA packet. The timeout is initiated only for initial transmission and not for subsequent retries as we don't want the retry mechanism to extend the timeout indefinitely. Fixes: a158bdd3247b ("rxrpc: Fix call timeouts") Reported-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--net/rxrpc/ar-internal.h1
-rw-r--r--net/rxrpc/input.c2
-rw-r--r--net/rxrpc/output.c11
-rw-r--r--net/rxrpc/sendmsg.c10
4 files changed, 23 insertions, 1 deletions
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 90d7079e0aa9..19975d2ca9a2 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -476,6 +476,7 @@ enum rxrpc_call_flag {
476 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ 476 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
477 RXRPC_CALL_PINGING, /* Ping in process */ 477 RXRPC_CALL_PINGING, /* Ping in process */
478 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ 478 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
479 RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */
479}; 480};
480 481
481/* 482/*
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 0410d2277ca2..b5fd6381313d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -971,7 +971,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
971 if (timo) { 971 if (timo) {
972 unsigned long now = jiffies, expect_rx_by; 972 unsigned long now = jiffies, expect_rx_by;
973 973
974 expect_rx_by = jiffies + timo; 974 expect_rx_by = now + timo;
975 WRITE_ONCE(call->expect_rx_by, expect_rx_by); 975 WRITE_ONCE(call->expect_rx_by, expect_rx_by);
976 rxrpc_reduce_call_timer(call, expect_rx_by, now, 976 rxrpc_reduce_call_timer(call, expect_rx_by, now,
977 rxrpc_timer_set_for_normal); 977 rxrpc_timer_set_for_normal);
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 7f1fc04775b3..6b9d27f0d7ec 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -414,6 +414,17 @@ done:
414 rxrpc_timer_set_for_lost_ack); 414 rxrpc_timer_set_for_lost_ack);
415 } 415 }
416 } 416 }
417
418 if (sp->hdr.seq == 1 &&
419 !test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER,
420 &call->flags)) {
421 unsigned long nowj = jiffies, expect_rx_by;
422
423 expect_rx_by = nowj + call->next_rx_timo;
424 WRITE_ONCE(call->expect_rx_by, expect_rx_by);
425 rxrpc_reduce_call_timer(call, expect_rx_by, nowj,
426 rxrpc_timer_set_for_normal);
427 }
417 } 428 }
418 429
419 rxrpc_set_keepalive(call); 430 rxrpc_set_keepalive(call);
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 206e802ccbdc..be01f9c5d963 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -223,6 +223,15 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
223 223
224 ret = rxrpc_send_data_packet(call, skb, false); 224 ret = rxrpc_send_data_packet(call, skb, false);
225 if (ret < 0) { 225 if (ret < 0) {
226 switch (ret) {
227 case -ENETUNREACH:
228 case -EHOSTUNREACH:
229 case -ECONNREFUSED:
230 rxrpc_set_call_completion(call,
231 RXRPC_CALL_LOCAL_ERROR,
232 0, ret);
233 goto out;
234 }
226 _debug("need instant resend %d", ret); 235 _debug("need instant resend %d", ret);
227 rxrpc_instant_resend(call, ix); 236 rxrpc_instant_resend(call, ix);
228 } else { 237 } else {
@@ -241,6 +250,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
241 rxrpc_timer_set_for_send); 250 rxrpc_timer_set_for_send);
242 } 251 }
243 252
253out:
244 rxrpc_free_skb(skb, rxrpc_skb_tx_freed); 254 rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
245 _leave(""); 255 _leave("");
246} 256}