Project

General

Profile

Bug #200 » 0001-TT-memory-leak-debug-patch.patch

Linus Lüssing, 12/13/2014 08:02 AM

View differences:

Makefile
20 20
# B.A.T.M.A.N. debugging:
21 21
export CONFIG_BATMAN_ADV_DEBUG=n
22 22
# B.A.T.M.A.N. bridge loop avoidance:
23
export CONFIG_BATMAN_ADV_BLA=y
23
export CONFIG_BATMAN_ADV_BLA=n
24 24
# B.A.T.M.A.N. distributed ARP table:
25
export CONFIG_BATMAN_ADV_DAT=y
25
export CONFIG_BATMAN_ADV_DAT=n
26 26
# B.A.T.M.A.N network coding (catwoman):
27 27
export CONFIG_BATMAN_ADV_NC=n
28 28
# B.A.T.M.A.N. multicast optimizations:
29
export CONFIG_BATMAN_ADV_MCAST=y
29
export CONFIG_BATMAN_ADV_MCAST=n
30 30

  
31 31
PWD:=$(shell pwd)
32 32
KERNELPATH ?= /lib/modules/$(shell uname -r)/build
bat_iv_ogm.c
1826 1826
			if (!n_ifinfo)
1827 1827
				goto next;
1828 1828

  
1829
			if (n_ifinfo->bat_iv.tq_avg == 0)
1830
				goto next;
1829
//			if (n_ifinfo->bat_iv.tq_avg == 0)
1830
//				goto next;
1831 1831

  
1832 1832
			last_seen_jiffies = jiffies - orig_node->last_seen;
1833 1833
			last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
gateway_client.c
81 81
	if (!orig_node)
82 82
		goto unlock;
83 83

  
84
printk("~~~ batadv_gw_get_selected() - refcount++ (%pM)!\n", orig_node->orig);
84 85
	if (!atomic_inc_not_zero(&orig_node->refcount))
85 86
		orig_node = NULL;
86 87

  
......
124 125
 */
125 126
void batadv_gw_reselect(struct batadv_priv *bat_priv)
126 127
{
128
printk("~~~ Calling batadv_gw_reselect\n");
127 129
	atomic_set(&bat_priv->gw.reselect, 1);
128 130
}
129 131

  
......
255 257
	if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
256 258
		goto out;
257 259

  
260
printk("~~~ Doing batadv_gw_election\n");
258 261
	curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
259 262

  
260 263
	if (!batadv_atomic_dec_not_zero(&bat_priv->gw.reselect) && curr_gw)
......
408 411
	if (gateway->bandwidth_down == 0)
409 412
		return;
410 413

  
414
printk("~~~ batadv_gw_node_add() - refcount++ (%pM)!\n", orig_node->orig);
411 415
	if (!atomic_inc_not_zero(&orig_node->refcount))
412 416
		return;
413 417

  
......
446 450
		   struct batadv_orig_node *orig_node)
447 451
{
448 452
	struct batadv_gw_node *gw_node_tmp, *gw_node = NULL;
453
//printk("~~~ Calling batadv_gw_node_get for %pM\n", orig_node->orig);
449 454

  
450 455
	rcu_read_lock();
451 456
	hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.list, list) {
......
478 483
			   struct batadv_tvlv_gateway_data *gateway)
