@@ -160,8 +160,6 @@ struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh)
160160 INIT_LIST_HEAD (& f6i -> fib6_siblings );
161161 refcount_set (& f6i -> fib6_ref , 1 );
162162
163- INIT_HLIST_NODE (& f6i -> gc_link );
164-
165163 return f6i ;
166164}
167165
@@ -248,7 +246,6 @@ static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
248246 net -> ipv6 .fib6_null_entry );
249247 table -> tb6_root .fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO ;
250248 inet_peer_base_init (& table -> tb6_peers );
251- INIT_HLIST_HEAD (& table -> tb6_gc_hlist );
252249 }
253250
254251 return table ;
@@ -1060,8 +1057,6 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
10601057 lockdep_is_held (& table -> tb6_lock ));
10611058 }
10621059 }
1063-
1064- fib6_clean_expires_locked (rt );
10651060}
10661061
10671062/*
@@ -1123,10 +1118,9 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
11231118 if (!(iter -> fib6_flags & RTF_EXPIRES ))
11241119 return - EEXIST ;
11251120 if (!(rt -> fib6_flags & RTF_EXPIRES ))
1126- fib6_clean_expires_locked (iter );
1121+ fib6_clean_expires (iter );
11271122 else
1128- fib6_set_expires_locked (iter ,
1129- rt -> expires );
1123+ fib6_set_expires (iter , rt -> expires );
11301124
11311125 if (rt -> fib6_pmtu )
11321126 fib6_metric_set (iter , RTAX_MTU ,
@@ -1485,10 +1479,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt,
14851479 if (rt -> nh )
14861480 list_add (& rt -> nh_list , & rt -> nh -> f6i_list );
14871481 __fib6_update_sernum_upto_root (rt , fib6_new_sernum (info -> nl_net ));
1488-
1489- if (fib6_has_expires (rt ))
1490- hlist_add_head (& rt -> gc_link , & table -> tb6_gc_hlist );
1491-
14921482 fib6_start_gc (info -> nl_net , rt );
14931483 }
14941484
@@ -2291,16 +2281,17 @@ static void fib6_flush_trees(struct net *net)
22912281 * Garbage collection
22922282 */
22932283
2294- static int fib6_age (struct fib6_info * rt , struct fib6_gc_args * gc_args )
2284+ static int fib6_age (struct fib6_info * rt , void * arg )
22952285{
2286+ struct fib6_gc_args * gc_args = arg ;
22962287 unsigned long now = jiffies ;
22972288
22982289 /*
22992290 * check addrconf expiration here.
23002291 * Routes are expired even if they are in use.
23012292 */
23022293
2303- if (fib6_has_expires ( rt ) && rt -> expires ) {
2294+ if (rt -> fib6_flags & RTF_EXPIRES && rt -> expires ) {
23042295 if (time_after (now , rt -> expires )) {
23052296 RT6_TRACE ("expiring %p\n" , rt );
23062297 return -1 ;
@@ -2317,40 +2308,6 @@ static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args)
23172308 return 0 ;
23182309}
23192310
2320- static void fib6_gc_table (struct net * net ,
2321- struct fib6_table * tb6 ,
2322- struct fib6_gc_args * gc_args )
2323- {
2324- struct fib6_info * rt ;
2325- struct hlist_node * n ;
2326- struct nl_info info = {
2327- .nl_net = net ,
2328- .skip_notify = false,
2329- };
2330-
2331- hlist_for_each_entry_safe (rt , n , & tb6 -> tb6_gc_hlist , gc_link )
2332- if (fib6_age (rt , gc_args ) == -1 )
2333- fib6_del (rt , & info );
2334- }
2335-
2336- static void fib6_gc_all (struct net * net , struct fib6_gc_args * gc_args )
2337- {
2338- struct fib6_table * table ;
2339- struct hlist_head * head ;
2340- unsigned int h ;
2341-
2342- rcu_read_lock ();
2343- for (h = 0 ; h < FIB6_TABLE_HASHSZ ; h ++ ) {
2344- head = & net -> ipv6 .fib_table_hash [h ];
2345- hlist_for_each_entry_rcu (table , head , tb6_hlist ) {
2346- spin_lock_bh (& table -> tb6_lock );
2347- fib6_gc_table (net , table , gc_args );
2348- spin_unlock_bh (& table -> tb6_lock );
2349- }
2350- }
2351- rcu_read_unlock ();
2352- }
2353-
23542311void fib6_run_gc (unsigned long expires , struct net * net , bool force )
23552312{
23562313 struct fib6_gc_args gc_args ;
@@ -2366,7 +2323,7 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force)
23662323 net -> ipv6 .sysctl .ip6_rt_gc_interval ;
23672324 gc_args .more = 0 ;
23682325
2369- fib6_gc_all (net , & gc_args );
2326+ fib6_clean_all (net , fib6_age , & gc_args );
23702327 now = jiffies ;
23712328 net -> ipv6 .ip6_rt_last_gc = now ;
23722329
0 commit comments