* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: Stephen Hemminger @ 2010-02-26 18:30 UTC (permalink / raw)
To: David Miller; +Cc: xemul, gorcunov, bridge, netdev, den
In-Reply-To: <20100226.100800.116618587.davem@davemloft.net>
On Fri, 26 Feb 2010 10:08:00 -0800 (PST)
David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Fri, 26 Feb 2010 10:01:02 -0800
>
> > TCP connections are never really bound to device. TCP routing is
> > flexible; if packets can get through, it doesn't care.
>
> I think he might be talking about SO_BINDTODEVICE
What application does that with TCP?
^ permalink raw reply
* net-next merge plans
From: David Miller @ 2010-02-26 18:10 UTC (permalink / raw)
To: netdev; +Cc: linux-wireless
I plan to send Linus the pull request for net-next-2.6 some
time in the next day or two.
Once I do that it needs to be all bug fixes from here on out.
Thanks.
^ permalink raw reply
* Re: netfilter 00/03: netfilter update
From: David Miller @ 2010-02-26 18:08 UTC (permalink / raw)
To: kaber; +Cc: netdev, netfilter-devel
In-Reply-To: <20100226171521.30040.76590.sendpatchset@x2.localnet>
From: Patrick McHardy <kaber@trash.net>
Date: Fri, 26 Feb 2010 18:15:21 +0100 (MET)
> Please apply or pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.git master
Pulled, thanks Patrick.
^ permalink raw reply
* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: David Miller @ 2010-02-26 18:08 UTC (permalink / raw)
To: shemminger; +Cc: xemul, gorcunov, bridge, netdev, den
In-Reply-To: <20100226100102.0d52c6e9@nehalam>
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Fri, 26 Feb 2010 10:01:02 -0800
> TCP connections are never really bound to device. TCP routing is
> flexible; if packets can get through, it doesn't care.
I think he might be talking about SO_BINDTODEVICE
^ permalink raw reply
* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: Stephen Hemminger @ 2010-02-26 18:01 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: Cyrill Gorcunov, bridge, netdev, Denis Lunev
In-Reply-To: <4B88076F.8030302@openvz.org>
On Fri, 26 Feb 2010 20:39:59 +0300
Pavel Emelyanov <xemul@openvz.org> wrote:
> Cyrill Gorcunov wrote:
> > On Fri, Feb 26, 2010 at 08:18:43AM -0800, Stephen Hemminger wrote:
> >> Looking back at this. What if the API was simpler:
>
> Thanks for the reply, Stephen!
>
> >> Why not:
> >> 1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
> >> 2. Add eth0 to bridge with new flag to inherit
> >> a. brctl addif br0 eth0 inherit
> >>
> >> Inherit functionality would need to move address (Ether, IP, IPv6)
> >> and routes from eth0 to br0.
> >> I will see about doing it as much as possible in userspace.
> >>
>
> Solution is good, but we'll have to reconfigure netfilter matches
> that check for device name/ifindex and restore all this back when
> deleting eth0 from br0.
Netfilter is outside of this, and can't really migrate easily.
> Maybe it's better to implement it on the kernel side by sending a
> netdev notification and letting the subsystem reconfigure themselves?
>
> And what can we do with existing TCP connections bound to a device?
>
TCP connections are never really bound to device. TCP routing is
flexible; if packets can get through, it doesn't care.
--
^ permalink raw reply
* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: Pavel Emelyanov @ 2010-02-26 17:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Cyrill Gorcunov, bridge, netdev, Denis Lunev
In-Reply-To: <20100226165104.GB5364@lenovo>
Cyrill Gorcunov wrote:
> On Fri, Feb 26, 2010 at 08:18:43AM -0800, Stephen Hemminger wrote:
>> Looking back at this. What if the API was simpler:
Thanks for the reply, Stephen!
>> Why not:
>> 1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
>> 2. Add eth0 to bridge with new flag to inherit
>> a. brctl addif br0 eth0 inherit
>>
>> Inherit functionality would need to move address (Ether, IP, IPv6)
>> and routes from eth0 to br0.
>> I will see about doing it as much as possible in userspace.
>>
Solution is good, but we'll have to reconfigure netfilter matches
that check for device name/ifindex and restore all this back when
deleting eth0 from br0.
Maybe it's better to implement it on the kernel side by sending a
netdev notification and letting the subsystem reconfigure themselves?
And what can we do with existing TCP connections bound to a device?
> -- Cyrill
^ permalink raw reply
* Re: [Bridge] [RFC 0/5] bridge - introduce via_phys_dev feature
From: Stephen Hemminger @ 2010-02-26 17:25 UTC (permalink / raw)
To: richardvoigt@gmail.com; +Cc: Cyrill Gorcunov, netdev, bridge
In-Reply-To: <2e59e6971002260852m79d9c79t5293b3b8c7575d46@mail.gmail.com>
On Fri, 26 Feb 2010 10:52:52 -0600
"richardvoigt@gmail.com" <richardvoigt@gmail.com> wrote:
> On Fri, Feb 26, 2010 at 10:18 AM, Stephen Hemminger
> <shemminger@linux-foundation.org> wrote:
> > Looking back at this. What if the API was simpler:
> >
> > Instead of:
> >> Typical session looks like
> >>
> >> | s...@10.10.0.160$ brctl addbr br0
> >> | s...@10.10.0.160$ ifconfig br0 up
> >> | s...@10.10.0.160$ echo 1 > /sys/class/net/bridge/br0/via_phys_dev
> >> | s...@10.10.0.160$ brctl addif br0 eth0
> >> | (...waiting a bit...)
> >> | s...@10.10.0.160$
> >
> > Why not:
> > 1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
> > 2. Add eth0 to bridge with new flag to inherit
> > a. brctl addif br0 eth0 inherit
> >
> > Inherit functionality would need to move address (Ether, IP, IPv6)
> > and routes from eth0 to br0.
> > I will see about doing it as much as possible in userspace.
>
> How about inheriting the up/down status as well, this way the bridge
> can be left down until the settings are inherited, and will come up
> with the inherited MAC address, IP address, and routing table instead
> of changing while live?
Ok.
--
^ permalink raw reply
* netfilter 03/03: xtables: restore indentation
From: Patrick McHardy @ 2010-02-26 17:15 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
In-Reply-To: <20100226171521.30040.76590.sendpatchset@x2.localnet>
commit 6b4ff2d7675511a31980fa5379808660e1261f90
Author: Jan Engelhardt <jengelh@medozas.de>
Date: Fri Feb 26 17:53:31 2010 +0100
netfilter: xtables: restore indentation
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 57098dc..f07d77f 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -644,8 +644,10 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter, entry0, newinfo->size) {
ret = check_entry_size_and_hooks(iter, newinfo, entry0,
- entry0 + repl->size, repl->hook_entry, repl->underflow,
- repl->valid_hooks);
+ entry0 + repl->size,
+ repl->hook_entry,
+ repl->underflow,
+ repl->valid_hooks);
if (ret != 0)
break;
++i;
@@ -730,7 +732,7 @@ static void get_counters(const struct xt_table_info *t,
i = 0;
xt_entry_foreach(iter, t->entries[curcpu], t->size) {
SET_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i;
}
@@ -741,7 +743,7 @@ static void get_counters(const struct xt_table_info *t,
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i;
}
xt_info_wrunlock(cpu);
@@ -1356,8 +1358,11 @@ static int translate_compat_table(const char *name,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter0, entry0, total_size) {
ret = check_compat_entry_size_and_hooks(iter0, info, &size,
- entry0, entry0 + total_size, hook_entries, underflows,
- name);
+ entry0,
+ entry0 + total_size,
+ hook_entries,
+ underflows,
+ name);
if (ret != 0)
goto out_unlock;
++j;
@@ -1401,8 +1406,8 @@ static int translate_compat_table(const char *name,
pos = entry1;
size = total_size;
xt_entry_foreach(iter0, entry0, total_size) {
- ret = compat_copy_entry_from_user(iter0, &pos,
- &size, name, newinfo, entry1);
+ ret = compat_copy_entry_from_user(iter0, &pos, &size,
+ name, newinfo, entry1);
if (ret != 0)
break;
}
@@ -1617,7 +1622,7 @@ static int compat_copy_entries_to_user(unsigned int total_size,
size = total_size;
xt_entry_foreach(iter, loc_cpu_entry, total_size) {
ret = compat_copy_entry_to_user(iter, &pos,
- &size, counters, i++);
+ &size, counters, i++);
if (ret != 0)
break;
}
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index c92f4e5..b29c66d 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -836,8 +836,10 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter, entry0, newinfo->size) {
ret = check_entry_size_and_hooks(iter, newinfo, entry0,
- entry0 + repl->size, repl->hook_entry, repl->underflow,
- repl->valid_hooks);
+ entry0 + repl->size,
+ repl->hook_entry,
+ repl->underflow,
+ repl->valid_hooks);
if (ret != 0)
return ret;
++i;
@@ -918,7 +920,7 @@ get_counters(const struct xt_table_info *t,
i = 0;
xt_entry_foreach(iter, t->entries[curcpu], t->size) {
SET_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i;
}
@@ -929,7 +931,7 @@ get_counters(const struct xt_table_info *t,
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i; /* macro does multi eval of i */
}
xt_info_wrunlock(cpu);
@@ -1540,7 +1542,7 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
j = 0;
xt_ematch_foreach(ematch, e) {
ret = compat_find_calc_match(ematch, name,
- &e->ip, e->comefrom, &off);
+ &e->ip, e->comefrom, &off);
if (ret != 0)
goto release_matches;
++j;
@@ -1701,8 +1703,11 @@ translate_compat_table(struct net *net,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter0, entry0, total_size) {
ret = check_compat_entry_size_and_hooks(iter0, info, &size,
- entry0, entry0 + total_size, hook_entries, underflows,
- name);
+ entry0,
+ entry0 + total_size,
+ hook_entries,
+ underflows,
+ name);
if (ret != 0)
goto out_unlock;
++j;
@@ -1746,8 +1751,8 @@ translate_compat_table(struct net *net,
pos = entry1;
size = total_size;
xt_entry_foreach(iter0, entry0, total_size) {
- ret = compat_copy_entry_from_user(iter0, &pos,
- &size, name, newinfo, entry1);
+ ret = compat_copy_entry_from_user(iter0, &pos, &size,
+ name, newinfo, entry1);
if (ret != 0)
break;
}
@@ -1927,7 +1932,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table,
size = total_size;
xt_entry_foreach(iter, loc_cpu_entry, total_size) {
ret = compat_copy_entry_to_user(iter, &pos,
- &size, counters, i++);
+ &size, counters, i++);
if (ret != 0)
break;
}
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index f704286..9210e31 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -866,8 +866,10 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter, entry0, newinfo->size) {
ret = check_entry_size_and_hooks(iter, newinfo, entry0,
- entry0 + repl->size, repl->hook_entry, repl->underflow,
- repl->valid_hooks);
+ entry0 + repl->size,
+ repl->hook_entry,
+ repl->underflow,
+ repl->valid_hooks);
if (ret != 0)
return ret;
++i;
@@ -948,7 +950,7 @@ get_counters(const struct xt_table_info *t,
i = 0;
xt_entry_foreach(iter, t->entries[curcpu], t->size) {
SET_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i;
}
@@ -959,7 +961,7 @@ get_counters(const struct xt_table_info *t,
xt_info_wrlock(cpu);
xt_entry_foreach(iter, t->entries[cpu], t->size) {
ADD_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ iter->counters.pcnt);
++i;
}
xt_info_wrunlock(cpu);
@@ -1573,7 +1575,7 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
j = 0;
xt_ematch_foreach(ematch, e) {
ret = compat_find_calc_match(ematch, name,
- &e->ipv6, e->comefrom, &off);
+ &e->ipv6, e->comefrom, &off);
if (ret != 0)
goto release_matches;
++j;
@@ -1734,8 +1736,11 @@ translate_compat_table(struct net *net,
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter0, entry0, total_size) {
ret = check_compat_entry_size_and_hooks(iter0, info, &size,
- entry0, entry0 + total_size, hook_entries, underflows,
- name);
+ entry0,
+ entry0 + total_size,
+ hook_entries,
+ underflows,
+ name);
if (ret != 0)
goto out_unlock;
++j;
@@ -1779,8 +1784,8 @@ translate_compat_table(struct net *net,
pos = entry1;
size = total_size;
xt_entry_foreach(iter0, entry0, total_size) {
- ret = compat_copy_entry_from_user(iter0, &pos,
- &size, name, newinfo, entry1);
+ ret = compat_copy_entry_from_user(iter0, &pos, &size,
+ name, newinfo, entry1);
if (ret != 0)
break;
}
@@ -1960,7 +1965,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table,
size = total_size;
xt_entry_foreach(iter, loc_cpu_entry, total_size) {
ret = compat_copy_entry_to_user(iter, &pos,
- &size, counters, i++);
+ &size, counters, i++);
if (ret != 0)
break;
}
^ permalink raw reply related
* netfilter 02/03: nfnetlink_log: fix silly refcount leak
From: Patrick McHardy @ 2010-02-26 17:15 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
In-Reply-To: <20100226171521.30040.76590.sendpatchset@x2.localnet>
commit a49c65037146bfb2fe300b8277b10b4479fea5fc
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date: Fri Feb 26 17:48:40 2010 +0100
netfilter: nfnetlink_log: fix silly refcount leak
Quick fix for memory/module refcount leak.
Reference count of listener instance never reaches 0.
Start/stop of ulogd2 is enough to trigger this bug!
Now, refcounting there looks very fishy in particular this code:
if (!try_module_get(THIS_MODULE)) {
...
and creation of listener instance with refcount 2,
so it may very well be ripped and redone. :-)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 285e902..d9b8fb8 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -768,7 +768,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
}
instance_destroy(inst);
- goto out;
+ goto out_put;
default:
ret = -ENOTSUPP;
break;
^ permalink raw reply related
* IPVS 01/03: ip_vs_lblcr: use list headA
From: Patrick McHardy @ 2010-02-26 17:15 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
In-Reply-To: <20100226171521.30040.76590.sendpatchset@x2.localnet>
commit 51f0bc78680edccb6574ef56bd32f9e2939c8a5a
Author: Simon Horman <horms@verge.net.au>
Date: Fri Feb 26 17:45:14 2010 +0100
IPVS: ip_vs_lblcr: use list headA
Use list_head rather than a custom list implementation.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index f7476b9..caa58fa 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -45,6 +45,7 @@
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/jiffies.h>
+#include <linux/list.h>
/* for sysctl */
#include <linux/fs.h>
@@ -85,25 +86,25 @@ static int sysctl_ip_vs_lblcr_expiration = 24*60*60*HZ;
/*
* IPVS destination set structure and operations
*/
-struct ip_vs_dest_list {
- struct ip_vs_dest_list *next; /* list link */
+struct ip_vs_dest_set_elem {
+ struct list_head list; /* list link */
struct ip_vs_dest *dest; /* destination server */
};
struct ip_vs_dest_set {
atomic_t size; /* set size */
unsigned long lastmod; /* last modified time */
- struct ip_vs_dest_list *list; /* destination list */
+ struct list_head list; /* destination list */
rwlock_t lock; /* lock for this list */
};
-static struct ip_vs_dest_list *
+static struct ip_vs_dest_set_elem *
ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
{
- struct ip_vs_dest_list *e;
+ struct ip_vs_dest_set_elem *e;
- for (e=set->list; e!=NULL; e=e->next) {
+ list_for_each_entry(e, &set->list, list) {
if (e->dest == dest)
/* already existed */
return NULL;
@@ -118,9 +119,7 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
atomic_inc(&dest->refcnt);
e->dest = dest;
- /* link it to the list */
- e->next = set->list;
- set->list = e;
+ list_add(&e->list, &set->list);
atomic_inc(&set->size);
set->lastmod = jiffies;
@@ -130,34 +129,33 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
static void
ip_vs_dest_set_erase(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
{
- struct ip_vs_dest_list *e, **ep;
+ struct ip_vs_dest_set_elem *e;
- for (ep=&set->list, e=*ep; e!=NULL; e=*ep) {
+ list_for_each_entry(e, &set->list, list) {
if (e->dest == dest) {
/* HIT */
- *ep = e->next;
atomic_dec(&set->size);
set->lastmod = jiffies;
atomic_dec(&e->dest->refcnt);
+ list_del(&e->list);
kfree(e);
break;
}
- ep = &e->next;
}
}
static void ip_vs_dest_set_eraseall(struct ip_vs_dest_set *set)
{
- struct ip_vs_dest_list *e, **ep;
+ struct ip_vs_dest_set_elem *e, *ep;
write_lock(&set->lock);
- for (ep=&set->list, e=*ep; e!=NULL; e=*ep) {
- *ep = e->next;
+ list_for_each_entry_safe(e, ep, &set->list, list) {
/*
* We don't kfree dest because it is refered either
* by its service or by the trash dest list.
*/
atomic_dec(&e->dest->refcnt);
+ list_del(&e->list);
kfree(e);
}
write_unlock(&set->lock);
@@ -166,7 +164,7 @@ static void ip_vs_dest_set_eraseall(struct ip_vs_dest_set *set)
/* get weighted least-connection node in the destination set */
static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set)
{
- register struct ip_vs_dest_list *e;
+ register struct ip_vs_dest_set_elem *e;
struct ip_vs_dest *dest, *least;
int loh, doh;
@@ -174,7 +172,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set)
return NULL;
/* select the first destination server, whose weight > 0 */
- for (e=set->list; e!=NULL; e=e->next) {
+ list_for_each_entry(e, &set->list, list) {
least = e->dest;
if (least->flags & IP_VS_DEST_F_OVERLOAD)
continue;
@@ -190,7 +188,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set)
/* find the destination with the weighted least load */
nextstage:
- for (e=e->next; e!=NULL; e=e->next) {
+ list_for_each_entry(e, &set->list, list) {
dest = e->dest;
if (dest->flags & IP_VS_DEST_F_OVERLOAD)
continue;
@@ -220,7 +218,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set)
/* get weighted most-connection node in the destination set */
static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set)
{
- register struct ip_vs_dest_list *e;
+ register struct ip_vs_dest_set_elem *e;
struct ip_vs_dest *dest, *most;
int moh, doh;
@@ -228,7 +226,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set)
return NULL;
/* select the first destination server, whose weight > 0 */
- for (e=set->list; e!=NULL; e=e->next) {
+ list_for_each_entry(e, &set->list, list) {
most = e->dest;
if (atomic_read(&most->weight) > 0) {
moh = atomic_read(&most->activeconns) * 50
@@ -240,7 +238,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set)
/* find the destination with the weighted most load */
nextstage:
- for (e=e->next; e!=NULL; e=e->next) {
+ list_for_each_entry(e, &set->list, list) {
dest = e->dest;
doh = atomic_read(&dest->activeconns) * 50
+ atomic_read(&dest->inactconns);
@@ -389,7 +387,7 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr,
/* initilize its dest set */
atomic_set(&(en->set.size), 0);
- en->set.list = NULL;
+ INIT_LIST_HEAD(&en->set.list);
rwlock_init(&en->set.lock);
ip_vs_lblcr_hash(tbl, en);
^ permalink raw reply related
* netfilter 00/03: netfilter update
From: Patrick McHardy @ 2010-02-26 17:15 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
Hi Dave,
following are a few more late patches for netfilter, containing:
- Simon's list_head conversion in ip_vs_lblcr
- a patch to restore indentation in xtables from Jan
- a nfnetlink_log reference count fix from Alexey
I'll send all relevant fixes from this and the last nf-next updates
to -stable once they appear in mainline.
Please apply or pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6.git master
Thanks!
net/ipv4/netfilter/arp_tables.c | 23 ++++++++++++-------
net/ipv4/netfilter/ip_tables.c | 25 +++++++++++++--------
net/ipv6/netfilter/ip6_tables.c | 25 +++++++++++++--------
net/netfilter/ipvs/ip_vs_lblcr.c | 44 ++++++++++++++++++-------------------
net/netfilter/nfnetlink_log.c | 2 +-
5 files changed, 66 insertions(+), 53 deletions(-)
Alexey Dobriyan (1):
netfilter: nfnetlink_log: fix silly refcount leak
Jan Engelhardt (1):
netfilter: xtables: restore indentation
Simon Horman (1):
IPVS: ip_vs_lblcr: use list headA
^ permalink raw reply
* Re: [PATCH] isa-skelton: Remove a wrong netif_wake_queue() call
From: Jeff Garzik @ 2010-02-26 17:03 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: netdev, David Miller
In-Reply-To: <1267027217-7812-1-git-send-email-anemo@mba.ocn.ne.jp>
On 02/24/2010 11:00 AM, Atsushi Nemoto wrote:
> The netif_wake_queue() is called correctly (i.e. only on !txfull
> condition) from net_tx(). So Unconditional call to the
> netif_wake_queue() here is wrong. This might cause calling of
> start_xmit routine on txfull state and trigger tx-ring overflow.
>
> This fix is ported from commit 662a96bd6f020782dfbdc0d0bd177c7dbb556687.
>
> Signed-off-by: Atsushi Nemoto<anemo@mba.ocn.ne.jp>
> ---
> drivers/net/isa-skeleton.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c
> index 04d0502..3f33c90 100644
> --- a/drivers/net/isa-skeleton.c
> +++ b/drivers/net/isa-skeleton.c
> @@ -536,7 +536,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
> /* Transmit complete. */
> net_tx(dev);
> np->stats.tx_packets++;
> - netif_wake_queue(dev);
> }
> #endif
I would suggest deleting this "driver" entirely... Any new drivers
remotely like ISA would use the platform API and look more like a PCI
driver.
Jeff
^ permalink raw reply
* Re: [Bridge] [RFC 0/5] bridge - introduce via_phys_dev feature
From: richardvoigt @ 2010-02-26 16:52 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Cyrill Gorcunov, netdev, bridge
In-Reply-To: <20100226081843.07f37742@nehalam>
On Fri, Feb 26, 2010 at 10:18 AM, Stephen Hemminger
<shemminger@linux-foundation.org> wrote:
> Looking back at this. What if the API was simpler:
>
> Instead of:
>> Typical session looks like
>>
>> | s...@10.10.0.160$ brctl addbr br0
>> | s...@10.10.0.160$ ifconfig br0 up
>> | s...@10.10.0.160$ echo 1 > /sys/class/net/bridge/br0/via_phys_dev
>> | s...@10.10.0.160$ brctl addif br0 eth0
>> | (...waiting a bit...)
>> | s...@10.10.0.160$
>
> Why not:
> 1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
> 2. Add eth0 to bridge with new flag to inherit
> a. brctl addif br0 eth0 inherit
>
> Inherit functionality would need to move address (Ether, IP, IPv6)
> and routes from eth0 to br0.
> I will see about doing it as much as possible in userspace.
How about inheriting the up/down status as well, this way the bridge
can be left down until the settings are inherited, and will come up
with the inherited MAC address, IP address, and routing table instead
of changing while live?
> _______________________________________________
> Bridge mailing list
> Bridge@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/bridge
>
^ permalink raw reply
* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: Cyrill Gorcunov @ 2010-02-26 16:51 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: bridge, netdev, Pavel Emelyanov, Denis Lunev
In-Reply-To: <20100226081843.07f37742@nehalam>
On Fri, Feb 26, 2010 at 08:18:43AM -0800, Stephen Hemminger wrote:
> Looking back at this. What if the API was simpler:
>
> Instead of:
> > Typical session looks like
> >
> > | s...@10.10.0.160$ brctl addbr br0
> > | s...@10.10.0.160$ ifconfig br0 up
> > | s...@10.10.0.160$ echo 1 > /sys/class/net/bridge/br0/via_phys_dev
> > | s...@10.10.0.160$ brctl addif br0 eth0
> > | (...waiting a bit...)
> > | s...@10.10.0.160$
>
> Why not:
> 1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
> 2. Add eth0 to bridge with new flag to inherit
> a. brctl addif br0 eth0 inherit
>
> Inherit functionality would need to move address (Ether, IP, IPv6)
> and routes from eth0 to br0.
> I will see about doing it as much as possible in userspace.
>
Looks promising for me (CC'ed a few people just to be sure I'm not
missing anything).
-- Cyrill
^ permalink raw reply
* Re: [patch] IPVS: ip_vs_lblcr: use list head
From: Patrick McHardy @ 2010-02-26 16:45 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, lvs-devel, Wensong Zhang, Julian Anastasov,
David S. Miller
In-Reply-To: <20100226030211.GB6111@verge.net.au>
Simon Horman wrote:
> Use list_head rather than a custom list implementation.
Looks good, applied.
^ permalink raw reply
* net 04/04: rtnetlink: support specifying device flags on device creation
From: Patrick McHardy @ 2010-02-26 16:34 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
In-Reply-To: <20100226163449.11434.13013.sendpatchset@x2.localnet>
commit e8469ed959c373c2ff9e6f488aa5a14971aebe1f
Author: Patrick McHardy <kaber@trash.net>
Date: Tue Feb 23 20:41:30 2010 +0100
net: rtnetlink: support specifying device flags on device creation
Support specifying the initial device flags when creating a device though
rtnl_link. Devices allocated by rtnl_create_link() are marked as INITIALIZING
in order to surpress netlink registration notifications. To complete setup,
rtnl_configure_link() must be called, which performs the device flag changes
and invokes the deferred notifiers if everything went well.
Two examples:
# add macvlan to eth0
#
$ ip link add link eth0 up allmulticast on type macvlan
[LINK]11: macvlan0@eth0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 26:f8:84:02:f9:2a brd ff:ff:ff:ff:ff:ff
[ROUTE]ff00::/8 dev macvlan0 table local metric 256 mtu 1500 advmss 1440 hoplimit 0
[ROUTE]fe80::/64 dev macvlan0 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit 0
[LINK]11: macvlan0@eth0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500
link/ether 26:f8:84:02:f9:2a
[ADDR]11: macvlan0 inet6 fe80::24f8:84ff:fe02:f92a/64 scope link
valid_lft forever preferred_lft forever
[ROUTE]local fe80::24f8:84ff:fe02:f92a via :: dev lo table local proto none metric 0 mtu 16436 advmss 16376 hoplimit 0
[ROUTE]default via fe80::215:e9ff:fef0:10f8 dev macvlan0 proto kernel metric 1024 mtu 1500 advmss 1440 hoplimit 0
[NEIGH]fe80::215:e9ff:fef0:10f8 dev macvlan0 lladdr 00:15:e9:f0:10:f8 router STALE
[ROUTE]2001:6f8:974::/64 dev macvlan0 proto kernel metric 256 expires 0sec mtu 1500 advmss 1440 hoplimit 0
[PREFIX]prefix 2001:6f8:974::/64 dev macvlan0 onlink autoconf valid 14400 preferred 131084
[ADDR]11: macvlan0 inet6 2001:6f8:974:0:24f8:84ff:fe02:f92a/64 scope global dynamic
valid_lft 86399sec preferred_lft 14399sec
# add VLAN to eth1, eth1 is down
#
$ ip link add link eth1 up type vlan id 1000
RTNETLINK answers: Network is down
<no events>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 35609e6..b583d49 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -333,19 +333,17 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
struct veth_priv *priv;
char ifname[IFNAMSIZ];
struct nlattr *peer_tb[IFLA_MAX + 1], **tbp;
+ struct ifinfomsg *ifmp;
struct net *net;
/*
* create and register peer first
- *
- * struct ifinfomsg is at the head of VETH_INFO_PEER, but we
- * skip it since no info from it is useful yet
*/
-
if (data != NULL && data[VETH_INFO_PEER] != NULL) {
struct nlattr *nla_peer;
nla_peer = data[VETH_INFO_PEER];
+ ifmp = nla_data(nla_peer);
err = nla_parse(peer_tb, IFLA_MAX,
nla_data(nla_peer) + sizeof(struct ifinfomsg),
nla_len(nla_peer) - sizeof(struct ifinfomsg),
@@ -358,8 +356,10 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
return err;
tbp = peer_tb;
- } else
+ } else {
+ ifmp = NULL;
tbp = tb;
+ }
if (tbp[IFLA_IFNAME])
nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
@@ -387,6 +387,10 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
netif_carrier_off(peer);
+ err = rtnl_configure_link(peer, ifmp);
+ if (err < 0)
+ goto err_configure_peer;
+
/*
* register dev last
*
@@ -428,6 +432,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
err_register_dev:
/* nothing to do */
err_alloc_name:
+err_configure_peer:
unregister_netdevice(peer);
return err;
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 48d3efc..af60fd0 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -87,6 +87,8 @@ extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
+extern int rtnl_configure_link(struct net_device *dev,
+ const struct ifinfomsg *ifm);
extern const struct nla_policy ifla_policy[IFLA_MAX+1];
#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index c21ec42..d1472a4 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -549,6 +549,19 @@ static void set_operstate(struct net_device *dev, unsigned char transition)
}
}
+static unsigned int rtnl_dev_combine_flags(const struct net_device *dev,
+ const struct ifinfomsg *ifm)
+{
+ unsigned int flags = ifm->ifi_flags;
+
+ /* bugwards compatibility: ifi_change == 0 is treated as ~0 */
+ if (ifm->ifi_change)
+ flags = (flags & ifm->ifi_change) |
+ (dev->flags & ~ifm->ifi_change);
+
+ return flags;
+}
+
static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
const struct net_device_stats *b)
{
@@ -904,13 +917,7 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
}
if (ifm->ifi_flags || ifm->ifi_change) {
- unsigned int flags = ifm->ifi_flags;
-
- /* bugwards compatibility: ifi_change == 0 is treated as ~0 */
- if (ifm->ifi_change)
- flags = (flags & ifm->ifi_change) |
- (dev->flags & ~ifm->ifi_change);
- err = dev_change_flags(dev, flags);
+ err = dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm));
if (err < 0)
goto errout;
}
@@ -1053,6 +1060,26 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
return 0;
}
+int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm)
+{
+ unsigned int old_flags;
+ int err;
+
+ old_flags = dev->flags;
+ if (ifm && (ifm->ifi_flags || ifm->ifi_change)) {
+ err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm));
+ if (err < 0)
+ return err;
+ }
+
+ dev->rtnl_link_state = RTNL_LINK_INITIALIZED;
+ rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
+
+ __dev_notify_flags(dev, old_flags);
+ return 0;
+}
+EXPORT_SYMBOL(rtnl_configure_link);
+
struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[])
{
@@ -1074,6 +1101,7 @@ struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
dev_net_set(dev, net);
dev->rtnl_link_ops = ops;
+ dev->rtnl_link_state = RTNL_LINK_INITIALIZING;
dev->real_num_tx_queues = real_num_queues;
if (strchr(dev->name, '%')) {
@@ -1203,7 +1231,7 @@ replay:
if (!(nlh->nlmsg_flags & NLM_F_CREATE))
return -ENODEV;
- if (ifm->ifi_index || ifm->ifi_flags || ifm->ifi_change)
+ if (ifm->ifi_index)
return -EOPNOTSUPP;
if (tb[IFLA_MAP] || tb[IFLA_MASTER] || tb[IFLA_PROTINFO])
return -EOPNOTSUPP;
@@ -1234,9 +1262,15 @@ replay:
err = ops->newlink(net, dev, tb, data);
else
err = register_netdevice(dev);
- if (err < 0 && !IS_ERR(dev))
+ if (err < 0 && !IS_ERR(dev)) {
free_netdev(dev);
+ goto out;
+ }
+ err = rtnl_configure_link(dev, ifm);
+ if (err < 0)
+ unregister_netdevice(dev);
+out:
put_net(dest_net);
return err;
}
^ permalink raw reply related
* net 03/04: dev: support deferring device flag change notifications
From: Patrick McHardy @ 2010-02-26 16:34 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
In-Reply-To: <20100226163449.11434.13013.sendpatchset@x2.localnet>
commit 18c626db4551a23d1f848adafad41e44388b6c2f
Author: Patrick McHardy <kaber@trash.net>
Date: Wed Feb 24 15:51:55 2010 +0100
net: dev: support deferring device flag change notifications
Split dev_change_flags() into two functions: __dev_change_flags() to
perform the actual changes and __dev_notify_flags() to invoke netdevice
notifiers. This will be used by rtnl_link to defer netlink notifications
until the device has been fully configured.
This changes ordering of some operations, in particular:
- netlink notifications are sent after all changes have been performed.
As a side effect this surpresses one unnecessary netlink message when
the IFF_UP and other flags are changed simultaneously.
- The NETDEV_UP/NETDEV_DOWN and NETDEV_CHANGE notifiers are invoked
after all changes have been performed. Their relative is unchanged.
- net_dmaengine_put() is invoked before the NETDEV_DOWN notifier instead
of afterwards. This should not make any difference since both RX and TX
are already shut down at this point.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 19af5fb..bab133d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1587,7 +1587,9 @@ extern int dev_valid_name(const char *name);
extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
extern int dev_ethtool(struct net *net, struct ifreq *);
extern unsigned dev_get_flags(const struct net_device *);
+extern int __dev_change_flags(struct net_device *, unsigned int flags);
extern int dev_change_flags(struct net_device *, unsigned);
+extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
extern int dev_change_name(struct net_device *, const char *);
extern int dev_set_alias(struct net_device *, const char *, size_t);
extern int dev_change_net_namespace(struct net_device *,
diff --git a/net/core/dev.c b/net/core/dev.c
index 75332b0..e5972f7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1113,19 +1113,7 @@ void dev_load(struct net *net, const char *name)
}
EXPORT_SYMBOL(dev_load);
-/**
- * dev_open - prepare an interface for use.
- * @dev: device to open
- *
- * Takes a device from down to up state. The device's private open
- * function is invoked and then the multicast lists are loaded. Finally
- * the device is moved into the up state and a %NETDEV_UP message is
- * sent to the netdev notifier chain.
- *
- * Calling this function on an active interface is a nop. On a failure
- * a negative errno code is returned.
- */
-int dev_open(struct net_device *dev)
+static int __dev_open(struct net_device *dev)
{
const struct net_device_ops *ops = dev->netdev_ops;
int ret;
@@ -1133,13 +1121,6 @@ int dev_open(struct net_device *dev)
ASSERT_RTNL();
/*
- * Is it already up?
- */
-
- if (dev->flags & IFF_UP)
- return 0;
-
- /*
* Is it even present?
*/
if (!netif_device_present(dev))
@@ -1187,36 +1168,57 @@ int dev_open(struct net_device *dev)
* Wakeup transmit queue engine
*/
dev_activate(dev);
-
- /*
- * ... and announce new interface.
- */
- call_netdevice_notifiers(NETDEV_UP, dev);
}
return ret;
}
-EXPORT_SYMBOL(dev_open);
/**
- * dev_close - shutdown an interface.
- * @dev: device to shutdown
+ * dev_open - prepare an interface for use.
+ * @dev: device to open
*
- * This function moves an active device into down state. A
- * %NETDEV_GOING_DOWN is sent to the netdev notifier chain. The device
- * is then deactivated and finally a %NETDEV_DOWN is sent to the notifier
- * chain.
+ * Takes a device from down to up state. The device's private open
+ * function is invoked and then the multicast lists are loaded. Finally
+ * the device is moved into the up state and a %NETDEV_UP message is
+ * sent to the netdev notifier chain.
+ *
+ * Calling this function on an active interface is a nop. On a failure
+ * a negative errno code is returned.
*/
-int dev_close(struct net_device *dev)
+int dev_open(struct net_device *dev)
+{
+ int ret;
+
+ /*
+ * Is it already up?
+ */
+ if (dev->flags & IFF_UP)
+ return 0;
+
+ /*
+ * Open device
+ */
+ ret = __dev_open(dev);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ... and announce new interface.
+ */
+ rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
+ call_netdevice_notifiers(NETDEV_UP, dev);
+
+ return ret;
+}
+EXPORT_SYMBOL(dev_open);
+
+static int __dev_close(struct net_device *dev)
{
const struct net_device_ops *ops = dev->netdev_ops;
- ASSERT_RTNL();
+ ASSERT_RTNL();
might_sleep();
- if (!(dev->flags & IFF_UP))
- return 0;
-
/*
* Tell people we are going down, so that they can
* prepare to death, when device is still operating.
@@ -1252,14 +1254,34 @@ int dev_close(struct net_device *dev)
dev->flags &= ~IFF_UP;
/*
- * Tell people we are down
+ * Shutdown NET_DMA
*/
- call_netdevice_notifiers(NETDEV_DOWN, dev);
+ net_dmaengine_put();
+
+ return 0;
+}
+
+/**
+ * dev_close - shutdown an interface.
+ * @dev: device to shutdown
+ *
+ * This function moves an active device into down state. A
+ * %NETDEV_GOING_DOWN is sent to the netdev notifier chain. The device
+ * is then deactivated and finally a %NETDEV_DOWN is sent to the notifier
+ * chain.
+ */
+int dev_close(struct net_device *dev)
+{
+ if (!(dev->flags & IFF_UP))
+ return 0;
+
+ __dev_close(dev);
/*
- * Shutdown NET_DMA
+ * Tell people we are down
*/
- net_dmaengine_put();
+ rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
+ call_netdevice_notifiers(NETDEV_DOWN, dev);
return 0;
}
@@ -4299,18 +4321,10 @@ unsigned dev_get_flags(const struct net_device *dev)
}
EXPORT_SYMBOL(dev_get_flags);
-/**
- * dev_change_flags - change device settings
- * @dev: device
- * @flags: device state flags
- *
- * Change settings on device based state flags. The flags are
- * in the userspace exported format.
- */
-int dev_change_flags(struct net_device *dev, unsigned flags)
+int __dev_change_flags(struct net_device *dev, unsigned int flags)
{
- int ret, changes;
int old_flags = dev->flags;
+ int ret;
ASSERT_RTNL();
@@ -4341,17 +4355,12 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
ret = 0;
if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
- ret = ((old_flags & IFF_UP) ? dev_close : dev_open)(dev);
+ ret = ((old_flags & IFF_UP) ? __dev_close : __dev_open)(dev);
if (!ret)
dev_set_rx_mode(dev);
}
- if (dev->flags & IFF_UP &&
- ((old_flags ^ dev->flags) & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
- IFF_VOLATILE)))
- call_netdevice_notifiers(NETDEV_CHANGE, dev);
-
if ((flags ^ dev->gflags) & IFF_PROMISC) {
int inc = (flags & IFF_PROMISC) ? 1 : -1;
@@ -4370,11 +4379,47 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
dev_set_allmulti(dev, inc);
}
- /* Exclude state transition flags, already notified */
- changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
+ return ret;
+}
+
+void __dev_notify_flags(struct net_device *dev, unsigned int old_flags)
+{
+ unsigned int changes = dev->flags ^ old_flags;
+
+ if (changes & IFF_UP) {
+ if (dev->flags & IFF_UP)
+ call_netdevice_notifiers(NETDEV_UP, dev);
+ else
+ call_netdevice_notifiers(NETDEV_DOWN, dev);
+ }
+
+ if (dev->flags & IFF_UP &&
+ (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE)))
+ call_netdevice_notifiers(NETDEV_CHANGE, dev);
+}
+
+/**
+ * dev_change_flags - change device settings
+ * @dev: device
+ * @flags: device state flags
+ *
+ * Change settings on device based state flags. The flags are
+ * in the userspace exported format.
+ */
+int dev_change_flags(struct net_device *dev, unsigned flags)
+{
+ int ret, changes;
+ int old_flags = dev->flags;
+
+ ret = __dev_change_flags(dev, flags);
+ if (ret < 0)
+ return ret;
+
+ changes = old_flags ^ dev->flags;
if (changes)
rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
+ __dev_notify_flags(dev, old_flags);
return ret;
}
EXPORT_SYMBOL(dev_change_flags);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 020e43b..c21ec42 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1427,8 +1427,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
switch (event) {
case NETDEV_UP:
case NETDEV_DOWN:
- rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
- break;
case NETDEV_PRE_UP:
case NETDEV_POST_INIT:
case NETDEV_REGISTER:
^ permalink raw reply related
* net 02/04: rtnetlink: handle rtnl_link netlink notifications manually
From: Patrick McHardy @ 2010-02-26 16:34 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
In-Reply-To: <20100226163449.11434.13013.sendpatchset@x2.localnet>
commit d1a41c4805fd5850156668114d42d7a51964926a
Author: Patrick McHardy <kaber@trash.net>
Date: Wed Feb 24 13:52:52 2010 +0100
net: rtnetlink: handle rtnl_link netlink notifications manually
In order to support specifying device flags during device creation,
we must be able to roll back device registration in case setting the
flags fails without sending any notifications related to the device
to userspace.
This patch changes rollback_registered_many() and register_netdevice()
to manually send netlink notifications for devices not handled by
rtnl_link and allows to defer notifications for devices handled by
rtnl_link until setup is complete.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 682d025..19af5fb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -924,7 +924,12 @@ struct net_device {
NETREG_UNREGISTERED, /* completed unregister todo */
NETREG_RELEASED, /* called free_netdev */
NETREG_DUMMY, /* dummy device for NAPI poll */
- } reg_state;
+ } reg_state:16;
+
+ enum {
+ RTNL_LINK_INITIALIZED,
+ RTNL_LINK_INITIALIZING,
+ } rtnl_link_state:16;
/* Called from unregister, can be used to call free_netdev */
void (*destructor)(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index eb7f1a4..75332b0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4865,6 +4865,10 @@ static void rollback_registered_many(struct list_head *head)
*/
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
+ if (!dev->rtnl_link_ops ||
+ dev->rtnl_link_state == RTNL_LINK_INITIALIZED)
+ rtmsg_ifinfo(RTM_DELLINK, dev, ~0U);
+
/*
* Flush the unicast and multicast chains
*/
@@ -5091,7 +5095,9 @@ int register_netdevice(struct net_device *dev)
* Prevent userspace races by waiting until the network
* device is fully setup before sending notifications.
*/
- rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
+ if (!dev->rtnl_link_ops ||
+ dev->rtnl_link_state == RTNL_LINK_INITIALIZED)
+ rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
out:
return ret;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b7c7dfd..020e43b 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1425,9 +1425,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
struct net_device *dev = ptr;
switch (event) {
- case NETDEV_UNREGISTER:
- rtmsg_ifinfo(RTM_DELLINK, dev, ~0U);
- break;
case NETDEV_UP:
case NETDEV_DOWN:
rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
@@ -1437,6 +1434,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
case NETDEV_REGISTER:
case NETDEV_CHANGE:
case NETDEV_GOING_DOWN:
+ case NETDEV_UNREGISTER:
case NETDEV_UNREGISTER_BATCH:
break;
default:
^ permalink raw reply related
* net 01/04: rtnetlink: ignore NETDEV_PRE_UP notifier in rtnetlink_event()
From: Patrick McHardy @ 2010-02-26 16:34 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
In-Reply-To: <20100226163449.11434.13013.sendpatchset@x2.localnet>
commit 140dcbaa692be4ce66e68624d438aed030184186
Author: Patrick McHardy <kaber@trash.net>
Date: Tue Feb 23 20:56:39 2010 +0100
net: rtnetlink: ignore NETDEV_PRE_UP notifier in rtnetlink_event()
Commit 3b8bcfd (net: introduce pre-up netdev notifier) added a new
notifier which is run before a device is set UP for use by cfg80211.
The patch missed to add the new notifier to the ignore list in
rtnetlink_event(), so we currently get an unnecessary netlink
notification before a device is set UP.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4dd4c3c..b7c7dfd 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1432,6 +1432,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
case NETDEV_DOWN:
rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
break;
+ case NETDEV_PRE_UP:
case NETDEV_POST_INIT:
case NETDEV_REGISTER:
case NETDEV_CHANGE:
^ permalink raw reply related
* net: rtnetlink: support specifying device flags on device creation
From: Patrick McHardy @ 2010-02-26 16:34 UTC (permalink / raw)
To: netdev; +Cc: Patrick McHardy
The following patches add support to specify the device flags (like UP) when
creating a new device through rtnl_link. This requires to surpress netlink
notifications until the device is fully configured in order to not confuse
userspace when changing the flags fails and registration has to be undone.
Once the device is configured, a single NEWLINK message with the full state
is sent.
The individual patch changelogs describe the necessary changes in more detail.
drivers/net/veth.c | 15 +++--
include/linux/netdevice.h | 9 ++-
include/net/rtnetlink.h | 2 +
net/core/dev.c | 171 +++++++++++++++++++++++++++++----------------
net/core/rtnetlink.c | 59 ++++++++++++----
5 files changed, 176 insertions(+), 80 deletions(-)
Patrick McHardy (4):
net: rtnetlink: ignore NETDEV_PRE_UP notifier in rtnetlink_event()
net: rtnetlink: handle rtnl_link netlink notifications manually
net: dev: support deferring device flag change notifications
net: rtnetlink: support specifying device flags on device creation
^ permalink raw reply
* Re: Gianfar driver failing on MPC8641D based board
From: Paul Gortmaker @ 2010-02-26 16:27 UTC (permalink / raw)
To: avorontsov
Cc: Martyn Welch, netdev, linux-kernel, linuxppc-dev list,
Sandeep Gopalpet, davem
In-Reply-To: <20100226161058.GA22954@oksana.dev.rtsoft.ru>
On 10-02-26 11:10 AM, Anton Vorontsov wrote:
> On Fri, Feb 26, 2010 at 03:34:07PM +0000, Martyn Welch wrote:
> [...]
>> Out of 10 boot attempts, 7 failed.
>
> OK, I see why. With ip=on (dhcp boot) it's much harder to trigger
> it. With static ip config can I see the same.
I'd kind of expected to see us stuck in gianfar on that lock, but
the SysRQ-T doesn't show us hung up anywhere in gianfar itself.
[This was on a base 2.6.33, with just a small sysrq fix patch]
Paul.
----------
SysRq : Changing Loglevel
Loglevel set to 9
nfs: server not responding, still trying
SysRq : Show State
task PC stack pid father
init D 0ff1c380 0 1 0 0x00000000
Call Trace:
[df841a30] [c0009fc4] __switch_to+0x8c/0xf8
[df841a50] [c0350160] schedule+0x354/0x92c
[df841ae0] [c0331394] rpc_wait_bit_killable+0x2c/0x54
[df841af0] [c0350eb0] __wait_on_bit+0x9c/0x108
[df841b10] [c0350fc0] out_of_line_wait_on_bit+0xa4/0xb4
[df841b40] [c0331cf0] __rpc_execute+0x16c/0x398
[df841b90] [c0329abc] rpc_run_task+0x48/0x9c
[df841ba0] [c0329c40] rpc_call_sync+0x54/0x88
[df841bd0] [c015e780] nfs_proc_lookup+0x94/0xe8
[df841c20] [c014eb60] nfs_lookup+0x12c/0x230
[df841d50] [c00b9680] do_lookup+0x118/0x288
[df841d80] [c00bb904] link_path_walk+0x194/0x1118
[df841df0] [c00bcb08] path_walk+0x8c/0x168
[df841e20] [c00bcd6c] do_path_lookup+0x74/0x7c
[df841e40] [c00be148] do_filp_open+0x5d4/0xba4
[df841f10] [c00abe94] do_sys_open+0xac/0x190
[df841f40] [c001437c] ret_from_syscall+0x0/0x38
--- Exception: c01 at 0xff1c380
LR = 0xfec6d98
kthreadd S 00000000 0 2 0 0x00000000
Call Trace:
[df843e50] [c002e788] wake_up_new_task+0x128/0x16c (unreliable)
[df843f10] [c0009fc4] __switch_to+0x8c/0xf8
[df843f30] [c0350160] schedule+0x354/0x92c
[df843fc0] [c004d154] kthreadd+0x130/0x134
[df843ff0] [c00141a0] kernel_thread+0x4c/0x68
migration/0 S 00000000 0 3 2 0x00000000
Call Trace:
[df847de0] [ffffffff] 0xffffffff (unreliable)
[df847ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df847ec0] [c0350160] schedule+0x354/0x92c
[df847f50] [c002d074] migration_thread+0x29c/0x448
[df847fb0] [c004d020] kthread+0x80/0x84
[df847ff0] [c00141a0] kernel_thread+0x4c/0x68
ksoftirqd/0 S 00000000 0 4 2 0x00000000
Call Trace:
[df84be10] [00000800] 0x800 (unreliable)
[df84bed0] [c0009fc4] __switch_to+0x8c/0xf8
[df84bef0] [c0350160] schedule+0x354/0x92c
[df84bf80] [c0038454] run_ksoftirqd+0x14c/0x1e0
[df84bfb0] [c004d020] kthread+0x80/0x84
[df84bff0] [c00141a0] kernel_thread+0x4c/0x68
watchdog/0 S 00000000 0 5 2 0x00000000
Call Trace:
[df84dee0] [c0009fc4] __switch_to+0x8c/0xf8
[df84df00] [c0350160] schedule+0x354/0x92c
[df84df90] [c006b8e8] watchdog+0x48/0x88
[df84dfb0] [c004d020] kthread+0x80/0x84
[df84dff0] [c00141a0] kernel_thread+0x4c/0x68
migration/1 S 00000000 0 6 2 0x00000000
Call Trace:
[df84fea0] [c0009fc4] __switch_to+0x8c/0xf8
[df84fec0] [c0350160] schedule+0x354/0x92c
[df84ff50] [c002d074] migration_thread+0x29c/0x448
[df84ffb0] [c004d020] kthread+0x80/0x84
[df84fff0] [c00141a0] kernel_thread+0x4c/0x68
ksoftirqd/1 S 00000000 0 7 2 0x00000000
Call Trace:
[df853ed0] [c0009fc4] __switch_to+0x8c/0xf8
[df853ef0] [c0350160] schedule+0x354/0x92c
[df853f80] [c0038454] run_ksoftirqd+0x14c/0x1e0
[df853fb0] [c004d020] kthread+0x80/0x84
[df853ff0] [c00141a0] kernel_thread+0x4c/0x68
watchdog/1 S 00000000 0 8 2 0x00000000
Call Trace:
[df857ee0] [c0009fc4] __switch_to+0x8c/0xf8
[df857f00] [c0350160] schedule+0x354/0x92c
[df857f90] [c006b8e8] watchdog+0x48/0x88
[df857fb0] [c004d020] kthread+0x80/0x84
[df857ff0] [c00141a0] kernel_thread+0x4c/0x68
events/0 S 00000000 0 9 2 0x00000000
Call Trace:
[df859ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df859ec0] [c0350160] schedule+0x354/0x92c
[df859f50] [c0048718] worker_thread+0x1fc/0x200
[df859fb0] [c004d020] kthread+0x80/0x84
[df859ff0] [c00141a0] kernel_thread+0x4c/0x68
events/1 S 00000000 0 10 2 0x00000000
Call Trace:
[df85bea0] [c0009fc4] __switch_to+0x8c/0xf8
[df85bec0] [c0350160] schedule+0x354/0x92c
[df85bf50] [c0048718] worker_thread+0x1fc/0x200
[df85bfb0] [c004d020] kthread+0x80/0x84
[df85bff0] [c00141a0] kernel_thread+0x4c/0x68
khelper S 00000000 0 11 2 0x00000000
Call Trace:
[df85dde0] [c0030564] do_fork+0x1b0/0x344 (unreliable)
[df85dea0] [c0009fc4] __switch_to+0x8c/0xf8
[df85dec0] [c0350160] schedule+0x354/0x92c
[df85df50] [c0048718] worker_thread+0x1fc/0x200
[df85dfb0] [c004d020] kthread+0x80/0x84
[df85dff0] [c00141a0] kernel_thread+0x4c/0x68
async/mgr S 00000000 0 15 2 0x00000000
Call Trace:
[df8a7df0] [000000fc] 0xfc (unreliable)
[df8a7eb0] [c0009fc4] __switch_to+0x8c/0xf8
[df8a7ed0] [c0350160] schedule+0x354/0x92c
[df8a7f60] [c00565c0] async_manager_thread+0x120/0x174
[df8a7fb0] [c004d020] kthread+0x80/0x84
[df8a7ff0] [c00141a0] kernel_thread+0x4c/0x68
sync_supers S 00000000 0 85 2 0x00000000
Call Trace:
[df951e30] [00000400] 0x400 (unreliable)
[df951ef0] [c0009fc4] __switch_to+0x8c/0xf8
[df951f10] [c0350160] schedule+0x354/0x92c
[df951fa0] [c008d714] bdi_sync_supers+0x30/0x5c
[df951fb0] [c004d020] kthread+0x80/0x84
[df951ff0] [c00141a0] kernel_thread+0x4c/0x68
bdi-default S 00000000 0 87 2 0x00000000
Call Trace:
[df957e30] [c0009fc4] __switch_to+0x8c/0xf8
[df957e50] [c0350160] schedule+0x354/0x92c
[df957ee0] [c0350b14] schedule_timeout+0x15c/0x23c
[df957f30] [c008e510] bdi_forker_task+0x2f8/0x30c
[df957fb0] [c004d020] kthread+0x80/0x84
[df957ff0] [c00141a0] kernel_thread+0x4c/0x68
kblockd/0 S 00000000 0 88 2 0x00000000
Call Trace:
[df8bdde0] [00000800] 0x800 (unreliable)
[df8bdea0] [c0009fc4] __switch_to+0x8c/0xf8
[df8bdec0] [c0350160] schedule+0x354/0x92c
[df8bdf50] [c0048718] worker_thread+0x1fc/0x200
[df8bdfb0] [c004d020] kthread+0x80/0x84
[df8bdff0] [c00141a0] kernel_thread+0x4c/0x68
kblockd/1 S 00000000 0 89 2 0x00000000
Call Trace:
[df959de0] [00000800] 0x800 (unreliable)
[df959ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df959ec0] [c0350160] schedule+0x354/0x92c
[df959f50] [c0048718] worker_thread+0x1fc/0x200
[df959fb0] [c004d020] kthread+0x80/0x84
[df959ff0] [c00141a0] kernel_thread+0x4c/0x68
rpciod/0 S 00000000 0 111 2 0x00000000
Call Trace:
[df93fea0] [c0009fc4] __switch_to+0x8c/0xf8
[df93fec0] [c0350160] schedule+0x354/0x92c
[df93ff50] [c0048718] worker_thread+0x1fc/0x200
[df93ffb0] [c004d020] kthread+0x80/0x84
[df93fff0] [c00141a0] kernel_thread+0x4c/0x68
rpciod/1 S 00000000 0 112 2 0x00000000
Call Trace:
[df931de0] [00000001] 0x1 (unreliable)
[df931ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df931ec0] [c0350160] schedule+0x354/0x92c
[df931f50] [c0048718] worker_thread+0x1fc/0x200
[df931fb0] [c004d020] kthread+0x80/0x84
[df931ff0] [c00141a0] kernel_thread+0x4c/0x68
khungtaskd S 00000000 0 141 2 0x00000000
Call Trace:
[df979db0] [00000800] 0x800 (unreliable)
[df979e70] [c0009fc4] __switch_to+0x8c/0xf8
[df979e90] [c0350160] schedule+0x354/0x92c
[df979f20] [c0350b14] schedule_timeout+0x15c/0x23c
[df979f70] [c006bd38] watchdog+0x98/0x294
[df979fb0] [c004d020] kthread+0x80/0x84
[df979ff0] [c00141a0] kernel_thread+0x4c/0x68
kswapd0 S 00000000 0 142 2 0x00000000
Call Trace:
[df97bd60] [c04383a0] 0xc04383a0 (unreliable)
[df97be20] [c0009fc4] __switch_to+0x8c/0xf8
[df97be40] [c0350160] schedule+0x354/0x92c
[df97bed0] [c00868a8] kswapd+0x81c/0x858
[df97bfb0] [c004d020] kthread+0x80/0x84
[df97bff0] [c00141a0] kernel_thread+0x4c/0x68
aio/0 S 00000000 0 143 2 0x00000000
Call Trace:
[df97dde0] [ffffffff] 0xffffffff (unreliable)
[df97dea0] [c0009fc4] __switch_to+0x8c/0xf8
[df97dec0] [c0350160] schedule+0x354/0x92c
[df97df50] [c0048718] worker_thread+0x1fc/0x200
[df97dfb0] [c004d020] kthread+0x80/0x84
[df97dff0] [c00141a0] kernel_thread+0x4c/0x68
aio/1 S 00000000 0 144 2 0x00000000
Call Trace:
[df97fde0] [ffffffff] 0xffffffff (unreliable)
[df97fea0] [c0009fc4] __switch_to+0x8c/0xf8
[df97fec0] [c0350160] schedule+0x354/0x92c
[df97ff50] [c0048718] worker_thread+0x1fc/0x200
[df97ffb0] [c004d020] kthread+0x80/0x84
[df97fff0] [c00141a0] kernel_thread+0x4c/0x68
nfsiod S 00000000 0 145 2 0x00000000
Call Trace:
[df9a5de0] [00000003] 0x3 (unreliable)
[df9a5ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df9a5ec0] [c0350160] schedule+0x354/0x92c
[df9a5f50] [c0048718] worker_thread+0x1fc/0x200
[df9a5fb0] [c004d020] kthread+0x80/0x84
[df9a5ff0] [c00141a0] kernel_thread+0x4c/0x68
crypto/0 S 00000000 0 146 2 0x00000000
Call Trace:
[df9a7de0] [00000800] 0x800 (unreliable)
[df9a7ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df9a7ec0] [c0350160] schedule+0x354/0x92c
[df9a7f50] [c0048718] worker_thread+0x1fc/0x200
[df9a7fb0] [c004d020] kthread+0x80/0x84
[df9a7ff0] [c00141a0] kernel_thread+0x4c/0x68
crypto/1 S 00000000 0 147 2 0x00000000
Call Trace:
[df9a9ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df9a9ec0] [c0350160] schedule+0x354/0x92c
[df9a9f50] [c0048718] worker_thread+0x1fc/0x200
[df9a9fb0] [c004d020] kthread+0x80/0x84
[df9a9ff0] [c00141a0] kernel_thread+0x4c/0x68
mtdblockd S 00000000 0 779 2 0x00000000
Call Trace:
[dfae1e00] [00000800] 0x800 (unreliable)
[dfae1ec0] [c0009fc4] __switch_to+0x8c/0xf8
[dfae1ee0] [c0350160] schedule+0x354/0x92c
[dfae1f70] [c02232dc] mtd_blktrans_thread+0x1c4/0x394
[dfae1fb0] [c004d020] kthread+0x80/0x84
[dfae1ff0] [c00141a0] kernel_thread+0x4c/0x68
kstriped S 00000000 0 826 2 0x00000000
Call Trace:
[df935de0] [00000800] 0x800 (unreliable)
[df935ea0] [c0009fc4] __switch_to+0x8c/0xf8
[df935ec0] [c0350160] schedule+0x354/0x92c
[df935f50] [c0048718] worker_thread+0x1fc/0x200
[df935fb0] [c004d020] kthread+0x80/0x84
[df935ff0] [c00141a0] kernel_thread+0x4c/0x68
ksnapd S 00000000 0 828 2 0x00000000
Call Trace:
[dfae9de0] [00000800] 0x800 (unreliable)
[dfae9ea0] [c0009fc4] __switch_to+0x8c/0xf8
[dfae9ec0] [c0350160] schedule+0x354/0x92c
[dfae9f50] [c0048718] worker_thread+0x1fc/0x200
[dfae9fb0] [c004d020] kthread+0x80/0x84
[dfae9ff0] [c00141a0] kernel_thread+0x4c/0x68
Sched Debug Version: v0.09, 2.6.33-00001-g8c31d07 #1
now at 35747.705693 msecs
.jiffies : 4294901234
.sysctl_sched_latency : 10.000000
.sysctl_sched_min_granularity : 2.000000
.sysctl_sched_wakeup_granularity : 2.000000
.sysctl_sched_child_runs_first : 0.000000
.sysctl_sched_features : 7917179
.sysctl_sched_tunable_scaling : 1 (logaritmic)
cpu#0
.nr_running : 0
.load : 0
.nr_switches : 2809
.nr_load_updates : 8950
.nr_uninterruptible : 1
.next_balance : 4294.901248
.curr->pid : 0
.clock : 35832.063536
.cpu_load[0] : 0
.cpu_load[1] : 0
.cpu_load[2] : 0
.cpu_load[3] : 0
.cpu_load[4] : 0
cfs_rq[0] for UID: 0
.exec_clock : 0.000000
.MIN_vruntime : 0.000001
.min_vruntime : 4129.195888
.max_vruntime : 0.000001
.spread : 0.000000
.spread0 : 4048.261385
.nr_running : 0
.load : 0
.nr_spread_over : 0
.shares : 0
.se->exec_start : 35836.116992
.se->vruntime : 80.934503
.se->sum_exec_runtime : 123.815984
.se->load.weight : 1024
rt_rq[0]:
.rt_nr_running : 0
.rt_throttled : 0
.rt_time : 0.000000
.rt_runtime : 950.000000
runnable tasks:
task PID tree-key switches prio exec-runtime
sum-exec sum-sleep
--------------------------------------------------------------------------------
--------------------------
cpu#1
.nr_running : 0
.load : 0
.nr_switches : 4069
.nr_load_updates : 8689
.nr_uninterruptible : 0
.next_balance : 4294.901019
.curr->pid : 0
.clock : 34909.104304
.cpu_load[0] : 0
.cpu_load[1] : 0
.cpu_load[2] : 0
.cpu_load[3] : 0
.cpu_load[4] : 0
cfs_rq[1] for UID: 0
.exec_clock : 0.000000
.MIN_vruntime : 0.000001
.min_vruntime : 509.424556
.max_vruntime : 0.000001
.spread : 0.000000
.spread0 : 428.490053
.nr_running : 0
.load : 0
.nr_spread_over : 0
.shares : 0
.se->exec_start : 34909.104304
.se->vruntime : 273.153007
.se->sum_exec_runtime : 503.971344
.se->load.weight : 1024
rt_rq[1]:
.rt_nr_running : 0
.rt_throttled : 0
.rt_time : 0.000000
.rt_runtime : 950.000000
runnable tasks:
task PID tree-key switches prio exec-runtime
sum-exec sum-sleep
--------------------------------------------------------------------------------
--------------------------
^ permalink raw reply
* Re: bonding: fix device leak on error in bond_create()
From: Andy Gospodarek @ 2010-02-26 16:22 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Linux Netdev List, Jay Vosburgh
In-Reply-To: <4B87F424.6090300@trash.net>
On Fri, Feb 26, 2010 at 05:17:40PM +0100, Patrick McHardy wrote:
> Andy Gospodarek wrote:
> > On Fri, Feb 26, 2010 at 04:35:52PM +0100, Patrick McHardy wrote:
> >
> >> commit f357a5caa0ca29b74811a0fc08efb5ae4aade959
> >> Author: Patrick McHardy <kaber@trash.net>
> >> Date: Thu Feb 25 20:21:10 2010 +0100
> >>
> >> bonding: fix device leak on error in bond_create()
> >>
> >> When the register_netdevice() call fails, the newly allocated device is
> >> not freed.
> >>
> >> Signed-off-by: Patrick McHardy <kaber@trash.net>
> >>
> >> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> >> index 1787e3c..430c022 100644
> >> --- a/drivers/net/bonding/bond_main.c
> >> +++ b/drivers/net/bonding/bond_main.c
> >> @@ -4946,6 +4946,8 @@ int bond_create(struct net *net, const char *name)
> >> }
> >>
> >> res = register_netdevice(bond_dev);
> >> + if (res < 0)
> >> + goto out_netdev;
> >>
> >> out:
> >> rtnl_unlock();
> >
> > Acked-by: Andy Gospodarek <andy@greyhouse.net>
> >
> > Seems like a good idea. I know register_netdevice is always supposed to
> > return a value < 0 on error, but this would work if it didn't for some
> > reason.
>
> I don't care much, but that would be a bug since we'd return
> invalid errno codes to userspace.
Then I guess the bonding driver would probably not be the last to know
if someone snuck a bug into register_netdevice....
^ permalink raw reply
* Re: [RFC 0/5] bridge - introduce via_phys_dev feature
From: Stephen Hemminger @ 2010-02-26 16:18 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: bridge, netdev
In-Reply-To: <20090522201850.GF5354@lenovo>
Looking back at this. What if the API was simpler:
Instead of:
> Typical session looks like
>
> | s...@10.10.0.160$ brctl addbr br0
> | s...@10.10.0.160$ ifconfig br0 up
> | s...@10.10.0.160$ echo 1 > /sys/class/net/bridge/br0/via_phys_dev
> | s...@10.10.0.160$ brctl addif br0 eth0
> | (...waiting a bit...)
> | s...@10.10.0.160$
Why not:
1. Setup bridge (and any other interfaces except eth0); includes bringing br0 up
2. Add eth0 to bridge with new flag to inherit
a. brctl addif br0 eth0 inherit
Inherit functionality would need to move address (Ether, IP, IPv6)
and routes from eth0 to br0.
I will see about doing it as much as possible in userspace.
^ permalink raw reply
* Re: bonding: fix device leak on error in bond_create()
From: Patrick McHardy @ 2010-02-26 16:17 UTC (permalink / raw)
To: Andy Gospodarek; +Cc: Linux Netdev List, Jay Vosburgh
In-Reply-To: <20100226160544.GA2108@gospo.rdu.redhat.com>
Andy Gospodarek wrote:
> On Fri, Feb 26, 2010 at 04:35:52PM +0100, Patrick McHardy wrote:
>
>> commit f357a5caa0ca29b74811a0fc08efb5ae4aade959
>> Author: Patrick McHardy <kaber@trash.net>
>> Date: Thu Feb 25 20:21:10 2010 +0100
>>
>> bonding: fix device leak on error in bond_create()
>>
>> When the register_netdevice() call fails, the newly allocated device is
>> not freed.
>>
>> Signed-off-by: Patrick McHardy <kaber@trash.net>
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 1787e3c..430c022 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -4946,6 +4946,8 @@ int bond_create(struct net *net, const char *name)
>> }
>>
>> res = register_netdevice(bond_dev);
>> + if (res < 0)
>> + goto out_netdev;
>>
>> out:
>> rtnl_unlock();
>
> Acked-by: Andy Gospodarek <andy@greyhouse.net>
>
> Seems like a good idea. I know register_netdevice is always supposed to
> return a value < 0 on error, but this would work if it didn't for some
> reason.
I don't care much, but that would be a bug since we'd return
invalid errno codes to userspace.
^ permalink raw reply
* Re: [PATCH] isa-skelton: Remove a wrong netif_wake_queue() call
From: Atsushi Nemoto @ 2010-02-26 16:13 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20100226.015138.00843007.davem@davemloft.net>
On Fri, 26 Feb 2010 01:51:38 -0800 (PST), David Miller <davem@davemloft.net> wrote:
> Please reference commits by also making mention of the commit
> log message header line. This way when a patch is backported
> into another tree, people can still find it even if the
> SHA1 ID is different. For exmaple, I fixed the above to
> read:
>
> This fix is ported from commit 662a96bd6f020782dfbdc0d0bd177c7dbb556687
> ("tc35815: Remove a wrong netif_wake_queue() call which triggers BUG_ON").
Yes, I will do so next time. Thank you.
---
Atsushi Nemoto
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox