diff options
| author | Ben Pfaff <blp@nicira.com> | 2009-08-05 14:36:21 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2009-08-06 16:57:06 -0700 |
| commit | 0515ceb3e82ecc6160a141017c20ca26ec1a7a5f (patch) | |
| tree | 5cef4ca168bf3d4d247da85ff5545ea2e36a8959 /datapath/dp_sysfs_if.c | |
| parent | 58c342f617051e9e2ffb09710b4ef2b22c34e79a (diff) | |
| download | openvswitch-0515ceb3e82ecc6160a141017c20ca26ec1a7a5f.tar.gz | |
datapath: Update sysfs links when network devices are renamed.
We create symlinks from /sys/class/net/<bridgename>/brif/<devname> to
/sys/class/net/<devname>/brport, but until now we have never updated the
links when network devices are renamed. This commit fixes this problem.
(Only the <devname> in /sys/class/net/<bridgename>/brif/<devname> needs to
be updated. Symlinks within sysfs have stable targets; that is, no matter
how the object that a sysfs symlink points to moves around, the link is
still maintained correctly.)
Diffstat (limited to 'datapath/dp_sysfs_if.c')
| -rw-r--r-- | datapath/dp_sysfs_if.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/datapath/dp_sysfs_if.c b/datapath/dp_sysfs_if.c index 178afbd73..ab928f6c6 100644 --- a/datapath/dp_sysfs_if.c +++ b/datapath/dp_sysfs_if.c @@ -302,6 +302,7 @@ int dp_sysfs_add_if(struct net_bridge_port *p) err = sysfs_create_link(&dp->ifobj, &p->kobj, p->dev->name); if (err) goto err_del; + strcpy(p->linkname, p->dev->name); kobject_uevent(&p->kobj, KOBJ_ADD); @@ -319,6 +320,10 @@ err_put: int dp_sysfs_del_if(struct net_bridge_port *p) { + if (p->linkname[0]) { + sysfs_remove_link(&p->dp->ifobj, p->linkname); + p->linkname[0] = '\0'; + } if (p->kobj.dentry) { kobject_uevent(&p->kobj, KOBJ_REMOVE); kobject_del(&p->kobj); |
