• S
    batman-adv: Avoid sysfs name collision for netns moves · f4acb108
    Sven Eckelmann 提交于
    The kobject_put is only removing the sysfs entry and corresponding entries
    when its reference counter becomes zero. This tends to lead to collisions
    when a device is moved between two different network namespaces because
    some of the sysfs files have to be removed first and then added again to
    the already moved sysfs entry.
    
        WARNING: CPU: 0 PID: 290 at lib/kobject.c:240 kobject_add_internal+0x5ec/0x8a0
        kobject_add_internal failed for batman_adv with -EEXIST, don't try to register things with the same name in the same directory.
    
    But the caller of kobject_put can already remove the sysfs entry before it
    does the kobject_put. This removal is done even when the reference counter
    is not yet zero and thus avoids the problem.
    Signed-off-by: NSven Eckelmann <sven@narfation.org>
    Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
    f4acb108
sysfs.c 32.4 KB