diff options
Diffstat (limited to 'net/ipv4/fib_hash.c')
-rw-r--r-- | net/ipv4/fib_hash.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 143a5213a185..86087d45c64e 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -315,10 +315,7 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
315 | break; | 315 | break; |
316 | } else if (!fib_detect_death(fi, order, &last_resort, | 316 | } else if (!fib_detect_death(fi, order, &last_resort, |
317 | &last_idx, fn_hash_last_dflt)) { | 317 | &last_idx, fn_hash_last_dflt)) { |
318 | if (res->fi) | 318 | fib_result_assign(res, fi); |
319 | fib_info_put(res->fi); | ||
320 | res->fi = fi; | ||
321 | atomic_inc(&fi->fib_clntref); | ||
322 | fn_hash_last_dflt = order; | 319 | fn_hash_last_dflt = order; |
323 | goto out; | 320 | goto out; |
324 | } | 321 | } |
@@ -333,21 +330,13 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib | |||
333 | } | 330 | } |
334 | 331 | ||
335 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, fn_hash_last_dflt)) { | 332 | if (!fib_detect_death(fi, order, &last_resort, &last_idx, fn_hash_last_dflt)) { |
336 | if (res->fi) | 333 | fib_result_assign(res, fi); |
337 | fib_info_put(res->fi); | ||
338 | res->fi = fi; | ||
339 | atomic_inc(&fi->fib_clntref); | ||
340 | fn_hash_last_dflt = order; | 334 | fn_hash_last_dflt = order; |
341 | goto out; | 335 | goto out; |
342 | } | 336 | } |
343 | 337 | ||
344 | if (last_idx >= 0) { | 338 | if (last_idx >= 0) |
345 | if (res->fi) | 339 | fib_result_assign(res, last_resort); |
346 | fib_info_put(res->fi); | ||
347 | res->fi = last_resort; | ||
348 | if (last_resort) | ||
349 | atomic_inc(&last_resort->fib_clntref); | ||
350 | } | ||
351 | fn_hash_last_dflt = last_idx; | 340 | fn_hash_last_dflt = last_idx; |
352 | out: | 341 | out: |
353 | read_unlock(&fib_hash_lock); | 342 | read_unlock(&fib_hash_lock); |