Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314297
b: refs/heads/master
c: 5d52dad
h: refs/heads/master
i:
  314295: 898e151
v: v3
  • Loading branch information
Sven Eckelmann authored and Antonio Quartulli committed Jun 18, 2012
1 parent 9dc9a66 commit 792c813
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2b6cc8e460494251442a877fcbc150faa175b4f
refs/heads/master: 5d52dad27a08d2c8851acb12b041088ec07881dd
13 changes: 13 additions & 0 deletions trunk/net/batman-adv/bridge_loop_avoidance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,14 @@ static void bla_periodic_work(struct work_struct *work)
bla_start_timer(bat_priv);
}

/* The hash for claim and backbone hash receive the same key because they
* are getting initialized by hash_new with the same key. Reinitializing
* them with to different keys to allow nested locking without generating
* lockdep warnings
*/
static struct lock_class_key claim_hash_lock_class_key;
static struct lock_class_key backbone_hash_lock_class_key;

/* initialize all bla structures */
int bla_init(struct bat_priv *bat_priv)
{
Expand Down Expand Up @@ -1164,6 +1172,11 @@ int bla_init(struct bat_priv *bat_priv)
if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
return -1;

batadv_hash_set_lock_class(bat_priv->claim_hash,
&claim_hash_lock_class_key);
batadv_hash_set_lock_class(bat_priv->backbone_hash,
&backbone_hash_lock_class_key);

bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");

bla_start_timer(bat_priv);
Expand Down
9 changes: 9 additions & 0 deletions trunk/net/batman-adv/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,12 @@ struct hashtable_t *hash_new(uint32_t size)
kfree(hash);
return NULL;
}

void batadv_hash_set_lock_class(struct hashtable_t *hash,
struct lock_class_key *key)
{
uint32_t i;

for (i = 0; i < hash->size; i++)
lockdep_set_class(&hash->list_locks[i], key);
}
4 changes: 4 additions & 0 deletions trunk/net/batman-adv/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ struct hashtable_t {
/* allocates and clears the hash */
struct hashtable_t *hash_new(uint32_t size);

/* set class key for all locks */
void batadv_hash_set_lock_class(struct hashtable_t *hash,
struct lock_class_key *key);

/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash);

Expand Down

0 comments on commit 792c813

Please sign in to comment.