--- /usr/src/linux/net/ipv4/route.c Tue Jan 29 17:24:15 2002 +++ /usr/src/linux/net/patches/route.c Tue Jan 29 17:26:22 2002 @@ -471,6 +471,37 @@ mod_timer(&rt_flush_timer, now+delay); spin_unlock_bh(&rt_flush_lock); } +/* + Called by rt_intern_hash. Deletes unused entries immediately + in emergency situations. +*/ +static void rt_delete_now() +{ + int i; + struct rtable *rth, **rthp; + + for(i=rt_hash_mask; i>=0; i--) { + + rthp = &rt_hash_table[i].chain; + write_lock_bh(&rt_hash_table[i].lock); + + while((rth=*rthp) != NULL) { + if(atomic_read(&rth->u.dst.__refcnt)) { + rthp = &rth->u.rt_next; + continue; + } + + *rthp = rth->u.rt_next; + rt_free(rth); + + } + + write_unlock_bh(&rt_hash_table[i].lock); + + } + +} + /* Short description of GC goals. @@ -646,13 +677,7 @@ it is most likely it holds some neighbour records. */ if (attempts-- > 0) { - int saved_elasticity = ip_rt_gc_elasticity; - int saved_int = ip_rt_gc_min_interval; - ip_rt_gc_elasticity = 1; - ip_rt_gc_min_interval = 0; - rt_garbage_collect(); - ip_rt_gc_min_interval = saved_int; - ip_rt_gc_elasticity = saved_elasticity; + rt_delete_now(); goto restart; }