mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-12 01:22:11 +00:00
tipc: move link input queue to tipc_node
At present, the link input queue and the name distributor receive queues are fields aggregated in struct tipc_link. This is a hazard, because a link might be deleted while a receiving socket still keeps reference to one of the queues. This commit fixes this bug. However, rather than adding yet another reference counter to the critical data path, we move the two queues to safe ground inside struct tipc_node, which is already protected, and let the link code only handle references to the queues. This is also in line with planned later changes in this area. Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d3a43b907a
commit
d39bbd445d
4 changed files with 27 additions and 19 deletions
|
@ -132,6 +132,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr)
|
|||
INIT_LIST_HEAD(&n_ptr->list);
|
||||
INIT_LIST_HEAD(&n_ptr->publ_list);
|
||||
INIT_LIST_HEAD(&n_ptr->conn_sks);
|
||||
skb_queue_head_init(&n_ptr->bclink.namedq);
|
||||
__skb_queue_head_init(&n_ptr->bclink.deferdq);
|
||||
hlist_add_head_rcu(&n_ptr->hash, &tn->node_htable[tipc_hashfn(addr)]);
|
||||
list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
|
||||
|
@ -350,9 +351,10 @@ bool tipc_node_update_dest(struct tipc_node *n, struct tipc_bearer *b,
|
|||
{
|
||||
struct tipc_link *l = n->links[b->identity].link;
|
||||
struct tipc_media_addr *curr = &n->links[b->identity].maddr;
|
||||
struct sk_buff_head *inputq = &n->links[b->identity].inputq;
|
||||
|
||||
if (!l)
|
||||
l = tipc_link_create(n, b, maddr);
|
||||
l = tipc_link_create(n, b, maddr, inputq, &n->bclink.namedq);
|
||||
if (!l)
|
||||
return false;
|
||||
memcpy(&l->media_addr, maddr, sizeof(*maddr));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue