netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, containers@lists.osdl.org,
	dlezcano@fr.ibm.com, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 7/8 net-2.6.26] [NETNS]: Add netns refcnt debug to fib rules.
Date: Tue, 15 Apr 2008 16:37:54 +0400	[thread overview]
Message-ID: <1208263075-28016-7-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1208262959.21529.32.camel@iris.sw.ru>

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 include/net/fib_rules.h |    1 +
 net/core/fib_rules.c    |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 34349f9..a5c6ccc 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule)
 static inline void fib_rule_put_rcu(struct rcu_head *head)
 {
 	struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
+	release_net(rule->fr_net);
 	kfree(rule);
 }
 
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 540c072..e3e9ab0 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -29,7 +29,7 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
 	r->pref = pref;
 	r->table = table;
 	r->flags = flags;
-	r->fr_net = ops->fro_net;
+	r->fr_net = hold_net(ops->fro_net);
 
 	/* The lock is not required here, the list in unreacheable
 	 * at the moment this function is called */
@@ -243,7 +243,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 		err = -ENOMEM;
 		goto errout;
 	}
-	rule->fr_net = net;
+	rule->fr_net = hold_net(net);
 
 	if (tb[FRA_PRIORITY])
 		rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
@@ -344,6 +344,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 	return 0;
 
 errout_free:
+	release_net(rule->fr_net);
 	kfree(rule);
 errout:
 	rules_ops_put(ops);
-- 
1.5.3.rc5


  parent reply	other threads:[~2008-04-15 12:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-15 12:35 [PATCH 0/8 net-2.6.26] [NETNS]: namespace refcounting cleanup Denis V. Lunev
2008-04-15 12:37 ` [PATCH 1/8 net-2.6.26] [NETNS]: Make netns refconting debug like a socket one Denis V. Lunev
2008-04-15 14:55   ` Brian Haley
2008-04-16  8:58     ` David Miller
2008-04-15 12:37 ` [PATCH 2/8 net-2.6.26] [NETNS]: Add netns refcnt debug for kernel sockets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 3/8 net-2.6.26] [NETNS]: Add netns refcnt debug for timewait buckets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 4/8 net-2.6.26] [NETNS]: Add netns refcnt debug into fib_info Denis V. Lunev
2008-04-15 12:37 ` [PATCH 5/8 net-2.6.26] [NETNS]: Add netns refcnt debug for inet bind buckets Denis V. Lunev
2008-04-15 12:37 ` [PATCH 6/8 net-2.6.26] [NETNS]: Add netns refcnt debug for dst ops Denis V. Lunev
2008-04-15 12:37 ` Denis V. Lunev [this message]
2008-04-15 12:37 ` [PATCH 8/8 net-2.6.26] [NETNS]: Add netns refcnt debug for network devices Denis V. Lunev
2008-04-16  9:07 ` [PATCH 0/8 net-2.6.26] [NETNS]: namespace refcounting cleanup David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208263075-28016-7-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=containers@lists.osdl.org \
    --cc=davem@davemloft.net \
    --cc=dlezcano@fr.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).