Skip to content

Commit

Permalink
[TIPC]: First phase of assert() cleanup
Browse files Browse the repository at this point in the history
This also contains enhancements to simplify comparisons in name table
publication removal algorithm and to simplify name table sanity checking
when shutting down TIPC.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
ajstephens authored and davem330 committed Jun 26, 2006
1 parent e100ae9 commit f131072
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 109 deletions.
13 changes: 7 additions & 6 deletions net/tipc/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all)
break;
list_del_init(&p_ptr->wait_list);
p_ptr->congested_link = NULL;
assert(p_ptr->wakeup);
spin_lock_bh(p_ptr->publ.lock);
p_ptr->publ.congested = 0;
p_ptr->wakeup(&p_ptr->publ);
Expand Down Expand Up @@ -1246,8 +1245,6 @@ int tipc_link_send_sections_fast(struct port *sender,
int res;
u32 selector = msg_origport(hdr) & 1;

assert(destaddr != tipc_own_addr);

again:
/*
* Try building message using port's max_pkt hint.
Expand Down Expand Up @@ -2310,7 +2307,6 @@ void tipc_link_tunnel(struct link *l_ptr,
memcpy(buf->data + INT_H_SIZE, (unchar *)msg, length);
dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane);
msg_dbg(buf_msg(buf), ">SEND>");
assert(tunnel);
tipc_link_send_buf(tunnel, buf);
}

Expand Down Expand Up @@ -2339,10 +2335,10 @@ void tipc_link_changeover(struct link *l_ptr)
ORIGINAL_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id);
msg_set_msgcnt(&tunnel_hdr, msgcount);

if (!l_ptr->first_out) {
struct sk_buff *buf;

assert(!msgcount);
buf = buf_acquire(INT_H_SIZE);
if (buf) {
memcpy(buf->data, (unchar *)&tunnel_hdr, INT_H_SIZE);
Expand All @@ -2356,6 +2352,7 @@ void tipc_link_changeover(struct link *l_ptr)
}
return;
}

while (crs) {
struct tipc_msg *msg = buf_msg(crs);

Expand Down Expand Up @@ -2455,11 +2452,15 @@ static int link_recv_changeover_msg(struct link **l_ptr,
u32 msg_count = msg_msgcnt(tunnel_msg);

dest_link = (*l_ptr)->owner->links[msg_bearer_id(tunnel_msg)];
assert(dest_link != *l_ptr);
if (!dest_link) {
msg_dbg(tunnel_msg, "NOLINK/<REC<");
goto exit;
}
if (dest_link == *l_ptr) {
err("Unexpected changeover message on link <%s>\n",
(*l_ptr)->name);
goto exit;
}
dbg("%c<-%c:", dest_link->b_ptr->net_plane,
(*l_ptr)->b_ptr->net_plane);
*l_ptr = dest_link;
Expand Down
20 changes: 17 additions & 3 deletions net/tipc/name_distr.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ void tipc_named_node_up(unsigned long node)
u32 rest;
u32 max_item_buf;

assert(in_own_cluster(node));
read_lock_bh(&tipc_nametbl_lock);
max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
max_item_buf *= ITEM_SIZE;
Expand Down Expand Up @@ -221,15 +220,24 @@ void tipc_named_node_up(unsigned long node)
static void node_is_down(struct publication *publ)
{
struct publication *p;

write_lock_bh(&tipc_nametbl_lock);
dbg("node_is_down: withdrawing %u, %u, %u\n",
publ->type, publ->lower, publ->upper);
publ->key += 1222345;
p = tipc_nametbl_remove_publ(publ->type, publ->lower,
publ->node, publ->ref, publ->key);
assert(p == publ);
write_unlock_bh(&tipc_nametbl_lock);
kfree(publ);

if (p != publ) {
err("Unable to remove publication from failed node\n"
"(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
publ->type, publ->lower, publ->node, publ->ref, publ->key);
}

if (p) {
kfree(p);
}
}

/**
Expand Down Expand Up @@ -275,6 +283,12 @@ void tipc_named_recv(struct sk_buff *buf)
if (publ) {
tipc_nodesub_unsubscribe(&publ->subscr);
kfree(publ);
} else {
err("Unable to remove publication by node 0x%x\n"
"(type=%u, lower=%u, ref=%u, key=%u)\n",
msg_orignode(msg),
ntohl(item->type), ntohl(item->lower),
ntohl(item->ref), ntohl(item->key));
}
} else {
warn("tipc_named_recv: unknown msg\n");
Expand Down
Loading

0 comments on commit f131072

Please sign in to comment.