* [PATCH] iproute2: initialize the ll_map only once
@ 2010-12-10 14:59 Octavian Purdila
2010-12-10 19:38 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Octavian Purdila @ 2010-12-10 14:59 UTC (permalink / raw)
To: netdev; +Cc: Lucian Adrian Grijincu, Vlad Dogaru, Octavian Purdila
Avoid initializing the LL map (which involves a costly RTNL dump)
multiple times. This can happen when running in batch mode.
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
lib/ll_map.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 9831322..9c6144a 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -266,6 +266,11 @@ unsigned ll_name_to_index(const char *name)
int ll_init_map(struct rtnl_handle *rth)
{
+ static int initialized;
+
+ if (initialized)
+ return 0;
+
if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
perror("Cannot send dump request");
exit(1);
@@ -275,5 +280,8 @@ int ll_init_map(struct rtnl_handle *rth)
fprintf(stderr, "Dump terminated\n");
exit(1);
}
+
+ initialized = 1;
+
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] iproute2: initialize the ll_map only once
2010-12-10 14:59 [PATCH] iproute2: initialize the ll_map only once Octavian Purdila
@ 2010-12-10 19:38 ` Stephen Hemminger
2010-12-17 13:06 ` Denys Fedoryshchenko
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2010-12-10 19:38 UTC (permalink / raw)
To: Octavian Purdila; +Cc: netdev, Lucian Adrian Grijincu, Vlad Dogaru
On Fri, 10 Dec 2010 16:59:50 +0200
Octavian Purdila <opurdila@ixiacom.com> wrote:
> Avoid initializing the LL map (which involves a costly RTNL dump)
> multiple times. This can happen when running in batch mode.
>
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
applied
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute2: initialize the ll_map only once
2010-12-10 19:38 ` Stephen Hemminger
@ 2010-12-17 13:06 ` Denys Fedoryshchenko
0 siblings, 0 replies; 3+ messages in thread
From: Denys Fedoryshchenko @ 2010-12-17 13:06 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Octavian Purdila, netdev, Lucian Adrian Grijincu, Vlad Dogaru
On Friday 10 December 2010 21:38:09 Stephen Hemminger wrote:
> On Fri, 10 Dec 2010 16:59:50 +0200
>
> Octavian Purdila <opurdila@ixiacom.com> wrote:
> > Avoid initializing the LL map (which involves a costly RTNL dump)
> > multiple times. This can happen when running in batch mode.
> >
> > Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
>
> applied
There is some longstanding bug related to current hashing system.
To "workaround" it i did my own "flush" command, to flush hashes, but with
this patch it becomes more difficult to handle this situation.
Here is how to reproduce it:
ip -force -batch -
link add link eth0 name new0 type macvlan
link show dev new0
link delete dev new0 type macvlan
link add link eth0 name new0 type macvlan
link show dev new0
Last command will not show link, because index of old one is stored in hash.
I guess it is more bugreport for old problem, than problem with current patch.
Sure it is possible to flush hash on del/add operations, but additionally
during batch run it is possible that interfaces can appear/disappear (NAS with
thousands of ppp interfaces). Maybe still as an idea i can do patch with flag
to dump rtnl before each command and additional "flush hash" command?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-17 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 14:59 [PATCH] iproute2: initialize the ll_map only once Octavian Purdila
2010-12-10 19:38 ` Stephen Hemminger
2010-12-17 13:06 ` Denys Fedoryshchenko
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).