[netfilter-cvslog] r4262 -
trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter
kadlec at netfilter.org
kadlec at netfilter.org
Wed Sep 14 22:55:25 CEST 2005
Author: kadlec at netfilter.org
Date: 2005-09-14 22:55:24 +0200 (Wed, 14 Sep 2005)
New Revision: 4262
Modified:
trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set.c
Log:
Oops, one file was left out...
Modified: trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set.c 2005-09-14 19:17:42 UTC (rev 4261)
+++ trunk/patch-o-matic-ng/patchlets/set/linux-2.6/net/ipv4/netfilter/ip_set.c 2005-09-14 20:55:24 UTC (rev 4262)
@@ -32,7 +32,7 @@
static struct list_head set_type_list; /* all registered sets */
static struct ip_set **ip_set_list; /* all individual sets */
-static DECLARE_RWLOCK(ip_set_lock); /* protects the lists and the hash */
+static DEFINE_RWLOCK(ip_set_lock); /* protects the lists and the hash */
static DECLARE_MUTEX(ip_set_app_mutex); /* serializes user access */
static ip_set_id_t ip_set_max = CONFIG_IP_NF_SET_MAX;
static ip_set_id_t ip_set_bindings_hash_size = CONFIG_IP_NF_SET_HASHSIZE;
@@ -83,7 +83,7 @@
% ip_set_bindings_hash_size;
struct ip_set_hash *set_hash;
- MUST_BE_READ_LOCKED(&ip_set_lock);
+ ASSERT_READ_LOCK(&ip_set_lock);
IP_SET_ASSERT(ip_set_list[id]);
DP("set: %s, ip: %u.%u.%u.%u", ip_set_list[id]->name, HIPQUAD(ip));
@@ -100,7 +100,7 @@
static inline void
__set_hash_del(struct ip_set_hash *set_hash)
{
- MUST_BE_WRITE_LOCKED(&ip_set_lock);
+ ASSERT_WRITE_LOCK(&ip_set_lock);
IP_SET_ASSERT(ip_set_list[set_hash->binding]);
__ip_set_put(set_hash->binding);
@@ -117,7 +117,7 @@
IP_SET_ASSERT(ip_set_list[id]);
DP("set: %s, ip: %u.%u.%u.%u", ip_set_list[id]->name, HIPQUAD(ip));
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
set_hash = LIST_FIND(&ip_set_hash[key], ip_hash_cmp,
struct ip_set_hash *, id, ip);
DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
@@ -126,7 +126,7 @@
if (set_hash != NULL)
__set_hash_del(set_hash);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
}
@@ -142,7 +142,7 @@
IP_SET_ASSERT(ip_set_list[binding]);
DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
HIPQUAD(ip), ip_set_list[binding]->name);
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
set_hash = LIST_FIND(&ip_set_hash[key], ip_hash_cmp,
struct ip_set_hash *, id, ip);
if (!set_hash) {
@@ -164,7 +164,7 @@
set_hash->binding = binding;
__ip_set_get(set_hash->binding);
unlock:
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return ret;
}
@@ -184,7 +184,7 @@
ip_set_id_t __key; \
struct ip_set_hash *__set_hash, *__n; \
\
- MUST_BE_WRITE_LOCKED(&ip_set_lock); \
+ ASSERT_WRITE_LOCK(&ip_set_lock); \
for (__key = 0; __key < ip_set_bindings_hash_size; __key++) { \
list_for_each_entry_safe(__set_hash, __n, &ip_set_hash[__key], list)\
fn(__set_hash , ## args); \
@@ -207,7 +207,7 @@
int res, i = 0;
IP_SET_ASSERT(flags[i]);
- READ_LOCK(&ip_set_lock);
+ read_lock_bh(&ip_set_lock);
do {
set = ip_set_list[index];
IP_SET_ASSERT(set);
@@ -218,7 +218,7 @@
} while (res > 0
&& flags[++i]
&& follow_bindings(index, set, ip));
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
return res;
}
@@ -234,7 +234,7 @@
IP_SET_ASSERT(flags[i]);
retry:
- READ_LOCK(&ip_set_lock);
+ read_lock_bh(&ip_set_lock);
do {
set = ip_set_list[index];
IP_SET_ASSERT(set);
@@ -245,7 +245,7 @@
} while ((res == 0 || res == -EEXIST)
&& flags[++i]
&& follow_bindings(index, set, ip));
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
if (res == -EAGAIN
&& set->type->retry
@@ -263,7 +263,7 @@
int res, i = 0;
IP_SET_ASSERT(flags[i]);
- READ_LOCK(&ip_set_lock);
+ read_lock_bh(&ip_set_lock);
do {
set = ip_set_list[index];
IP_SET_ASSERT(set);
@@ -274,7 +274,7 @@
} while ((res == 0 || res == -EEXIST)
&& flags[++i]
&& follow_bindings(index, set, ip));
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
}
/* Register and deregister settype */
@@ -307,7 +307,7 @@
return -EINVAL;
}
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
if (find_set_type(set_type->typename)) {
/* Duplicate! */
ip_set_printk("'%s' already registered!",
@@ -322,14 +322,14 @@
list_append(&set_type_list, set_type);
DP("'%s' registered.", set_type->typename);
unlock:
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return ret;
}
void
ip_set_unregister_set_type(struct ip_set_type *set_type)
{
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
if (!find_set_type(set_type->typename)) {
ip_set_printk("'%s' not registered?",
set_type->typename);
@@ -339,7 +339,7 @@
module_put(THIS_MODULE);
DP("'%s' unregistered.", set_type->typename);
unlock:
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
}
@@ -551,13 +551,13 @@
if (binding == IP_SET_INVALID_ID)
return -ENOENT;
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
/* Sets as binding values are referenced */
if (set->binding != IP_SET_INVALID_ID)
__ip_set_put(set->binding);
set->binding = binding;
__ip_set_get(set->binding);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
}
@@ -629,15 +629,15 @@
/* unbind :all: */
if (strcmp(req_bind->binding, IPSET_TOKEN_DEFAULT) == 0) {
/* Default binding of sets */
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
FOREACH_SET_DO(__unbind_default);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
} else if (strcmp(req_bind->binding, IPSET_TOKEN_ALL) == 0) {
/* Flush all bindings of all sets*/
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
FOREACH_HASH_RW_DO(__set_hash_del);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
}
DP("unreachable reached!");
@@ -653,19 +653,19 @@
if (binding == IP_SET_INVALID_ID)
return -ENOENT;
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
/* Sets in hash values are referenced */
__ip_set_put(set->binding);
set->binding = IP_SET_INVALID_ID;
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
} else if (strcmp(req_bind->binding, IPSET_TOKEN_ALL) == 0) {
/* Flush all bindings */
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
FOREACH_HASH_RW_DO(__set_hash_del_byid, set->id);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
}
@@ -741,10 +741,10 @@
{
struct ip_set_type *type;
- READ_LOCK(&ip_set_lock);
+ read_lock_bh(&ip_set_lock);
type = find_set_type(typename);
if (type == NULL)
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
return type;
}
@@ -832,11 +832,11 @@
goto out;
}
if (!try_module_get(set->type->me)) {
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
res = -EFAULT;
goto out;
}
- READ_UNLOCK(&ip_set_lock);
+ read_unlock_bh(&ip_set_lock);
/*
* Without holding any locks, create private part.
@@ -852,7 +852,7 @@
* find free id/index and check that it is not already in
* ip_set_list.
*/
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
if ((res = find_free_id(set->name, &index, &id)) != 0) {
DP("no free id!");
goto cleanup;
@@ -871,11 +871,11 @@
DP("create: '%s' created with index %u, id %u!", set->name, index, id);
set->id = id;
ip_set_list[index] = set;
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return res;
cleanup:
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
set->type->destroy(set);
put_out:
module_put(set->type->me);
@@ -894,12 +894,12 @@
IP_SET_ASSERT(set);
DP("set: %s", set->name);
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
FOREACH_HASH_RW_DO(__set_hash_del_byid, set->id);
if (set->binding != IP_SET_INVALID_ID)
__ip_set_put(set->binding);
ip_set_list[index] = NULL;
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
/* Must call it without holding any lock */
set->type->destroy(set);
@@ -970,7 +970,7 @@
int res = 0;
DP("set: %s to %s", set->name, name);
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
for (i = 0; i < ip_set_max; i++) {
if (ip_set_list[i] != NULL
&& strncmp(ip_set_list[i]->name,
@@ -982,7 +982,7 @@
}
strncpy(set->name, name, IP_SET_MAXNAMELEN);
unlock:
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return res;
}
@@ -1004,7 +1004,7 @@
return -ENOEXEC;
/* No magic here: ref munging protected by the mutex */
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
strncpy(from_name, from->name, IP_SET_MAXNAMELEN);
from_ref = atomic_read(&from->ref);
@@ -1016,7 +1016,7 @@
ip_set_list[from_index] = to;
ip_set_list[to_index] = from;
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
return 0;
}
@@ -1332,10 +1332,10 @@
hash_save->binding);
else {
IP_SET_ASSERT(set->binding == IP_SET_INVALID_ID);
- WRITE_LOCK(&ip_set_lock);
+ write_lock_bh(&ip_set_lock);
set->binding = hash_save->binding;
__ip_set_get(set->binding);
- WRITE_UNLOCK(&ip_set_lock);
+ write_unlock_bh(&ip_set_lock);
DP("default binding: %u", set->binding);
}
if (res != 0)
More information about the netfilter-cvslog
mailing list