}
static LIST_HEAD(rtnl_af_ops);
+static DEFINE_SPINLOCK(rtnl_af_ops_lock);
static struct rtnl_af_ops *rtnl_af_lookup(const int family, int *srcu_index)
{
struct rtnl_af_ops *ops;
- ASSERT_RTNL();
-
rcu_read_lock();
list_for_each_entry_rcu(ops, &rtnl_af_ops, list) {
if (err)
return err;
- rtnl_lock();
+ spin_lock(&rtnl_af_ops_lock);
list_add_tail_rcu(&ops->list, &rtnl_af_ops);
- rtnl_unlock();
+ spin_unlock(&rtnl_af_ops_lock);
return 0;
}
*/
void rtnl_af_unregister(struct rtnl_af_ops *ops)
{
- rtnl_lock();
+ spin_lock(&rtnl_af_ops_lock);
list_del_rcu(&ops->list);
- rtnl_unlock();
+ spin_unlock(&rtnl_af_ops_lock);
synchronize_rcu();
synchronize_srcu(&ops->srcu);