]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/netfilter/ipt_hashlimit.c
[PATCH] sem2mutex: misc static one-file mutexes
[net-next-2.6.git] / net / ipv4 / netfilter / ipt_hashlimit.c
index dc1521c5aa810bf8016f7ff5732bc6a282d022a0..ba5e23505e88dded2d1b84786b93b1ea3da97dc2 100644 (file)
@@ -40,6 +40,7 @@
 
 /* FIXME: this is just for IP_NF_ASSERRT */
 #include <linux/netfilter_ipv4/ip_conntrack.h>
+#include <linux/mutex.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
@@ -92,7 +93,7 @@ struct ipt_hashlimit_htable {
 };
 
 static DEFINE_SPINLOCK(hashlimit_lock);        /* protects htables list */
-static DECLARE_MUTEX(hlimit_mutex);    /* additional checkentry protection */
+static DEFINE_MUTEX(hlimit_mutex);     /* additional checkentry protection */
 static HLIST_HEAD(hashlimit_htables);
 static kmem_cache_t *hashlimit_cachep __read_mostly;
 
@@ -542,13 +543,13 @@ hashlimit_checkentry(const char *tablename,
         * call vmalloc, and that can sleep.  And we cannot just re-search
         * the list of htable's in htable_create(), since then we would
         * create duplicate proc files. -HW */
-       down(&hlimit_mutex);
+       mutex_lock(&hlimit_mutex);
        r->hinfo = htable_find_get(r->name);
        if (!r->hinfo && (htable_create(r) != 0)) {
-               up(&hlimit_mutex);
+               mutex_unlock(&hlimit_mutex);
                return 0;
        }
-       up(&hlimit_mutex);
+       mutex_unlock(&hlimit_mutex);
 
        /* Ugly hack: For SMP, we only want to use one set */
        r->u.master = r;