Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314312
b: refs/heads/master
c: 75c5a2e
h: refs/heads/master
v: v3
  • Loading branch information
Matthias Schiffer authored and Antonio Quartulli committed Jun 18, 2012
1 parent 29f67bd commit 26bf2c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef3a409391f55ad0bddbf017d4d4987b783a3059
refs/heads/master: 75c5a2e788ab02f67931442e8dcbc854ae7252d1
15 changes: 6 additions & 9 deletions trunk/net/batman-adv/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,23 @@ static inline int hash_add(struct hashtable_t *hash,
head = &hash->table[index];
list_lock = &hash->list_locks[index];

rcu_read_lock();
__hlist_for_each_rcu(node, head) {
spin_lock_bh(list_lock);

hlist_for_each(node, head) {
if (!compare(node, data))
continue;

ret = 1;
goto err_unlock;
goto unlock;
}
rcu_read_unlock();

/* no duplicate found in list, add new element */
spin_lock_bh(list_lock);
hlist_add_head_rcu(data_node, head);
spin_unlock_bh(list_lock);

ret = 0;
goto out;

err_unlock:
rcu_read_unlock();
unlock:
spin_unlock_bh(list_lock);
out:
return ret;
}
Expand Down

0 comments on commit 26bf2c6

Please sign in to comment.