diff options
Diffstat (limited to 'net/core/dst.c')
-rw-r--r-- | net/core/dst.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/net/core/dst.c b/net/core/dst.c index 80d6286c8b62..a028409ee438 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -269,6 +269,15 @@ again: | |||
269 | } | 269 | } |
270 | EXPORT_SYMBOL(dst_destroy); | 270 | EXPORT_SYMBOL(dst_destroy); |
271 | 271 | ||
272 | static void dst_destroy_rcu(struct rcu_head *head) | ||
273 | { | ||
274 | struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); | ||
275 | |||
276 | dst = dst_destroy(dst); | ||
277 | if (dst) | ||
278 | __dst_free(dst); | ||
279 | } | ||
280 | |||
272 | void dst_release(struct dst_entry *dst) | 281 | void dst_release(struct dst_entry *dst) |
273 | { | 282 | { |
274 | if (dst) { | 283 | if (dst) { |
@@ -276,11 +285,8 @@ void dst_release(struct dst_entry *dst) | |||
276 | 285 | ||
277 | newrefcnt = atomic_dec_return(&dst->__refcnt); | 286 | newrefcnt = atomic_dec_return(&dst->__refcnt); |
278 | WARN_ON(newrefcnt < 0); | 287 | WARN_ON(newrefcnt < 0); |
279 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) { | 288 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
280 | dst = dst_destroy(dst); | 289 | call_rcu(&dst->rcu_head, dst_destroy_rcu); |
281 | if (dst) | ||
282 | __dst_free(dst); | ||
283 | } | ||
284 | } | 290 | } |
285 | } | 291 | } |
286 | EXPORT_SYMBOL(dst_release); | 292 | EXPORT_SYMBOL(dst_release); |