aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/name_distr.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/name_distr.c')
-rw-r--r--net/tipc/name_distr.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index d40df588263e..ba421321d15d 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -109,13 +109,14 @@ void named_cluster_distribute(struct net *net, struct sk_buff *skb)
109/** 109/**
110 * tipc_named_publish - tell other nodes about a new publication by this node 110 * tipc_named_publish - tell other nodes about a new publication by this node
111 */ 111 */
112struct sk_buff *tipc_named_publish(struct publication *publ) 112struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
113{ 113{
114 struct tipc_net *tn = net_generic(net, tipc_net_id);
114 struct sk_buff *buf; 115 struct sk_buff *buf;
115 struct distr_item *item; 116 struct distr_item *item;
116 117
117 list_add_tail_rcu(&publ->local_list, 118 list_add_tail_rcu(&publ->local_list,
118 &tipc_nametbl->publ_list[publ->scope]); 119 &tn->nametbl->publ_list[publ->scope]);
119 120
120 if (publ->scope == TIPC_NODE_SCOPE) 121 if (publ->scope == TIPC_NODE_SCOPE)
121 return NULL; 122 return NULL;
@@ -206,15 +207,16 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
206 */ 207 */
207void tipc_named_node_up(struct net *net, u32 dnode) 208void tipc_named_node_up(struct net *net, u32 dnode)
208{ 209{
210 struct tipc_net *tn = net_generic(net, tipc_net_id);
209 struct sk_buff_head head; 211 struct sk_buff_head head;
210 212
211 __skb_queue_head_init(&head); 213 __skb_queue_head_init(&head);
212 214
213 rcu_read_lock(); 215 rcu_read_lock();
214 named_distribute(net, &head, dnode, 216 named_distribute(net, &head, dnode,
215 &tipc_nametbl->publ_list[TIPC_CLUSTER_SCOPE]); 217 &tn->nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
216 named_distribute(net, &head, dnode, 218 named_distribute(net, &head, dnode,
217 &tipc_nametbl->publ_list[TIPC_ZONE_SCOPE]); 219 &tn->nametbl->publ_list[TIPC_ZONE_SCOPE]);
218 rcu_read_unlock(); 220 rcu_read_unlock();
219 221
220 tipc_link_xmit(net, &head, dnode, dnode); 222 tipc_link_xmit(net, &head, dnode, dnode);
@@ -262,14 +264,15 @@ static void tipc_publ_unsubscribe(struct net *net, struct publication *publ,
262 */ 264 */
263static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr) 265static void tipc_publ_purge(struct net *net, struct publication *publ, u32 addr)
264{ 266{
267 struct tipc_net *tn = net_generic(net, tipc_net_id);
265 struct publication *p; 268 struct publication *p;
266 269
267 spin_lock_bh(&tipc_nametbl_lock); 270 spin_lock_bh(&tn->nametbl_lock);
268 p = tipc_nametbl_remove_publ(publ->type, publ->lower, 271 p = tipc_nametbl_remove_publ(net, publ->type, publ->lower,
269 publ->node, publ->ref, publ->key); 272 publ->node, publ->ref, publ->key);
270 if (p) 273 if (p)
271 tipc_publ_unsubscribe(net, p, addr); 274 tipc_publ_unsubscribe(net, p, addr);
272 spin_unlock_bh(&tipc_nametbl_lock); 275 spin_unlock_bh(&tn->nametbl_lock);
273 276
274 if (p != publ) { 277 if (p != publ) {
275 pr_err("Unable to remove publication from failed node\n" 278 pr_err("Unable to remove publication from failed node\n"
@@ -302,7 +305,8 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
302 struct publication *publ = NULL; 305 struct publication *publ = NULL;
303 306
304 if (dtype == PUBLICATION) { 307 if (dtype == PUBLICATION) {
305 publ = tipc_nametbl_insert_publ(ntohl(i->type), ntohl(i->lower), 308 publ = tipc_nametbl_insert_publ(net, ntohl(i->type),
309 ntohl(i->lower),
306 ntohl(i->upper), 310 ntohl(i->upper),
307 TIPC_CLUSTER_SCOPE, node, 311 TIPC_CLUSTER_SCOPE, node,
308 ntohl(i->ref), ntohl(i->key)); 312 ntohl(i->ref), ntohl(i->key));
@@ -311,7 +315,8 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
311 return true; 315 return true;
312 } 316 }
313 } else if (dtype == WITHDRAWAL) { 317 } else if (dtype == WITHDRAWAL) {
314 publ = tipc_nametbl_remove_publ(ntohl(i->type), ntohl(i->lower), 318 publ = tipc_nametbl_remove_publ(net, ntohl(i->type),
319 ntohl(i->lower),
315 node, ntohl(i->ref), 320 node, ntohl(i->ref),
316 ntohl(i->key)); 321 ntohl(i->key));
317 if (publ) { 322 if (publ) {
@@ -376,19 +381,20 @@ void tipc_named_process_backlog(struct net *net)
376 */ 381 */
377void tipc_named_rcv(struct net *net, struct sk_buff *buf) 382void tipc_named_rcv(struct net *net, struct sk_buff *buf)
378{ 383{
384 struct tipc_net *tn = net_generic(net, tipc_net_id);
379 struct tipc_msg *msg = buf_msg(buf); 385 struct tipc_msg *msg = buf_msg(buf);
380 struct distr_item *item = (struct distr_item *)msg_data(msg); 386 struct distr_item *item = (struct distr_item *)msg_data(msg);
381 u32 count = msg_data_sz(msg) / ITEM_SIZE; 387 u32 count = msg_data_sz(msg) / ITEM_SIZE;
382 u32 node = msg_orignode(msg); 388 u32 node = msg_orignode(msg);
383 389
384 spin_lock_bh(&tipc_nametbl_lock); 390 spin_lock_bh(&tn->nametbl_lock);
385 while (count--) { 391 while (count--) {
386 if (!tipc_update_nametbl(net, item, node, msg_type(msg))) 392 if (!tipc_update_nametbl(net, item, node, msg_type(msg)))
387 tipc_named_add_backlog(item, msg_type(msg), node); 393 tipc_named_add_backlog(item, msg_type(msg), node);
388 item++; 394 item++;
389 } 395 }
390 tipc_named_process_backlog(net); 396 tipc_named_process_backlog(net);
391 spin_unlock_bh(&tipc_nametbl_lock); 397 spin_unlock_bh(&tn->nametbl_lock);
392 kfree_skb(buf); 398 kfree_skb(buf);
393} 399}
394 400
@@ -399,17 +405,18 @@ void tipc_named_rcv(struct net *net, struct sk_buff *buf)
399 * All name table entries published by this node are updated to reflect 405 * All name table entries published by this node are updated to reflect
400 * the node's new network address. 406 * the node's new network address.
401 */ 407 */
402void tipc_named_reinit(void) 408void tipc_named_reinit(struct net *net)
403{ 409{
410 struct tipc_net *tn = net_generic(net, tipc_net_id);
404 struct publication *publ; 411 struct publication *publ;
405 int scope; 412 int scope;
406 413
407 spin_lock_bh(&tipc_nametbl_lock); 414 spin_lock_bh(&tn->nametbl_lock);
408 415
409 for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_NODE_SCOPE; scope++) 416 for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_NODE_SCOPE; scope++)
410 list_for_each_entry_rcu(publ, &tipc_nametbl->publ_list[scope], 417 list_for_each_entry_rcu(publ, &tn->nametbl->publ_list[scope],
411 local_list) 418 local_list)
412 publ->node = tipc_own_addr; 419 publ->node = tipc_own_addr;
413 420
414 spin_unlock_bh(&tipc_nametbl_lock); 421 spin_unlock_bh(&tn->nametbl_lock);
415} 422}