Commit c373dac5 authored by David S. Miller's avatar David S. Miller

Merge branch 'tipc-topology-cleanup'

Ying Xue says:

====================
tipc: cleanup topology server

Not only function names declared in subscr.c are very confused, but
also topology server's locking policy is not designed very well, for
instance, usually leading to panic in some special corner cases.

In this series, we attempt to eliminate the confusion of function names
and simplify topology server's locking policy to solve above mentioned
issues. More importantly, the change will make relevant code easily
understandable and maintainable.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 29a1ff65 90bdfcb7
...@@ -68,7 +68,7 @@ static int __net_init tipc_init_net(struct net *net) ...@@ -68,7 +68,7 @@ static int __net_init tipc_init_net(struct net *net)
if (err) if (err)
goto out_nametbl; goto out_nametbl;
err = tipc_subscr_start(net); err = tipc_topsrv_start(net);
if (err) if (err)
goto out_subscr; goto out_subscr;
return 0; return 0;
...@@ -83,7 +83,7 @@ static int __net_init tipc_init_net(struct net *net) ...@@ -83,7 +83,7 @@ static int __net_init tipc_init_net(struct net *net)
static void __net_exit tipc_exit_net(struct net *net) static void __net_exit tipc_exit_net(struct net *net)
{ {
tipc_subscr_stop(net); tipc_topsrv_stop(net);
tipc_net_stop(net); tipc_net_stop(net);
tipc_nametbl_stop(net); tipc_nametbl_stop(net);
tipc_sk_rht_destroy(net); tipc_sk_rht_destroy(net);
......
...@@ -330,13 +330,9 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net, ...@@ -330,13 +330,9 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
/* Any subscriptions waiting for notification? */ /* Any subscriptions waiting for notification? */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_subscr_report_overlap(s, tipc_subscrp_report_overlap(s, publ->lower, publ->upper,
publ->lower, TIPC_PUBLISHED, publ->ref,
publ->upper, publ->node, created_subseq);
TIPC_PUBLISHED,
publ->ref,
publ->node,
created_subseq);
} }
return publ; return publ;
} }
...@@ -404,13 +400,9 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net, ...@@ -404,13 +400,9 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
/* Notify any waiting subscriptions */ /* Notify any waiting subscriptions */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_subscr_report_overlap(s, tipc_subscrp_report_overlap(s, publ->lower, publ->upper,
publ->lower, TIPC_WITHDRAWN, publ->ref,
publ->upper, publ->node, removed_subseq);
TIPC_WITHDRAWN,
publ->ref,
publ->node,
removed_subseq);
} }
return publ; return publ;
...@@ -432,18 +424,16 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq, ...@@ -432,18 +424,16 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq,
return; return;
while (sseq != &nseq->sseqs[nseq->first_free]) { while (sseq != &nseq->sseqs[nseq->first_free]) {
if (tipc_subscr_overlap(s, sseq->lower, sseq->upper)) { if (tipc_subscrp_check_overlap(s, sseq->lower, sseq->upper)) {
struct publication *crs; struct publication *crs;
struct name_info *info = sseq->info; struct name_info *info = sseq->info;
int must_report = 1; int must_report = 1;
list_for_each_entry(crs, &info->zone_list, zone_list) { list_for_each_entry(crs, &info->zone_list, zone_list) {
tipc_subscr_report_overlap(s, tipc_subscrp_report_overlap(s, sseq->lower,
sseq->lower,
sseq->upper, sseq->upper,
TIPC_PUBLISHED, TIPC_PUBLISHED,
crs->ref, crs->ref, crs->node,
crs->node,
must_report); must_report);
must_report = 0; must_report = 0;
} }
......
...@@ -309,6 +309,10 @@ static int tipc_accept_from_sock(struct tipc_conn *con) ...@@ -309,6 +309,10 @@ static int tipc_accept_from_sock(struct tipc_conn *con)
/* Notify that new connection is incoming */ /* Notify that new connection is incoming */
newcon->usr_data = s->tipc_conn_new(newcon->conid); newcon->usr_data = s->tipc_conn_new(newcon->conid);
if (!newcon->usr_data) {
sock_release(newsock);
return -ENOMEM;
}
/* Wake up receive process in case of 'SYN+' message */ /* Wake up receive process in case of 'SYN+' message */
newsock->sk->sk_data_ready(newsock->sk); newsock->sk->sk_data_ready(newsock->sk);
......
This diff is collapsed.
...@@ -54,7 +54,7 @@ struct tipc_subscriber; ...@@ -54,7 +54,7 @@ struct tipc_subscriber;
* @filter: event filtering to be done for subscription * @filter: event filtering to be done for subscription
* @timer: timer governing subscription duration (optional) * @timer: timer governing subscription duration (optional)
* @nameseq_list: adjacent subscriptions in name sequence's subscription list * @nameseq_list: adjacent subscriptions in name sequence's subscription list
* @subscription_list: adjacent subscriptions in subscriber's subscription list * @subscrp_list: adjacent subscriptions in subscriber's subscription list
* @server_ref: object reference of server port associated with subscription * @server_ref: object reference of server port associated with subscription
* @swap: indicates if subscriber uses opposite endianness in its messages * @swap: indicates if subscriber uses opposite endianness in its messages
* @evt: template for events generated by subscription * @evt: template for events generated by subscription
...@@ -67,17 +67,17 @@ struct tipc_subscription { ...@@ -67,17 +67,17 @@ struct tipc_subscription {
u32 filter; u32 filter;
struct timer_list timer; struct timer_list timer;
struct list_head nameseq_list; struct list_head nameseq_list;
struct list_head subscription_list; struct list_head subscrp_list;
int swap; int swap;
struct tipc_event evt; struct tipc_event evt;
}; };
int tipc_subscr_overlap(struct tipc_subscription *sub, u32 found_lower, int tipc_subscrp_check_overlap(struct tipc_subscription *sub, u32 found_lower,
u32 found_upper); u32 found_upper);
void tipc_subscr_report_overlap(struct tipc_subscription *sub, u32 found_lower, void tipc_subscrp_report_overlap(struct tipc_subscription *sub,
u32 found_upper, u32 event, u32 port_ref, u32 found_lower, u32 found_upper, u32 event,
u32 node, int must); u32 port_ref, u32 node, int must);
int tipc_subscr_start(struct net *net); int tipc_topsrv_start(struct net *net);
void tipc_subscr_stop(struct net *net); void tipc_topsrv_stop(struct net *net);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment