On Thu, 2006-06-04 at 11:18 -0400, jamal wrote:

> After a little testing (i missed the scenario where a user subscribes
> and then leaves and then resubscribes; in such a case, the timer never
> gets restarted) i have updated the patch to do it the brute force way.
> What you propose is more optimal, I will let Krisztian comment and then
> whip a patch.

Patch attached for real this time ;->

cheers,
jamal
Restore timer rescheduling to fix a corner case where the packet
threshold is very high, the timer low and a very low packet rate
input. We may end in a rot situation.

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
---

--- a/net/xfrm/xfrm_state.c     2006-04-05 07:25:33.000000000 -0400
+++ b/net/xfrm/xfrm_state.c     2006-04-06 10:52:56.000000000 -0400
@@ -814,7 +814,7 @@
                if ((x->replay.seq == x->preplay.seq) &&
                    (x->replay.bitmap == x->preplay.bitmap) &&
                    (x->replay.oseq == x->preplay.oseq))
-                       return;
+                       goto resched;
 
                break;
        }
@@ -824,6 +824,7 @@
        c.data.aevent = event;
        km_state_notify(x, &c);
 
+resched:
        if (x->replay_maxage &&
            !mod_timer(&x->rtimer, jiffies + x->replay_maxage))
                xfrm_state_hold(x);
@@ -836,8 +837,13 @@
 
        spin_lock(&x->lock);
 
-       if (xfrm_aevent_is_on() && x->km.state == XFRM_STATE_VALID)
-               xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT);
+       if (x->km.state == XFRM_STATE_VALID) {
+               if (xfrm_aevent_is_on())
+                       xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT);
+               else if (x->replay_maxage &&
+                           !mod_timer(&x->rtimer, jiffies + x->replay_maxage))
+                       xfrm_state_hold(x);
+       }
 
        spin_unlock(&x->lock);
 }

Reply via email to