2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

netdev: Make netdev_get_devices() take a reference to each netdev.

This API change is necessary for thread safety, to be added in an upcoming
commit.  Otherwise, the client would not be able to actually use any of
the returned netdevs because they could already have been destroyed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
This commit is contained in:
Ben Pfaff
2013-07-25 16:27:39 -07:00
parent 89608a13e3
commit 2f980d7417
3 changed files with 17 additions and 24 deletions

View File

@@ -555,6 +555,7 @@ netdev_linux_cache_cb(const struct rtnetlink_link_change *change,
get_flags(&dev->up, &flags);
netdev_linux_changed(dev, flags, 0);
netdev_close(netdev);
}
shash_destroy(&device_shash);
}
@@ -1180,6 +1181,7 @@ netdev_linux_miimon_run(void)
bool miimon;
if (dev->miimon_interval <= 0 || !timer_expired(&dev->miimon_timer)) {
netdev_close(netdev);
continue;
}
@@ -1190,6 +1192,7 @@ netdev_linux_miimon_run(void)
}
timer_set_duration(&dev->miimon_timer, dev->miimon_interval);
netdev_close(netdev);
}
shash_destroy(&device_shash);
@@ -1210,6 +1213,7 @@ netdev_linux_miimon_wait(void)
if (dev->miimon_interval > 0) {
timer_wait(&dev->miimon_timer);
}
netdev_close(netdev);
}
shash_destroy(&device_shash);
}