diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2006-06-26 02:52:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-06-26 02:52:17 -0400 |
commit | a10bd924a421e0e5d5bb9640735b9317b8e473b5 (patch) | |
tree | d86ac98e60292c3197a8f6ef9af86549dd051102 /net/tipc/link.c | |
parent | f131072c3da84e70a0f65d71b3a3f6611c6a22bc (diff) |
[TIPC]: Enhanced & cleaned up system messages; fixed 2 obscure memory leaks.
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>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 2efced5a673c..d7668b8abb2d 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -419,7 +419,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
419 | 419 | ||
420 | l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC); | 420 | l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC); |
421 | if (!l_ptr) { | 421 | if (!l_ptr) { |
422 | warn("Memory squeeze; Failed to create link\n"); | 422 | warn("Link creation failed, no memory\n"); |
423 | return NULL; | 423 | return NULL; |
424 | } | 424 | } |
425 | memset(l_ptr, 0, sizeof(*l_ptr)); | 425 | memset(l_ptr, 0, sizeof(*l_ptr)); |
@@ -469,7 +469,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
469 | 469 | ||
470 | if (!pb) { | 470 | if (!pb) { |
471 | kfree(l_ptr); | 471 | kfree(l_ptr); |
472 | warn("Memory squeeze; Failed to create link\n"); | 472 | warn("Link creation failed, no memory for print buffer\n"); |
473 | return NULL; | 473 | return NULL; |
474 | } | 474 | } |
475 | tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); | 475 | tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); |
@@ -819,6 +819,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) | |||
819 | break; | 819 | break; |
820 | case RESET_MSG: | 820 | case RESET_MSG: |
821 | dbg_link("RES -> RR\n"); | 821 | dbg_link("RES -> RR\n"); |
822 | info("Resetting link <%s>, requested by peer\n", | ||
823 | l_ptr->name); | ||
822 | tipc_link_reset(l_ptr); | 824 | tipc_link_reset(l_ptr); |
823 | l_ptr->state = RESET_RESET; | 825 | l_ptr->state = RESET_RESET; |
824 | l_ptr->fsm_msg_cnt = 0; | 826 | l_ptr->fsm_msg_cnt = 0; |
@@ -843,6 +845,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) | |||
843 | break; | 845 | break; |
844 | case RESET_MSG: | 846 | case RESET_MSG: |
845 | dbg_link("RES -> RR\n"); | 847 | dbg_link("RES -> RR\n"); |
848 | info("Resetting link <%s>, requested by peer " | ||
849 | "while probing\n", l_ptr->name); | ||
846 | tipc_link_reset(l_ptr); | 850 | tipc_link_reset(l_ptr); |
847 | l_ptr->state = RESET_RESET; | 851 | l_ptr->state = RESET_RESET; |
848 | l_ptr->fsm_msg_cnt = 0; | 852 | l_ptr->fsm_msg_cnt = 0; |
@@ -874,6 +878,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) | |||
874 | } else { /* Link has failed */ | 878 | } else { /* Link has failed */ |
875 | dbg_link("-> RU (%u probes unanswered)\n", | 879 | dbg_link("-> RU (%u probes unanswered)\n", |
876 | l_ptr->fsm_msg_cnt); | 880 | l_ptr->fsm_msg_cnt); |
881 | warn("Resetting link <%s>, peer not responding\n", | ||
882 | l_ptr->name); | ||
877 | tipc_link_reset(l_ptr); | 883 | tipc_link_reset(l_ptr); |
878 | l_ptr->state = RESET_UNKNOWN; | 884 | l_ptr->state = RESET_UNKNOWN; |
879 | l_ptr->fsm_msg_cnt = 0; | 885 | l_ptr->fsm_msg_cnt = 0; |
@@ -1049,7 +1055,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) | |||
1049 | msg_dbg(msg, "TIPC: Congestion, throwing away\n"); | 1055 | msg_dbg(msg, "TIPC: Congestion, throwing away\n"); |
1050 | buf_discard(buf); | 1056 | buf_discard(buf); |
1051 | if (imp > CONN_MANAGER) { | 1057 | if (imp > CONN_MANAGER) { |
1052 | warn("Resetting <%s>, send queue full", l_ptr->name); | 1058 | warn("Resetting link <%s>, send queue full", l_ptr->name); |
1053 | tipc_link_reset(l_ptr); | 1059 | tipc_link_reset(l_ptr); |
1054 | } | 1060 | } |
1055 | return dsz; | 1061 | return dsz; |
@@ -2228,7 +2234,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) | |||
2228 | 2234 | ||
2229 | if (msg_linkprio(msg) && | 2235 | if (msg_linkprio(msg) && |
2230 | (msg_linkprio(msg) != l_ptr->priority)) { | 2236 | (msg_linkprio(msg) != l_ptr->priority)) { |
2231 | warn("Changing prio <%s>: %u->%u\n", | 2237 | warn("Resetting link <%s>, priority change %u->%u\n", |
2232 | l_ptr->name, l_ptr->priority, msg_linkprio(msg)); | 2238 | l_ptr->name, l_ptr->priority, msg_linkprio(msg)); |
2233 | l_ptr->priority = msg_linkprio(msg); | 2239 | l_ptr->priority = msg_linkprio(msg); |
2234 | tipc_link_reset(l_ptr); /* Enforce change to take effect */ | 2240 | tipc_link_reset(l_ptr); /* Enforce change to take effect */ |
@@ -2348,7 +2354,8 @@ void tipc_link_changeover(struct link *l_ptr) | |||
2348 | msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); | 2354 | msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); |
2349 | tipc_link_send_buf(tunnel, buf); | 2355 | tipc_link_send_buf(tunnel, buf); |
2350 | } else { | 2356 | } else { |
2351 | warn("Memory squeeze; link changeover failed\n"); | 2357 | warn("Link changeover error, " |
2358 | "unable to send changeover msg\n"); | ||
2352 | } | 2359 | } |
2353 | return; | 2360 | return; |
2354 | } | 2361 | } |
@@ -2398,7 +2405,8 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) | |||
2398 | msg_set_size(&tunnel_hdr, length + INT_H_SIZE); | 2405 | msg_set_size(&tunnel_hdr, length + INT_H_SIZE); |
2399 | outbuf = buf_acquire(length + INT_H_SIZE); | 2406 | outbuf = buf_acquire(length + INT_H_SIZE); |
2400 | if (outbuf == NULL) { | 2407 | if (outbuf == NULL) { |
2401 | warn("Memory squeeze; buffer duplication failed\n"); | 2408 | warn("Link changeover error, " |
2409 | "unable to send duplicate msg\n"); | ||
2402 | return; | 2410 | return; |
2403 | } | 2411 | } |
2404 | memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); | 2412 | memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); |
@@ -2473,7 +2481,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, | |||
2473 | } | 2481 | } |
2474 | *buf = buf_extract(tunnel_buf,INT_H_SIZE); | 2482 | *buf = buf_extract(tunnel_buf,INT_H_SIZE); |
2475 | if (*buf == NULL) { | 2483 | if (*buf == NULL) { |
2476 | warn("Memory squeeze; failed to extract msg\n"); | 2484 | warn("Link changeover error, duplicate msg dropped\n"); |
2477 | goto exit; | 2485 | goto exit; |
2478 | } | 2486 | } |
2479 | msg_dbg(tunnel_msg, "TNL<REC<"); | 2487 | msg_dbg(tunnel_msg, "TNL<REC<"); |
@@ -2485,6 +2493,8 @@ static int link_recv_changeover_msg(struct link **l_ptr, | |||
2485 | 2493 | ||
2486 | if (tipc_link_is_up(dest_link)) { | 2494 | if (tipc_link_is_up(dest_link)) { |
2487 | msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); | 2495 | msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); |
2496 | info("Resetting link <%s>, changeover initiated by peer\n", | ||
2497 | dest_link->name); | ||
2488 | tipc_link_reset(dest_link); | 2498 | tipc_link_reset(dest_link); |
2489 | dest_link->exp_msg_count = msg_count; | 2499 | dest_link->exp_msg_count = msg_count; |
2490 | if (!msg_count) | 2500 | if (!msg_count) |
@@ -2514,7 +2524,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, | |||
2514 | buf_discard(tunnel_buf); | 2524 | buf_discard(tunnel_buf); |
2515 | return 1; | 2525 | return 1; |
2516 | } else { | 2526 | } else { |
2517 | warn("Memory squeeze; dropped incoming msg\n"); | 2527 | warn("Link changeover error, original msg dropped\n"); |
2518 | } | 2528 | } |
2519 | } | 2529 | } |
2520 | exit: | 2530 | exit: |
@@ -2536,13 +2546,8 @@ void tipc_link_recv_bundle(struct sk_buff *buf) | |||
2536 | while (msgcount--) { | 2546 | while (msgcount--) { |
2537 | obuf = buf_extract(buf, pos); | 2547 | obuf = buf_extract(buf, pos); |
2538 | if (obuf == NULL) { | 2548 | if (obuf == NULL) { |
2539 | char addr_string[16]; | 2549 | warn("Link unable to unbundle message(s)\n"); |
2540 | 2550 | break; | |
2541 | warn("Buffer allocation failure;\n"); | ||
2542 | warn(" incoming message(s) from %s lost\n", | ||
2543 | addr_string_fill(addr_string, | ||
2544 | msg_orignode(buf_msg(buf)))); | ||
2545 | return; | ||
2546 | }; | 2551 | }; |
2547 | pos += align(msg_size(buf_msg(obuf))); | 2552 | pos += align(msg_size(buf_msg(obuf))); |
2548 | msg_dbg(buf_msg(obuf), " /"); | 2553 | msg_dbg(buf_msg(obuf), " /"); |
@@ -2600,7 +2605,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) | |||
2600 | } | 2605 | } |
2601 | fragm = buf_acquire(fragm_sz + INT_H_SIZE); | 2606 | fragm = buf_acquire(fragm_sz + INT_H_SIZE); |
2602 | if (fragm == NULL) { | 2607 | if (fragm == NULL) { |
2603 | warn("Memory squeeze; failed to fragment msg\n"); | 2608 | warn("Link unable to fragment message\n"); |
2604 | dsz = -ENOMEM; | 2609 | dsz = -ENOMEM; |
2605 | goto exit; | 2610 | goto exit; |
2606 | } | 2611 | } |
@@ -2715,7 +2720,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, | |||
2715 | set_fragm_size(pbuf,fragm_sz); | 2720 | set_fragm_size(pbuf,fragm_sz); |
2716 | set_expected_frags(pbuf,exp_fragm_cnt - 1); | 2721 | set_expected_frags(pbuf,exp_fragm_cnt - 1); |
2717 | } else { | 2722 | } else { |
2718 | warn("Memory squeeze; got no defragmenting buffer\n"); | 2723 | warn("Link unable to reassemble fragmented message\n"); |
2719 | } | 2724 | } |
2720 | buf_discard(fbuf); | 2725 | buf_discard(fbuf); |
2721 | return 0; | 2726 | return 0; |