From: Julian Anastasov <ja@ssi.bg>
To: netdev@vger.kernel.org
Subject: [PATCH net v2 3/6] ipv4: make sure nh_pcpu_rth_output is always allocated
Date: Tue, 9 Oct 2012 00:41:17 +0300 [thread overview]
Message-ID: <1349732480-19978-4-git-send-email-ja@ssi.bg> (raw)
In-Reply-To: <1349732480-19978-1-git-send-email-ja@ssi.bg>
Avoid checking nh_pcpu_rth_output in fast path,
abort fib_info creation on alloc_percpu failure.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
net/ipv4/fib_semantics.c | 2 ++
net/ipv4/route.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2677530..71b125c 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -840,6 +840,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
change_nexthops(fi) {
nexthop_nh->nh_parent = fi;
nexthop_nh->nh_pcpu_rth_output = alloc_percpu(struct rtable __rcu *);
+ if (!nexthop_nh->nh_pcpu_rth_output)
+ goto failure;
} endfor_nexthops(fi)
if (cfg->fc_mx) {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index b90da1b..5b0180f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1207,8 +1207,6 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
if (rt_is_input_route(rt)) {
p = (struct rtable **)&nh->nh_rth_input;
} else {
- if (!nh->nh_pcpu_rth_output)
- goto nocache;
p = (struct rtable **)__this_cpu_ptr(nh->nh_pcpu_rth_output);
}
orig = *p;
@@ -1223,7 +1221,6 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
* unsuccessful at storing this route into the cache
* we really need to set it.
*/
-nocache:
rt->dst.flags |= DST_NOCACHE;
ret = false;
}
--
1.7.3.4
next prev parent reply other threads:[~2012-10-08 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 21:41 [PATCH net v2 0/6] ipv4: Changes for rt_gateway Julian Anastasov
2012-10-08 21:41 ` [PATCH net v2 1/6] ipv4: fix sending of redirects Julian Anastasov
2012-10-08 21:41 ` [PATCH net v2 2/6] ipv4: fix forwarding for strict source routes Julian Anastasov
2012-10-08 21:41 ` Julian Anastasov [this message]
2012-10-08 21:41 ` [PATCH net v2 4/6] ipv4: introduce rt_uses_gateway Julian Anastasov
2012-10-08 21:41 ` [PATCH net v2 5/6] ipv4: Add FLOWI_FLAG_KNOWN_NH Julian Anastasov
2012-10-08 21:41 ` [PATCH net v2 6/6] ipvs: fix ARP resolving for direct routing mode Julian Anastasov
2012-10-08 21:43 ` [PATCH net v2 0/6] ipv4: Changes for rt_gateway 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=1349732480-19978-4-git-send-email-ja@ssi.bg \
--to=ja@ssi.bg \
--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