diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-18 00:21:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-18 00:21:51 -0400 |
commit | 309dd5fc872448e35634d510049642312ebc170d (patch) | |
tree | 5284d7b48980482ecba06b760ac16d9f94e66ea9 /include/net | |
parent | 55b333253d5bcafbe187b50474e40789301c53c6 (diff) |
[NET]: Move the filter releasing into a separate call
This is done merely as a preparation for the fix.
The sk_filter_uncharge() unaccounts the filter memory and calls
the sk_filter_release(), which in turn decrements the refcount
anf frees the filter.
The latter function will be required separately.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sock.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 453c79d0915b..b9cfe125c9e6 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -922,14 +922,18 @@ static inline void sk_filter_rcu_free(struct rcu_head *rcu) | |||
922 | * Remove a filter from a socket and release its resources. | 922 | * Remove a filter from a socket and release its resources. |
923 | */ | 923 | */ |
924 | 924 | ||
925 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | 925 | static inline void sk_filter_release(struct sk_filter *fp) |
926 | { | ||
927 | if (atomic_dec_and_test(&fp->refcnt)) | ||
928 | call_rcu_bh(&fp->rcu, sk_filter_rcu_free); | ||
929 | } | ||
930 | |||
931 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | ||
926 | { | 932 | { |
927 | unsigned int size = sk_filter_len(fp); | 933 | unsigned int size = sk_filter_len(fp); |
928 | 934 | ||
929 | atomic_sub(size, &sk->sk_omem_alloc); | 935 | atomic_sub(size, &sk->sk_omem_alloc); |
930 | 936 | sk_filter_release(fp); | |
931 | if (atomic_dec_and_test(&fp->refcnt)) | ||
932 | call_rcu_bh(&fp->rcu, sk_filter_rcu_free); | ||
933 | } | 937 | } |
934 | 938 | ||
935 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) | 939 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) |