summaryrefslogtreecommitdiffstats
path: root/net/rxrpc/call_event.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-09-23 12:39:22 +0100
committerDavid Howells <dhowells@redhat.com>2016-09-23 15:49:19 +0100
commit01a88f7f6bd4514de9551c3fc9a6fd9e65cbf79d (patch)
tree78a27b9b3e2d3a4d3f5203f910dc45d9eaeb2141 /net/rxrpc/call_event.c
parentbe8aa3380678183821bd7d7b5dec845f10d776ce (diff)
downloadop-kernel-dev-01a88f7f6bd4514de9551c3fc9a6fd9e65cbf79d.zip
op-kernel-dev-01a88f7f6bd4514de9551c3fc9a6fd9e65cbf79d.tar.gz
rxrpc: Fix call timer
Fix the call timer in the following ways: (1) If call->resend_at or call->ack_at are before or equal to the current time, then ignore that timeout. (2) If call->expire_at is before or equal to the current time, then don't set the timer at all (possibly we should queue the call). (3) Don't skip modifying the timer if timer_pending() is true. This indicates that the timer is working, not that it has expired and is running/waiting to run its expiry handler. Also call rxrpc_set_timer() to start the call timer going rather than calling add_timer(). Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/call_event.c')
-rw-r--r--net/rxrpc/call_event.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 3a7f90a..8bc5c8e 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -28,24 +28,27 @@ void rxrpc_set_timer(struct rxrpc_call *call)
{
unsigned long t, now = jiffies;
- _enter("{%ld,%ld,%ld:%ld}",
- call->ack_at - now, call->resend_at - now, call->expire_at - now,
- call->timer.expires - now);
-
read_lock_bh(&call->state_lock);
if (call->state < RXRPC_CALL_COMPLETE) {
- t = call->ack_at;
- if (time_before(call->resend_at, t))
+ t = call->expire_at;
+ if (time_before_eq(t, now))
+ goto out;
+
+ if (time_after(call->resend_at, now) &&
+ time_before(call->resend_at, t))
t = call->resend_at;
- if (time_before(call->expire_at, t))
- t = call->expire_at;
- if (!timer_pending(&call->timer) ||
- time_before(t, call->timer.expires)) {
- _debug("set timer %ld", t - now);
+
+ if (time_after(call->ack_at, now) &&
+ time_before(call->ack_at, t))
+ t = call->ack_at;
+
+ if (call->timer.expires != t || !timer_pending(&call->timer)) {
mod_timer(&call->timer, t);
}
}
+
+out:
read_unlock_bh(&call->state_lock);
}
OpenPOWER on IntegriCloud