aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@gmail.com>2016-04-07 10:40:43 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-11 15:22:20 -0400
commit541726abe7daca64390c2ec34e6a203145f1686d (patch)
treed335e57ce92b7092cadd7c6e406d3b0c5bfa56e6 /net/tipc
parentebf4dc2b1b2b9c8c7797f01a952bce3cf0247a4f (diff)
tipc: make dist queue pernet
Nametable updates received from the network that cannot be applied immediately are placed on a defer queue. This queue is global to the TIPC module, which might cause problems when using TIPC in containers. To prevent nametable updates from escaping into the wrong namespace, we make the queue pernet instead. Signed-off-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.c1
-rw-r--r--net/tipc/core.h3
-rw-r--r--net/tipc/name_distr.c16
3 files changed, 11 insertions, 9 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 03a842870c52..e2bdb07a49a2 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -69,6 +69,7 @@ static int __net_init tipc_init_net(struct net *net)
69 if (err) 69 if (err)
70 goto out_nametbl; 70 goto out_nametbl;
71 71
72 INIT_LIST_HEAD(&tn->dist_queue);
72 err = tipc_topsrv_start(net); 73 err = tipc_topsrv_start(net);
73 if (err) 74 if (err)
74 goto out_subscr; 75 goto out_subscr;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 5504d63503df..eff58dc53aa1 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -103,6 +103,9 @@ struct tipc_net {
103 spinlock_t nametbl_lock; 103 spinlock_t nametbl_lock;
104 struct name_table *nametbl; 104 struct name_table *nametbl;
105 105
106 /* Name dist queue */
107 struct list_head dist_queue;
108
106 /* Topology subscription server */ 109 /* Topology subscription server */
107 struct tipc_server *topsrv; 110 struct tipc_server *topsrv;
108 atomic_t subscription_count; 111 atomic_t subscription_count;
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index ebe9d0ff6e9e..4f4f5810f223 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -40,11 +40,6 @@
40 40
41int sysctl_tipc_named_timeout __read_mostly = 2000; 41int sysctl_tipc_named_timeout __read_mostly = 2000;
42 42
43/**
44 * struct tipc_dist_queue - queue holding deferred name table updates
45 */
46static struct list_head tipc_dist_queue = LIST_HEAD_INIT(tipc_dist_queue);
47
48struct distr_queue_item { 43struct distr_queue_item {
49 struct distr_item i; 44 struct distr_item i;
50 u32 dtype; 45 u32 dtype;
@@ -279,9 +274,11 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
279 * tipc_named_add_backlog - add a failed name table update to the backlog 274 * tipc_named_add_backlog - add a failed name table update to the backlog
280 * 275 *
281 */ 276 */
282static void tipc_named_add_backlog(struct distr_item *i, u32 type, u32 node) 277static void tipc_named_add_backlog(struct net *net, struct distr_item *i,
278 u32 type, u32 node)
283{ 279{
284 struct distr_queue_item *e; 280 struct distr_queue_item *e;
281 struct tipc_net *tn = net_generic(net, tipc_net_id);
285 unsigned long now = get_jiffies_64(); 282 unsigned long now = get_jiffies_64();
286 283
287 e = kzalloc(sizeof(*e), GFP_ATOMIC); 284 e = kzalloc(sizeof(*e), GFP_ATOMIC);
@@ -291,7 +288,7 @@ static void tipc_named_add_backlog(struct distr_item *i, u32 type, u32 node)
291 e->node = node; 288 e->node = node;
292 e->expires = now + msecs_to_jiffies(sysctl_tipc_named_timeout); 289 e->expires = now + msecs_to_jiffies(sysctl_tipc_named_timeout);
293 memcpy(e, i, sizeof(*i)); 290 memcpy(e, i, sizeof(*i));
294 list_add_tail(&e->next, &tipc_dist_queue); 291 list_add_tail(&e->next, &tn->dist_queue);
295} 292}
296 293
297/** 294/**
@@ -301,10 +298,11 @@ static void tipc_named_add_backlog(struct distr_item *i, u32 type, u32 node)
301void tipc_named_process_backlog(struct net *net) 298void tipc_named_process_backlog(struct net *net)
302{ 299{
303 struct distr_queue_item *e, *tmp; 300 struct distr_queue_item *e, *tmp;
301 struct tipc_net *tn = net_generic(net, tipc_net_id);
304 char addr[16]; 302 char addr[16];
305 unsigned long now = get_jiffies_64(); 303 unsigned long now = get_jiffies_64();
306 304
307 list_for_each_entry_safe(e, tmp, &tipc_dist_queue, next) { 305 list_for_each_entry_safe(e, tmp, &tn->dist_queue, next) {
308 if (time_after(e->expires, now)) { 306 if (time_after(e->expires, now)) {
309 if (!tipc_update_nametbl(net, &e->i, e->node, e->dtype)) 307 if (!tipc_update_nametbl(net, &e->i, e->node, e->dtype))
310 continue; 308 continue;
@@ -344,7 +342,7 @@ void tipc_named_rcv(struct net *net, struct sk_buff_head *inputq)
344 node = msg_orignode(msg); 342 node = msg_orignode(msg);
345 while (count--) { 343 while (count--) {
346 if (!tipc_update_nametbl(net, item, node, mtype)) 344 if (!tipc_update_nametbl(net, item, node, mtype))
347 tipc_named_add_backlog(item, mtype, node); 345 tipc_named_add_backlog(net, item, mtype, node);
348 item++; 346 item++;
349 } 347 }
350 kfree_skb(skb); 348 kfree_skb(skb);