Merge tag 'mips_4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
[linux-2.6-block.git] / net / tipc / name_distr.c
index 3cfeb9df64b0008b894e7495cb0a00dd23938844..61219f0b9677fdd7934040a02d56248c43cf1a5e 100644 (file)
@@ -94,8 +94,9 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
                list_add_tail_rcu(&publ->binding_node, &nt->node_scope);
                return NULL;
        }
-       list_add_tail_rcu(&publ->binding_node, &nt->cluster_scope);
-
+       write_lock_bh(&nt->cluster_scope_lock);
+       list_add_tail(&publ->binding_node, &nt->cluster_scope);
+       write_unlock_bh(&nt->cluster_scope_lock);
        skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
        if (!skb) {
                pr_warn("Publication distribution failure\n");
@@ -112,11 +113,13 @@ struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
  */
 struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ)
 {
+       struct name_table *nt = tipc_name_table(net);
        struct sk_buff *buf;
        struct distr_item *item;
 
-       list_del_rcu(&publ->binding_node);
-
+       write_lock_bh(&nt->cluster_scope_lock);
+       list_del(&publ->binding_node);
+       write_unlock_bh(&nt->cluster_scope_lock);
        if (publ->scope == TIPC_NODE_SCOPE)
                return NULL;
 
@@ -147,7 +150,7 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
                        ITEM_SIZE) * ITEM_SIZE;
        u32 msg_rem = msg_dsz;
 
-       list_for_each_entry_rcu(publ, pls, binding_node) {
+       list_for_each_entry(publ, pls, binding_node) {
                /* Prepare next buffer: */
                if (!skb) {
                        skb = named_prepare_buf(net, PUBLICATION, msg_rem,
@@ -189,11 +192,10 @@ void tipc_named_node_up(struct net *net, u32 dnode)
 
        __skb_queue_head_init(&head);
 
-       rcu_read_lock();
+       read_lock_bh(&nt->cluster_scope_lock);
        named_distribute(net, &head, dnode, &nt->cluster_scope);
-       rcu_read_unlock();
-
        tipc_node_xmit(net, &head, dnode, 0);
+       read_unlock_bh(&nt->cluster_scope_lock);
 }
 
 /**