sysfs_del_hardif invokes kobject_put, which might sleep. However, we
are not allowed to sleep during a call_rcu. There is also no need to
do the removal with an atomic call_rcu, as kobject_put only frees the
kobject when there is no more reference to it anyway.
This commit basically revokes 7f32f2e8d97150ba5b80410dda86b01b0879fe8d,
despite not reintroducing the synchronize_rcu, our rcu_barrier should
handle this.
Signed-off-by: Linus Lüssing <linus.luessing(a)web.de>
---
hard-interface.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/hard-interface.c b/hard-interface.c
index 37f0f8b..5c6ce3f 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -36,16 +36,6 @@
/* protect update critical side of if_list - but not the content */
static DEFINE_SPINLOCK(if_list_lock);
-static void hardif_free_rcu(struct rcu_head *rcu)
-{
- struct batman_if *batman_if;
-
- batman_if = container_of(rcu, struct batman_if, rcu);
- sysfs_del_hardif(&batman_if->hardif_obj);
- dev_put(batman_if->net_dev);
- kref_put(&batman_if->refcount, hardif_free_ref);
-}
-
struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev)
{
struct batman_if *batman_if;
@@ -470,7 +460,9 @@ static void hardif_remove_interface(struct batman_if *batman_if)
/* caller must take if_list_lock */
list_del_rcu(&batman_if->list);
- call_rcu(&batman_if->rcu, hardif_free_rcu);
+ sysfs_del_hardif(&batman_if->hardif_obj);
+ dev_put(batman_if->net_dev);
+ kref_put(&batman_if->refcount, hardif_free_ref);
}
void hardif_remove_interfaces(void)
--
1.7.1
Hi,
the batman-adv gateway functionality has been available in the trunk for quite
some time but was never able to enter an official release because the sysfs API
did not follow the Linux kernel guidelines.
I wrote a series of patches meant to address these style issues. A
comprehensive documentation of the gateway handling is on my todo list and
will follow shortly.
Regards,
Marek
I'm trying to test how much bandwidth is left after multi-hops using
dual-radio as the backbone(interface alternating), I have a few nodes
and want to force them cascaded, is there a way to set up 'static hop
route' somehow so the nodes will not take a short-cut, the nodes are
all close-by.
Basically I want to have A->B->C->D->E and avoid A->E or something alike.
thanks,
xianghua
Hi,
I use sparse (cgcc) with different kernel versions to do some quick checks on
the batman-adv kernel module. I noticed that my change from UP to SMP kernel
generated some 'weird' warnings regarding a 'context imbalance' which I
couldn't find, but went away when switching from spin_(un)lock to
spin_(un)lock_bh - something which doesn't make sense in my mind.
I am not quite sure if this is linux-headers or sparse related - so I try to
post it here first. I choose 2.6.32 because it is the latest long stable
kernel and will be used in by Debian Squeeze.
My current test was done like that (on debian squeeze i386):
-----------------------------------------------------------
$ cd $MY_v2.6.32
$ make mrproper
$ make allnoconfig
$ grep -v 'CONFIG_MODULES is not set' .config > .config.tmp; mv .config.tmp \
.config
$ grep -v 'CONFIG_NET is not set' .config > .config.tmp; mv .config.tmp \
.config
$ grep -v 'CONFIG_SMP is not set' .config > .config.tmp; mv .config.tmp \
.config
$ grep -v 'CONFIG_MODULE_UNLOAD is not set' .config > .config.tmp; mv \
.config.tmp .config
$ echo 'CONFIG_MODULES=y' >> .config
$ echo 'CONFIG_NET=y' >> .config
$ echo 'CONFIG_SMP=y' >> .config
$ echo 'CONFIG_MODULE_UNLOAD=y' >> .config
$ echo 'xy'|make menuconfig
$ make prepare
$ make modules
$ mkdir test
$ cd test
$ cat << EOF > Makefile
obj-m += test.o
test-y += main.o
EOF
$ cat << EOF > main.c
#include <linux/module.h>
#include <linux/spinlock.h>
static DEFINE_SPINLOCK(testlock);
static int __init test_init(void)
{
spin_lock(&testlock);
spin_unlock(&testlock);
return 0;
}
static void __exit test_exit(void)
{
}
module_init(test_init);
module_exit(test_exit);
EOF
$ make CC=cgcc -C $MY_v2.6.32/linux-next M=$(pwd) modules
make: Entering directory `$MY_v2.6.32'
CC [M] $MY_v2.6.32/testmodule/main.o
$MY_v2.6.32/test/main.c:6:19: warning: context imbalance in 'test_init' -
wrong count at exit
LD [M] $MY_v2.6.32/test/test.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] $MY_v2.6.32/test/test.ko
make: Leaving directory `$MY_v2.6.32'
-----------------------------------------------------------
The sparse version was v0.4.3. It was obtained from git and and build using
the current Debian squeeze tools provided by build-essential. It was run from
the build dir by specifying it in $PATH
$ export PATH=$MY_SPARSE_CHECKOUT:$PATH
Best regards,
Sven