[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <485C786A.8040204@cn.fujitsu.com>
Date: Sat, 21 Jun 2008 11:41:30 +0800
From: Wang Chen <wangchen@...fujitsu.com>
To: Stephen Hemminger <shemminger@...tta.com>
CC: "David S. Miller" <davem@...emloft.net>,
NETDEV <netdev@...r.kernel.org>,
Patrick McHardy <kaber@...sh.net>
Subject: Re: [PATCH net-next 4/8] bridge: sysfs cleanup
Stephen Hemminger said the following on 2008-6-21 1:44:
> On Fri, 20 Jun 2008 08:55:15 +0800
> Wang Chen <wangchen@...fujitsu.com> wrote:
>
>> When I am doing this series of patch, I notice that bridge's sysfs are
>> not cleanuped after failure and bridge delete.
>>
>> Here is the patch for it.
>>
>> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
>> ---
>> net/bridge/br_if.c | 2 ++
>> net/bridge/br_sysfs_if.c | 9 ++++++++-
>> 2 files changed, 10 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
>> index 49dd433..4b730fa 100644
>> --- a/net/bridge/br_if.c
>> +++ b/net/bridge/br_if.c
>> @@ -161,6 +161,7 @@ static void del_br(struct net_bridge *br)
>> struct net_bridge_port *p, *n;
>>
>> list_for_each_entry_safe(p, n, &br->port_list, list) {
>> + br_sysfs_removeif(p);
>> del_nbp(p);
>> }
>>
>> @@ -435,6 +436,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
>> if (!p || p->br != br)
>> return -EINVAL;
>>
>> + br_sysfs_removeif(p);
>> del_nbp(p);
>>
>> spin_lock_bh(&br->lock);
>> diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
>> index 7f80462..9e9d17c 100644
>> --- a/net/bridge/br_sysfs_if.c
>> +++ b/net/bridge/br_sysfs_if.c
>> @@ -226,10 +226,17 @@ int br_sysfs_addif(struct net_bridge_port *p)
>> for (a = brport_attrs; *a; ++a) {
>> err = sysfs_create_file(&p->kobj, &((*a)->attr));
>> if (err)
>> - goto out2;
>> + goto out1;
>> }
>>
>> err = sysfs_create_link(br->ifobj, &p->kobj, p->dev->name);
>> + if (err)
>> + goto out1;
>> + return 0;
>> +out1:
>> + for (a = brport_attrs; *a; ++a)
>> + sysfs_remove_file(&p->kobj, &((*a)->attr));
>> + sysfs_remove_link(&br->dev->dev.kobj, SYSFS_BRIDGE_PORT_LINK);
>> out2:
>> return err;
>> }
>
> This is unneeded since the bridge port kobject is deleted when removed
> or in case of error and kobject_del calls sysfs_remove_dir.
>
Stephen, thank you for your explanation.
Since kobject_del will unwind what sysfs_create_* did,
I also think this patch is unneeded.
David, would you please ignore this patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists