diff --git a/nat46/modules/nat46-glue.c b/nat46/modules/nat46-glue.c index 9f338bd..5176b40 100644 --- a/nat46/modules/nat46-glue.c +++ b/nat46/modules/nat46-glue.c @@ -18,7 +18,7 @@ #include "nat46-glue.h" #include "nat46-core.h" -static DEFINE_MUTEX(ref_lock); +static DEFINE_SPINLOCK(ref_lock); static int is_valid_nat46(nat46_instance_t *nat46) { return (nat46 && (nat46->sig == NAT46_SIGNATURE)); } @@ -50,25 +50,25 @@ nat46_instance_t *alloc_nat46_instance(int npairs, nat46_instance_t *old, int fr nat46_instance_t *get_nat46_instance(struct sk_buff *sk) { nat46_instance_t *nat46 = netdev_nat46_instance(sk->dev); - mutex_lock(&ref_lock); + spin_lock_bh(&ref_lock); if (is_valid_nat46(nat46)) { nat46->refcount++; - mutex_unlock(&ref_lock); + spin_unlock_bh(&ref_lock); return nat46; } else { printk("[nat46] get_nat46_instance: Could not find a valid NAT46 instance!"); - mutex_unlock(&ref_lock); + spin_unlock_bh(&ref_lock); return NULL; } } void release_nat46_instance(nat46_instance_t *nat46) { - mutex_lock(&ref_lock); + spin_lock_bh(&ref_lock); nat46->refcount--; if(0 == nat46->refcount) { printk("[nat46] release_nat46_instance: freeing nat46 instance with %d pairs\n", nat46->npairs); nat46->sig = FREED_NAT46_SIGNATURE; kfree(nat46); } - mutex_unlock(&ref_lock); + spin_unlock_bh(&ref_lock); }