Skip to content

Commit 922c2ac

Browse files
idoschdavem330
authored andcommitted
ipv6: Take table lock outside of sernum update function
The next patch is going to allow dead routes to remain in the FIB tree in certain situations. When this happens we need to be sure to bump the sernum of the nodes where these are stored so that potential copies cached in sockets are invalidated. The function that performs this update assumes the table lock is not taken when it is invoked, but that will not be the case when it is invoked by the tree walker. Have the function assume the lock is taken and make the single caller take the lock itself. Signed-off-by: Ido Schimmel <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a8e56e commit 922c2ac

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

net/ipv6/ip6_fib.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,13 @@ enum {
107107

108108
void fib6_update_sernum(struct rt6_info *rt)
109109
{
110-
struct fib6_table *table = rt->rt6i_table;
111110
struct net *net = dev_net(rt->dst.dev);
112111
struct fib6_node *fn;
113112

114-
spin_lock_bh(&table->tb6_lock);
115113
fn = rcu_dereference_protected(rt->rt6i_node,
116-
lockdep_is_held(&table->tb6_lock));
114+
lockdep_is_held(&rt->rt6i_table->tb6_lock));
117115
if (fn)
118116
fn->fn_sernum = fib6_new_sernum(net);
119-
spin_unlock_bh(&table->tb6_lock);
120117
}
121118

122119
/*

net/ipv6/route.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,9 @@ static int rt6_insert_exception(struct rt6_info *nrt,
13531353

13541354
/* Update fn->fn_sernum to invalidate all cached dst */
13551355
if (!err) {
1356+
spin_lock_bh(&ort->rt6i_table->tb6_lock);
13561357
fib6_update_sernum(ort);
1358+
spin_unlock_bh(&ort->rt6i_table->tb6_lock);
13571359
fib6_force_start_gc(net);
13581360
}
13591361

0 commit comments

Comments
 (0)