Commit 13711d88 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[NET]: Move dst_release out of dst->ops->check

As promised here is the patch that moves dst_release out of
dst->ops->check.  It bloats sk_dst_check/__sk_dst_check slightly
but they're only used in a handful of places so it isn't too bad.
I actually counted, it's about a few hundred bytes.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc8d308c
......@@ -270,10 +270,8 @@ static inline int dst_input(struct sk_buff *skb)
static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
{
dst_hold(dst);
if (dst->obsolete)
dst = dst->ops->check(dst, cookie);
dst_release(dst);
return dst;
}
......
......@@ -983,6 +983,7 @@ __sk_dst_check(struct sock *sk, u32 cookie)
if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
sk->sk_dst_cache = NULL;
dst_release(dst);
return NULL;
}
......@@ -996,6 +997,7 @@ sk_dst_check(struct sock *sk, u32 cookie)
if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
sk_dst_reset(sk);
dst_release(dst);
return NULL;
}
......
......@@ -253,7 +253,6 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
*/
static struct dst_entry *dn_dst_check(struct dst_entry *dst, __u32 cookie)
{
dst_release(dst);
return NULL;
}
......
......@@ -52,6 +52,7 @@ __ip_vs_dst_check(struct ip_vs_dest *dest, u32 rtos, u32 cookie)
if ((dst->obsolete || rtos != dest->dst_rtos) &&
dst->ops->check(dst, cookie) == NULL) {
dest->dst_cache = NULL;
dst_release(dst);
return NULL;
}
dst_hold(dst);
......
......@@ -1326,7 +1326,6 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
{
dst_release(dst);
return NULL;
}
......
......@@ -94,6 +94,7 @@ static inline struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
if (dst && dst->obsolete &&
dst->ops->check(dst, t->dst_cookie) == NULL) {
t->dst_cache = NULL;
dst_release(dst);
return NULL;
}
......
......@@ -589,7 +589,6 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
if (rt && rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
return dst;
dst_release(dst);
return NULL;
}
......
......@@ -1015,7 +1015,6 @@ static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie)
if (!stale_bundle(dst))
return dst;
dst_release(dst);
return NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment