alistair23-linux/net
Benjamin Thery f262b59bec net: fix scheduling of dst_gc_task by __dst_free
The dst garbage collector dst_gc_task() may not be scheduled as we
expect it to be in __dst_free().

Indeed, when the dst_gc_timer was replaced by the delayed_work
dst_gc_work, the mod_timer() call used to schedule the garbage
collector at an earlier date was replaced by a schedule_delayed_work()
(see commit 86bba269d0).

But, the behaviour of mod_timer() and schedule_delayed_work() is
different in the way they handle the delay. 

mod_timer() stops the timer and re-arm it with the new given delay,
whereas schedule_delayed_work() only check if the work is already
queued in the workqueue (and queue it (with delay) if it is not)
BUT it does NOT take into account the new delay (even if the new delay
is earlier in time).
schedule_delayed_work() returns 0 if it didn't queue the work,
but we don't check the return code in __dst_free().

If I understand the code in __dst_free() correctly, we want dst_gc_task
to be queued after DST_GC_INC jiffies if we pass the test (and not in
some undetermined time in the future), so I think we should add a call
to cancel_delayed_work() before schedule_delayed_work(). Patch below.

Or we should at least test the return code of schedule_delayed_work(),
and reset the values of dst_garbage.timer_inc and dst_garbage.timer_expires
back to their former values if schedule_delayed_work() failed.
Otherwise the subsequent calls to __dst_free will test the wrong values
and assume wrong thing about when the garbage collector is supposed to
be scheduled.

dst_gc_task() also calls schedule_delayed_work() without checking
its return code (or calling cancel_scheduled_work() first), but it
should fine there: dst_gc_task is the routine of the delayed_work, so
no dst_gc_work should be pending in the queue when it's running.
 
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Acked-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-12 16:16:37 -07:00
..
9p
802
8021q vlan: vlan device not reading gso max size of parent. 2008-09-11 20:17:05 -07:00
appletalk
atm
ax25
bluetooth [Bluetooth] Reject L2CAP connections on an insecure ACL link 2008-09-09 07:19:20 +02:00
bridge Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-09-08 16:59:05 -07:00
can
core net: fix scheduling of dst_gc_task by __dst_free 2008-09-12 16:16:37 -07:00
dccp This reverts "Merge branch 'dccp' of git://eden-feed.erg.abdn.ac.uk/dccp_exp" 2008-09-09 13:27:22 +02:00
decnet
econet
ethernet
ieee80211 net/ieee80211: adjust error handling 2008-08-22 16:29:49 -04:00
ipv4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 into lvs-next-2.6 2008-09-10 09:14:52 +10:00
ipv6 ipv6: On interface down/unregister, purge icmp routes too. 2008-09-10 23:39:28 -07:00
ipx
irda
iucv
key
lapb
llc
mac80211 mac80211: Reorder debugfs calls during netdev deinit 2008-09-11 15:53:40 -04:00
netfilter netfilter: nf_conntrack_irc: make sure string is terminated before calling simple_strtoul 2008-09-07 18:21:24 -07:00
netlabel
netlink
netrom
packet
rfkill rfkill: rename rfkill_mutex to rfkill_global_mutex 2008-08-29 16:24:11 -04:00
rose
rxrpc net/rxrpc: Use an IS_ERR test rather than a NULL test 2008-08-13 02:40:48 -07:00
sched warn: Turn the netdev timeout WARN_ON() into a WARN() 2008-09-08 16:17:42 -07:00
sctp sctp: fix random memory dereference with SCTP_HMAC_IDENT option. 2008-08-27 16:09:49 -07:00
sunrpc sunrpc: fix possible overrun on read of /proc/sys/sunrpc/transports 2008-09-01 14:24:24 -04:00
tipc tipc: Don't use structure names which easily globally conflict. 2008-09-02 23:38:32 -07:00
unix
wanrouter
wireless Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-09-08 16:59:05 -07:00
x25
xfrm ipsec: Add missing list_del() in xfrm_state_gc_task(). 2008-09-09 22:13:28 -07:00
compat.c
Kconfig WIRELESS: Make wireless one-click selectable. 2008-08-22 16:29:50 -04:00
Makefile
nonet.c
socket.c
sysctl_net.c
TUNABLE