* ctnetlink: remove remaining module refcount usage
@ 2009-03-18 15:42 Florian Westphal
2009-03-18 15:42 ` [PATCH 1/2] netfilter: ctnetlink: remove remaining module refcounting Florian Westphal
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Florian Westphal @ 2009-03-18 15:42 UTC (permalink / raw)
To: netfilter-devel
Hello list,
The following (small) patch converts the remaining module refcounting
in conntrack_netlink to RCU.
First patch does the conversion, 2nd one removes
nf_ct_l4proto_find_get/put (there are no more in-tree users).
Thanks, Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] netfilter: ctnetlink: remove remaining module refcounting
2009-03-18 15:42 ctnetlink: remove remaining module refcount usage Florian Westphal
@ 2009-03-18 15:42 ` Florian Westphal
2009-03-18 15:42 ` [PATCH 2/2] netfilter: remove nf_ct_l4proto_find_get/nf_ct_l4proto_put Florian Westphal
2009-03-18 16:31 ` ctnetlink: remove remaining module refcount usage Patrick McHardy
2 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2009-03-18 15:42 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
convert the remaining refcount users.
As pointed out by Patrick McHardy, the protocols
can be accessed safely using RCU.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_conntrack_netlink.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9fb7cf7..735ea9c 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -599,7 +599,8 @@ ctnetlink_parse_tuple_ip(struct nlattr *attr, struct nf_conntrack_tuple *tuple)
nla_parse_nested(tb, CTA_IP_MAX, attr, NULL);
- l3proto = nf_ct_l3proto_find_get(tuple->src.l3num);
+ rcu_read_lock();
+ l3proto = __nf_ct_l3proto_find(tuple->src.l3num);
if (likely(l3proto->nlattr_to_tuple)) {
ret = nla_validate_nested(attr, CTA_IP_MAX,
@@ -608,7 +609,7 @@ ctnetlink_parse_tuple_ip(struct nlattr *attr, struct nf_conntrack_tuple *tuple)
ret = l3proto->nlattr_to_tuple(tb, tuple);
}
- nf_ct_l3proto_put(l3proto);
+ rcu_read_unlock();
return ret;
}
@@ -633,7 +634,8 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr,
return -EINVAL;
tuple->dst.protonum = nla_get_u8(tb[CTA_PROTO_NUM]);
- l4proto = nf_ct_l4proto_find_get(tuple->src.l3num, tuple->dst.protonum);
+ rcu_read_lock();
+ l4proto = __nf_ct_l4proto_find(tuple->src.l3num, tuple->dst.protonum);
if (likely(l4proto->nlattr_to_tuple)) {
ret = nla_validate_nested(attr, CTA_PROTO_MAX,
@@ -642,7 +644,7 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr,
ret = l4proto->nlattr_to_tuple(tb, tuple);
}
- nf_ct_l4proto_put(l4proto);
+ rcu_read_unlock();
return ret;
}
@@ -989,10 +991,11 @@ ctnetlink_change_protoinfo(struct nf_conn *ct, struct nlattr *cda[])
nla_parse_nested(tb, CTA_PROTOINFO_MAX, attr, NULL);
- l4proto = nf_ct_l4proto_find_get(nf_ct_l3num(ct), nf_ct_protonum(ct));
+ rcu_read_lock();
+ l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
if (l4proto->from_nlattr)
err = l4proto->from_nlattr(tb, ct);
- nf_ct_l4proto_put(l4proto);
+ rcu_read_unlock();
return err;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] netfilter: remove nf_ct_l4proto_find_get/nf_ct_l4proto_put
2009-03-18 15:42 ctnetlink: remove remaining module refcount usage Florian Westphal
2009-03-18 15:42 ` [PATCH 1/2] netfilter: ctnetlink: remove remaining module refcounting Florian Westphal
@ 2009-03-18 15:42 ` Florian Westphal
2009-03-18 16:31 ` ctnetlink: remove remaining module refcount usage Patrick McHardy
2 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2009-03-18 15:42 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
users have been moved to __nf_ct_l4proto_find.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/net/netfilter/nf_conntrack_l4proto.h | 5 -----
net/netfilter/nf_conntrack_proto.c | 21 ---------------------
2 files changed, 0 insertions(+), 26 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 16ab604..b01070b 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -98,11 +98,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
extern struct nf_conntrack_l4proto *
__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
-extern struct nf_conntrack_l4proto *
-nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
-
-extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
-
/* Protocol registration. */
extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index 592d733..9a62b4e 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -74,27 +74,6 @@ EXPORT_SYMBOL_GPL(__nf_ct_l4proto_find);
/* this is guaranteed to always return a valid protocol helper, since
* it falls back to generic_protocol */
-struct nf_conntrack_l4proto *
-nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto)
-{
- struct nf_conntrack_l4proto *p;
-
- rcu_read_lock();
- p = __nf_ct_l4proto_find(l3proto, l4proto);
- if (!try_module_get(p->me))
- p = &nf_conntrack_l4proto_generic;
- rcu_read_unlock();
-
- return p;
-}
-EXPORT_SYMBOL_GPL(nf_ct_l4proto_find_get);
-
-void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p)
-{
- module_put(p->me);
-}
-EXPORT_SYMBOL_GPL(nf_ct_l4proto_put);
-
struct nf_conntrack_l3proto *
nf_ct_l3proto_find_get(u_int16_t l3proto)
{
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: ctnetlink: remove remaining module refcount usage
2009-03-18 15:42 ctnetlink: remove remaining module refcount usage Florian Westphal
2009-03-18 15:42 ` [PATCH 1/2] netfilter: ctnetlink: remove remaining module refcounting Florian Westphal
2009-03-18 15:42 ` [PATCH 2/2] netfilter: remove nf_ct_l4proto_find_get/nf_ct_l4proto_put Florian Westphal
@ 2009-03-18 16:31 ` Patrick McHardy
2 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2009-03-18 16:31 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
Florian Westphal wrote:
> Hello list,
>
> The following (small) patch converts the remaining module refcounting
> in conntrack_netlink to RCU.
>
> First patch does the conversion, 2nd one removes
> nf_ct_l4proto_find_get/put (there are no more in-tree users).
Both patches applied, thanks Florian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-18 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 15:42 ctnetlink: remove remaining module refcount usage Florian Westphal
2009-03-18 15:42 ` [PATCH 1/2] netfilter: ctnetlink: remove remaining module refcounting Florian Westphal
2009-03-18 15:42 ` [PATCH 2/2] netfilter: remove nf_ct_l4proto_find_get/nf_ct_l4proto_put Florian Westphal
2009-03-18 16:31 ` ctnetlink: remove remaining module refcount usage Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.