diff options
| author | Harald Welte <laforge@netfilter.org> | 2005-02-23 03:56:46 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2005-02-23 03:56:46 -0800 |
| commit | eb6815fa6d3a472ad48992babeefe63cd4cf76af (patch) | |
| tree | 4df0987e22c8fd7fe47508198fbdf2e96fcf6a01 | |
| parent | 0bb1d4e909db2824055651d763fec15279ca8f98 (diff) | |
[NETFILTER]: ipt_hashlimit: replace rwlock with spinlock
As Samuel points out, the rwlock doesn't really make much sense.
Signed-off-by: Samuel Jean <sjean@cookinglinux.org>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/ipv4/netfilter/ipt_hashlimit.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index 6e4d8e0e65d5..e50eb40df983 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c @@ -97,7 +97,7 @@ struct ipt_hashlimit_htable { struct list_head hash[0]; /* hashtable itself */ }; -static DECLARE_RWLOCK(hashlimit_lock); /* protects htables list */ +static DECLARE_LOCK(hashlimit_lock); /* protects htables list */ static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ static LIST_HEAD(hashlimit_htables); static kmem_cache_t *hashlimit_cachep; @@ -230,9 +230,9 @@ static int htable_create(struct ipt_hashlimit_info *minfo) hinfo->timer.function = htable_gc; add_timer(&hinfo->timer); - WRITE_LOCK(&hashlimit_lock); + LOCK_BH(&hashlimit_lock); list_add(&hinfo->list, &hashlimit_htables); - WRITE_UNLOCK(&hashlimit_lock); + UNLOCK_BH(&hashlimit_lock); return 0; } @@ -296,15 +296,15 @@ static struct ipt_hashlimit_htable *htable_find_get(char *name) { struct ipt_hashlimit_htable *hinfo; - READ_LOCK(&hashlimit_lock); + LOCK_BH(&hashlimit_lock); list_for_each_entry(hinfo, &hashlimit_htables, list) { if (!strcmp(name, hinfo->pde->name)) { atomic_inc(&hinfo->use); - READ_UNLOCK(&hashlimit_lock); + UNLOCK_BH(&hashlimit_lock); return hinfo; } } - READ_UNLOCK(&hashlimit_lock); + UNLOCK_BH(&hashlimit_lock); return NULL; } @@ -312,9 +312,9 @@ static struct ipt_hashlimit_htable *htable_find_get(char *name) static void htable_put(struct ipt_hashlimit_htable *hinfo) { if (atomic_dec_and_test(&hinfo->use)) { - WRITE_LOCK(&hashlimit_lock); + LOCK_BH(&hashlimit_lock); list_del(&hinfo->list); - WRITE_UNLOCK(&hashlimit_lock); + UNLOCK_BH(&hashlimit_lock); htable_destroy(hinfo); } } |