479 484
{
480 485
	struct batadv_gw_node *gw_node, *curr_gw = NULL;
486
//printk("~~~ Calling batadv_gw_node_update for %pM\n", orig_node->orig);
481 487

  
482 488
	gw_node = batadv_gw_node_get(bat_priv, orig_node);
483 489
	if (!gw_node) {
......
530 536
			   struct batadv_orig_node *orig_node)
531 537
{
532 538
	struct batadv_tvlv_gateway_data gateway;
539
printk("~~~ Calling batadv_gw_node_delete for %pM\n", orig_node->orig);
533 540

  
534 541
	gateway.bandwidth_down = 0;
535 542
	gateway.bandwidth_up = 0;
......
559 566
			do_reselect = 1;
560 567

  
561 568
		hlist_del_rcu(&gw_node->list);
569
printk("~~~ batadv_gw_node_purge for %pM%s\n", gw_node->orig_node->orig, do_reselect ? " (reselecting)" : "");
562 570
		batadv_gw_node_free_ref(gw_node);
563 571
	}
564 572

  
main.h
38 38
/* purge originators after time in seconds if no valid packet comes in
39 39
 * -> TODO: check influence on BATADV_TQ_LOCAL_WINDOW_SIZE
40 40
 */
41
#define BATADV_PURGE_TIMEOUT 200000 /* 200 seconds */
42
#define BATADV_TT_LOCAL_TIMEOUT 600000 /* in milliseconds */
43
#define BATADV_TT_CLIENT_ROAM_TIMEOUT 600000 /* in milliseconds */
44
#define BATADV_TT_CLIENT_TEMP_TIMEOUT 600000 /* in milliseconds */
41
#define BATADV_PURGE_TIMEOUT 2000 /* 200 seconds */
42
#define BATADV_TT_LOCAL_TIMEOUT 6000 /* in milliseconds */
43
#define BATADV_TT_CLIENT_ROAM_TIMEOUT 6000 /* in milliseconds */
44
#define BATADV_TT_CLIENT_TEMP_TIMEOUT 6000 /* in milliseconds */
45 45
#define BATADV_TT_WORK_PERIOD 5000 /* 5 seconds */
46
#define BATADV_ORIG_WORK_PERIOD 1000 /* 1 second */
47
#define BATADV_DAT_ENTRY_TIMEOUT (5*60000) /* 5 mins in milliseconds */
46
#define BATADV_ORIG_WORK_PERIOD 500 /* 1 second */
47
#define BATADV_DAT_ENTRY_TIMEOUT (5*600) /* 5 mins in milliseconds */
48 48
/* sliding packet range of received originator messages in sequence numbers
49 49
 * (should be a multiple of our word size)
50 50
 */
originator.c
547 547

  
548 548
	orig_node = container_of(rcu, struct batadv_orig_node, rcu);
549 549

  
550
	atomic_set(&orig_node->curse_timeout, 0);
551
	cancel_delayed_work_sync(&orig_node->curse);
552

  
550 553
	spin_lock_bh(&orig_node->neigh_list_lock);
551 554

  
552 555
	/* for all neighbors towards this originator ... */
......
634 637
	batadv_hash_destroy(hash);
635 638
}
636 639

  
640
static void batadv_orig_node_cursed(struct work_struct *work)
641
{
642
	struct delayed_work *delayed_work;
643
	struct batadv_orig_node *orig_node;
644
	unsigned long timeout;
645

  
646
	delayed_work = container_of(work, struct delayed_work, work);
647
	orig_node = container_of(delayed_work, struct batadv_orig_node, curse);
648

  
649
	timeout = atomic_inc_return(&orig_node->curse_timeout);
650
	if (timeout <= 1)
651
		return;
652

  
653
	timeout = 15 * (2 << (timeout-2)) / 2;
654
	pr_warn("Orig node %pM (%p) not purged after %lu seconds - did it become a zombie?\n", orig_node->orig, orig_node, timeout);
655
	timeout = msecs_to_jiffies(1000*2*timeout);
656

  
657
	queue_delayed_work(batadv_event_workqueue,
658
			   &orig_node->curse, timeout);
659
}
660

  
637 661
/**
638 662
 * batadv_orig_node_new - creates a new orig_node
639 663
 * @bat_priv: the bat priv with all the soft interface information
......
661 685
	INIT_HLIST_HEAD(&orig_node->neigh_list);
662 686
	INIT_LIST_HEAD(&orig_node->vlan_list);
663 687
	INIT_HLIST_HEAD(&orig_node->ifinfo_list);
688
	INIT_DELAYED_WORK(&orig_node->curse, batadv_orig_node_cursed);
664 689
	spin_lock_init(&orig_node->bcast_seqno_lock);
665 690
	spin_lock_init(&orig_node->neigh_list_lock);
666 691
	spin_lock_init(&orig_node->tt_buff_lock);
......
977 1002
			if (batadv_purge_orig_node(bat_priv, orig_node)) {
978 1003
				batadv_gw_node_delete(bat_priv, orig_node);
979 1004
				hlist_del_rcu(&orig_node->hash_entry);
1005
				atomic_set(&orig_node->curse_timeout, 1);
1006
				queue_delayed_work(batadv_event_workqueue,
1007
						   &orig_node->curse,
1008
						   msecs_to_jiffies(15000));
980 1009
				batadv_orig_node_free_ref(orig_node);
981 1010
				continue;
982 1011
			}
soft-interface.c
755 755
	atomic_set(&bat_priv->gw_sel_class, 20);
756 756
	atomic_set(&bat_priv->gw.bandwidth_down, 100);
757 757
	atomic_set(&bat_priv->gw.bandwidth_up, 20);
758
	atomic_set(&bat_priv->orig_interval, 1000);
758
	atomic_set(&bat_priv->orig_interval, 100);
759 759
	atomic_set(&bat_priv->hop_penalty, 30);
760 760
#ifdef CONFIG_BATMAN_ADV_DEBUG
761 761
	atomic_set(&bat_priv->log_level, 0);
translation-table.c
1985 1985
	struct batadv_orig_node *orig_node = NULL;
1986 1986
	struct batadv_tt_orig_list_entry *best_entry;
1987 1987

  
1988
printk("~~~ batadv_transtable_search() addr: %pM\n", addr);
1989

  
1988 1990
	if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) {
1989 1991
		tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid);
1990 1992
		if (!tt_local_entry ||
types.h
285 285
	struct list_head vlan_list;
286 286
	spinlock_t vlan_list_lock; /* protects vlan_list */
287 287
	struct batadv_orig_bat_iv bat_iv;
288
	struct delayed_work curse;
289
	atomic_t curse_timeout;
288 290
};
289 291

  
290 292
/**
291
- 
(1-1/2)