[parent not found: <20080118105309.4444.74440.stgit@woodpecker.roonstrasse.net>]
[parent not found: <20080118105309.4444.78574.stgit@woodpecker.roonstrasse.net>]
* Re: [nf-failover] [conntrack-utils PATCH r7254 04/14] fix misoptimization for next_alarm calculation
[not found] ` <20080118105309.4444.78574.stgit@woodpecker.roonstrasse.net>
@ 2008-01-21 0:05 ` Pablo Neira Ayuso
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2008-01-21 0:05 UTC (permalink / raw)
To: Max Kellermann; +Cc: netfilter-failover, Netfilter Development Mailinglist
Max Kellermann wrote:
> do_alarm_run() determines the next_alarm time. there is however a
> condition where this result comes wrong, because of "unsafe" side
> effects of list_for_each_entry_safe(). Example: imagine there are two
> alarms: A is due now, and B is due in 5 minutes.
>
> When do_alarm_run() runs alarm A, list_for_each_entry_safe() remembers
> B as the alarm for the next loop iteration.
>
> Now A re-schedules itself in 1 minute. It is again the first entry in
> the alarm_list queue, but list_for_each_entry_safe() will not handle
> it in this loop.
>
> Instead, do_alarm_run() sees B and returns "5 minutes" as the
> next_alarm time.
>
> Solve this by breaking from the loop when a late event is detected,
> and letting get_next_alarm() do all the work.
Good point. I noticed this while rewriting the alarm scheduler, in the
rewrite it should handle this case correctly.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20080118105309.4444.39660.stgit@woodpecker.roonstrasse.net>]
* Re: [nf-failover] [conntrack-utils PATCH r7254 08/14] check alarms even if select()!=0
[not found] ` <20080118105309.4444.39660.stgit@woodpecker.roonstrasse.net>
@ 2008-01-21 0:10 ` Pablo Neira Ayuso
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2008-01-21 0:10 UTC (permalink / raw)
To: Max Kellermann; +Cc: netfilter-failover, Netfilter Development Mailinglist
Max Kellermann wrote:
> It is not documented that select() always returns 0 when the timeout
> expires - the timeout may expire, and there may be events on file
> descriptors at the same time. Don't check the select() return value,
> check timerisset(next_alarm) instead, and always update next_alarm
> with get_next_alarm()
Indeed, good point. This was fixed in r7260.
> Also the old code never checked for new alarms which were added during
> the file descriptor handlers.
Same thing.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20080118105309.4444.65188.stgit@woodpecker.roonstrasse.net>]
end of thread, other threads:[~2008-01-21 0:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080118104935.4444.26673.stgit@woodpecker.roonstrasse.net>
[not found] ` <20080118105309.4444.14927.stgit@woodpecker.roonstrasse.net>
2008-01-20 23:53 ` [nf-failover] [conntrack-utils PATCH r7254 01/14] merge mod_alarm() into add_alarm() Pablo Neira Ayuso
[not found] ` <20080118105309.4444.74440.stgit@woodpecker.roonstrasse.net>
2008-01-20 23:57 ` [nf-failover] [conntrack-utils PATCH r7254 02/14] remove duplicate init_alarm() invocations Pablo Neira Ayuso
[not found] ` <20080118105309.4444.78574.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:05 ` [nf-failover] [conntrack-utils PATCH r7254 04/14] fix misoptimization for next_alarm calculation Pablo Neira Ayuso
[not found] ` <20080118105309.4444.39660.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:10 ` [nf-failover] [conntrack-utils PATCH r7254 08/14] check alarms even if select()!=0 Pablo Neira Ayuso
[not found] ` <20080118105309.4444.65188.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:14 ` [nf-failover] [conntrack-utils PATCH r7254 05/14] make the "tv" parameter const Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).