Replace DEFINE_RWLOCK(nf_conntrack_lock) with DEFINE_SPINLOCK(nf_conntrack_lock) A small review didn't reveal any recursive read locking so the conversion should be safe and lockdep hasn't complained yet either. Still untested on SMP. Signed-off-by: Martin Josefsson --- include/net/netfilter/nf_conntrack_core.h | 2 - net/netfilter/nf_conntrack_core.c | 60 +++++++++++++++--------------- net/netfilter/nf_conntrack_expect.c | 22 +++++------ net/netfilter/nf_conntrack_helper.c | 14 +++---- net/netfilter/nf_conntrack_netlink.c | 30 +++++++-------- net/netfilter/nf_conntrack_proto.c | 28 +++++++------- net/netfilter/nf_conntrack_standalone.c | 4 +- net/netfilter/xt_helper.c | 4 +- 8 files changed, 82 insertions(+), 82 deletions(-) Index: linux-2.6.19-rc3-git4.quilt/include/net/netfilter/nf_conntrack_core.h =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/include/net/netfilter/nf_conntrack_core.h 2006-11-02 19:14:44.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/include/net/netfilter/nf_conntrack_core.h 2006-11-02 19:14:56.000000000 +0100 @@ -80,7 +80,7 @@ print_tuple(struct seq_file *s, const st extern struct list_head *nf_conntrack_hash; extern struct list_head nf_conntrack_expect_list; -extern rwlock_t nf_conntrack_lock ; +extern spinlock_t nf_conntrack_lock ; extern struct list_head unconfirmed; #endif /* _NF_CONNTRACK_CORE_H */ Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_core.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_core.c 2006-11-02 19:14:50.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_core.c 2006-11-02 19:15:20.000000000 +0100 @@ -62,7 +62,7 @@ #define DEBUGP(format, args...) #endif -DEFINE_RWLOCK(nf_conntrack_lock); +DEFINE_SPINLOCK(nf_conntrack_lock); /* nf_conntrack_standalone needs this */ atomic_t nf_conntrack_count = ATOMIC_INIT(0); @@ -329,7 +329,7 @@ destroy_conntrack(struct nf_conntrack *n if (nf_conntrack_destroyed) nf_conntrack_destroyed(ct); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); /* Expectations will have been removed in clean_from_lists, * except TFTP can create an expectation on the first packet, * before connection is in the list, so we need to clean here, @@ -343,7 +343,7 @@ destroy_conntrack(struct nf_conntrack *n } NF_CT_STAT_INC(delete); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); if (ct->master) nf_ct_put(ct->master); @@ -367,12 +367,12 @@ static void death_by_timeout(unsigned lo { struct nf_conn *ct = (void *)ul_conntrack; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); /* Inside lock so preempt is disabled on module removal path. * Otherwise we can get spurious warnings. */ NF_CT_STAT_INC(delete_list); clean_from_lists(ct); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); nf_ct_put(ct); } @@ -402,11 +402,11 @@ nf_conntrack_find_get(const struct nf_co { struct nf_conntrack_tuple_hash *h; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); h = __nf_conntrack_find(tuple, ignored_conntrack); if (h) atomic_inc(&nf_ct_tuplehash_to_ctrack(h)->ct_general.use); - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return h; } @@ -429,9 +429,9 @@ void nf_conntrack_hash_insert(struct nf_ hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); __nf_conntrack_hash_insert(ct, hash, repl_hash); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } /* Confirm a connection given skb; places it in hash table */ @@ -466,7 +466,7 @@ __nf_conntrack_confirm(struct sk_buff ** NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); DEBUGP("Confirming conntrack %p\n", ct); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); /* See if there's one in the list already, including reverse: NAT could have grabbed it without realizing, since we're @@ -492,7 +492,7 @@ __nf_conntrack_confirm(struct sk_buff ** atomic_inc(&ct->ct_general.use); set_bit(IPS_CONFIRMED_BIT, &ct->status); NF_CT_STAT_INC(insert); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); help = nfct_help(ct); if (help && help->helper) nf_conntrack_event_cache(IPCT_HELPER, ct); @@ -507,7 +507,7 @@ __nf_conntrack_confirm(struct sk_buff ** out: NF_CT_STAT_INC(insert_failed); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return NF_DROP; } @@ -519,9 +519,9 @@ nf_conntrack_tuple_taken(const struct nf { struct nf_conntrack_tuple_hash *h; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); h = __nf_conntrack_find(tuple, ignored_conntrack); - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return h != NULL; } @@ -535,7 +535,7 @@ static int early_drop(struct list_head * struct nf_conn *ct = NULL, *tmp; int dropped = 0; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); list_for_each_entry_reverse(h, chain, list) { tmp = nf_ct_tuplehash_to_ctrack(h); if (!test_bit(IPS_ASSURED_BIT, &tmp->status)) { @@ -544,7 +544,7 @@ static int early_drop(struct list_head * break; } } - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); if (!ct) return dropped; @@ -593,11 +593,11 @@ __nf_conntrack_alloc(const struct nf_con features = l3proto->get_features(orig); /* FIXME: protect helper list per RCU */ - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); helper = __nf_ct_helper_find(repl); if (helper) features |= NF_CT_F_HELP; - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); DEBUGP("nf_conntrack_alloc: features=0x%x\n", features); @@ -690,7 +690,7 @@ init_conntrack(const struct nf_conntrack return NULL; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); exp = find_expectation(tuple); if (exp) { @@ -713,7 +713,7 @@ init_conntrack(const struct nf_conntrack /* Overload tuple linked list to put us in unconfirmed list. */ list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); if (exp) { if (exp->expectfn) @@ -871,11 +871,11 @@ void __nf_ct_refresh_acct(struct nf_conn NF_CT_ASSERT(ct->timeout.data == (unsigned long)ct); NF_CT_ASSERT(skb); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); /* Only update if this is not a fixed timeout */ if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return; } @@ -903,7 +903,7 @@ void __nf_ct_refresh_acct(struct nf_conn } #endif - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); /* must be unlocked when calling event cache */ if (event) @@ -992,7 +992,7 @@ get_next_corpse(int (*iter)(struct nf_co struct nf_conntrack_tuple_hash *h; struct nf_conn *ct; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); for (; *bucket < nf_conntrack_htable_size; (*bucket)++) { list_for_each_entry(h, &nf_conntrack_hash[*bucket], list) { ct = nf_ct_tuplehash_to_ctrack(h); @@ -1005,11 +1005,11 @@ get_next_corpse(int (*iter)(struct nf_co if (iter(ct, data)) goto found; } - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return NULL; found: atomic_inc(&ct->ct_general.use); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return ct; } @@ -1137,7 +1137,7 @@ int set_hashsize(const char *val, struct * use a newrandom seed */ get_random_bytes(&rnd, 4); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); for (i = 0; i < nf_conntrack_htable_size; i++) { while (!list_empty(&nf_conntrack_hash[i])) { h = list_entry(nf_conntrack_hash[i].next, @@ -1155,7 +1155,7 @@ int set_hashsize(const char *val, struct nf_conntrack_vmalloc = vmalloced; nf_conntrack_hash = hash; nf_conntrack_hash_rnd = rnd; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); free_conntrack_hash(old_hash, old_vmalloced, old_size); return 0; @@ -1209,10 +1209,10 @@ int __init nf_conntrack_init(void) } /* Don't NEED lock here, but good form anyway. */ - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); for (i = 0; i < AF_MAX; i++) nf_ct_l3protos[i] = &nf_conntrack_l3proto_generic; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); /* For use by REJECT target */ ip_ct_attach = __nf_conntrack_attach; Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_netlink.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_netlink.c 2006-11-02 19:14:44.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_netlink.c 2006-11-02 19:14:56.000000000 +0100 @@ -418,7 +418,7 @@ ctnetlink_dump_table(struct sk_buff *skb struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); u_int8_t l3proto = nfmsg->nfgen_family; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); last = (struct nf_conn *)cb->args[1]; for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { restart: @@ -457,7 +457,7 @@ restart: } } out: - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); if (last) nf_ct_put(last); @@ -1012,14 +1012,14 @@ ctnetlink_new_conntrack(struct sock *ctn return err; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (cda[CTA_TUPLE_ORIG-1]) h = __nf_conntrack_find(&otuple, NULL); else if (cda[CTA_TUPLE_REPLY-1]) h = __nf_conntrack_find(&rtuple, NULL); if (h == NULL) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); err = -ENOENT; if (nlh->nlmsg_flags & NLM_F_CREATE) err = ctnetlink_create_conntrack(cda, &otuple, &rtuple); @@ -1040,7 +1040,7 @@ ctnetlink_new_conntrack(struct sock *ctn err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda); out_unlock: - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return err; } @@ -1215,7 +1215,7 @@ ctnetlink_exp_dump_table(struct sk_buff struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); u_int8_t l3proto = nfmsg->nfgen_family; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); list_for_each_prev(i, &nf_conntrack_expect_list) { exp = (struct nf_conntrack_expect *) i; if (l3proto && exp->tuple.src.l3num != l3proto) @@ -1230,7 +1230,7 @@ ctnetlink_exp_dump_table(struct sk_buff *id = exp->id; } out: - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return skb->len; } @@ -1354,10 +1354,10 @@ ctnetlink_del_expect(struct sock *ctnl, char *name = NFA_DATA(cda[CTA_EXPECT_HELP_NAME-1]); /* delete all expectations for this helper */ - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); h = __nf_conntrack_helper_find_byname(name); if (!h) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return -EINVAL; } list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list, @@ -1369,10 +1369,10 @@ ctnetlink_del_expect(struct sock *ctnl, nf_conntrack_expect_put(exp); } } - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } else { /* This basically means we have to flush everything*/ - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list, list) { if (del_timer(&exp->timeout)) { @@ -1380,7 +1380,7 @@ ctnetlink_del_expect(struct sock *ctnl, nf_conntrack_expect_put(exp); } } - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } return 0; @@ -1467,11 +1467,11 @@ ctnetlink_new_expect(struct sock *ctnl, if (err < 0) return err; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); exp = __nf_conntrack_expect_find(&tuple); if (!exp) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); err = -ENOENT; if (nlh->nlmsg_flags & NLM_F_CREATE) err = ctnetlink_create_expect(cda, u3); @@ -1481,7 +1481,7 @@ ctnetlink_new_expect(struct sock *ctnl, err = -EEXIST; if (!(nlh->nlmsg_flags & NLM_F_EXCL)) err = ctnetlink_change_expect(exp, cda); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return err; } Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_standalone.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_standalone.c 2006-11-02 19:14:50.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_standalone.c 2006-11-02 19:14:56.000000000 +0100 @@ -111,7 +111,7 @@ static struct list_head *ct_get_idx(stru static void *ct_seq_start(struct seq_file *seq, loff_t *pos) { - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); return ct_get_idx(seq, *pos); } @@ -123,7 +123,7 @@ static void *ct_seq_next(struct seq_file static void ct_seq_stop(struct seq_file *s, void *v) { - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } /* return 0 on success, 1 in case of error */ Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/xt_helper.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/xt_helper.c 2006-10-29 22:58:55.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/xt_helper.c 2006-11-02 19:14:56.000000000 +0100 @@ -113,7 +113,7 @@ match(const struct sk_buff *skb, return ret; } - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); master_help = nfct_help(ct->master); if (!master_help || !master_help->helper) { DEBUGP("xt_helper: master ct %p has no helper\n", @@ -130,7 +130,7 @@ match(const struct sk_buff *skb, ret ^= !strncmp(master_help->helper->name, info->name, strlen(master_help->helper->name)); out_unlock: - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return ret; } #endif Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_expect.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_expect.c 2006-11-02 19:14:45.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_expect.c 2006-11-02 19:14:56.000000000 +0100 @@ -49,9 +49,9 @@ static void expectation_timed_out(unsign { struct nf_conntrack_expect *exp = (void *)ul_expect; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); nf_ct_unlink_expect(exp); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); nf_conntrack_expect_put(exp); } @@ -75,9 +75,9 @@ nf_conntrack_expect_find(const struct nf { struct nf_conntrack_expect *i; - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); i = __nf_conntrack_expect_find(tuple); - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return i; } @@ -168,17 +168,17 @@ void nf_conntrack_unexpect_related(struc { struct nf_conntrack_expect *i; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); /* choose the the oldest expectation to evict */ list_for_each_entry_reverse(i, &nf_conntrack_expect_list, list) { if (expect_matches(i, exp) && del_timer(&i->timeout)) { nf_ct_unlink_expect(i); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); nf_conntrack_expect_put(i); return; } } - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } /* We don't increase the master conntrack refcount for non-fulfilled @@ -259,7 +259,7 @@ int nf_conntrack_expect_related(struct n NF_CT_ASSERT(master_help); - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); list_for_each_entry(i, &nf_conntrack_expect_list, list) { if (expect_matches(i, expect)) { /* Refresh timer: if it's dying, ignore.. */ @@ -281,7 +281,7 @@ int nf_conntrack_expect_related(struct n nf_conntrack_expect_event(IPEXP_NEW, expect); ret = 0; out: - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return ret; } @@ -293,7 +293,7 @@ static void *exp_seq_start(struct seq_fi /* strange seq_file api calls stop even if we fail, * thus we need to grab lock since stop unlocks */ - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (list_empty(e)) return NULL; @@ -321,7 +321,7 @@ static void *exp_seq_next(struct seq_fil static void exp_seq_stop(struct seq_file *s, void *v) { - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } static int exp_seq_show(struct seq_file *s, void *v) Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_helper.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_helper.c 2006-11-02 19:14:45.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_helper.c 2006-11-02 19:14:56.000000000 +0100 @@ -51,7 +51,7 @@ nf_ct_helper_find_get( const struct nf_c /* need nf_conntrack_lock to assure that helper exists until * try_module_get() is called */ - read_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); helper = __nf_ct_helper_find(tuple); if (helper) { @@ -62,7 +62,7 @@ nf_ct_helper_find_get( const struct nf_c helper = NULL; } - read_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return helper; } @@ -111,9 +111,9 @@ int nf_conntrack_helper_register(struct printk(KERN_ERR "nf_conntrack_helper_reigster: Unable to create slab cache for conntracks\n"); return ret; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); list_add(&me->list, &helpers); - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); return 0; } @@ -124,8 +124,8 @@ void nf_conntrack_helper_unregister(stru struct nf_conntrack_tuple_hash *h; struct nf_conntrack_expect *exp, *tmp; - /* Need write lock here, to delete helper. */ - write_lock_bh(&nf_conntrack_lock); + /* Need lock here, to delete helper. */ + spin_lock_bh(&nf_conntrack_lock); list_del(&me->list); /* Get rid of expectations */ @@ -144,7 +144,7 @@ void nf_conntrack_helper_unregister(stru list_for_each_entry(h, &nf_conntrack_hash[i], list) unhelp(h, me); } - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); /* Someone could be still looking at the helper in a bh. */ synchronize_net(); Index: linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_proto.c =================================================================== --- linux-2.6.19-rc3-git4.quilt.orig/net/netfilter/nf_conntrack_proto.c 2006-11-02 19:14:48.000000000 +0100 +++ linux-2.6.19-rc3-git4.quilt/net/netfilter/nf_conntrack_proto.c 2006-11-02 19:14:56.000000000 +0100 @@ -133,7 +133,7 @@ int nf_conntrack_l3proto_register(struct goto out; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (nf_ct_l3protos[proto->l3proto] != &nf_conntrack_l3proto_generic) { ret = -EBUSY; goto out_unlock; @@ -141,7 +141,7 @@ int nf_conntrack_l3proto_register(struct nf_ct_l3protos[proto->l3proto] = proto; out_unlock: - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); out: return ret; } @@ -155,15 +155,15 @@ int nf_conntrack_l3proto_unregister(stru goto out; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (nf_ct_l3protos[proto->l3proto] != proto) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); ret = -EBUSY; goto out; } nf_ct_l3protos[proto->l3proto] = &nf_conntrack_l3proto_generic; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); /* Somebody could be still looking at the proto in bh. */ synchronize_net(); @@ -187,7 +187,7 @@ int nf_conntrack_l4proto_register(struct } retry: - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (nf_ct_protos[l4proto->l3proto]) { if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != &nf_conntrack_l4proto_generic) { @@ -199,7 +199,7 @@ retry: struct nf_conntrack_l4proto **proto_array; int i; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); proto_array = (struct nf_conntrack_l4proto **) kmalloc(MAX_NF_CT_PROTO * @@ -212,14 +212,14 @@ retry: for (i = 0; i < MAX_NF_CT_PROTO; i++) proto_array[i] = &nf_conntrack_l4proto_generic; - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (nf_ct_protos[l4proto->l3proto]) { /* bad timing, but no problem */ - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); kfree(proto_array); } else { nf_ct_protos[l4proto->l3proto] = proto_array; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); } /* @@ -232,7 +232,7 @@ retry: nf_ct_protos[l4proto->l3proto][l4proto->l4proto] = l4proto; out_unlock: - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); out: return ret; } @@ -246,16 +246,16 @@ int nf_conntrack_l4proto_unregister(stru goto out; } - write_lock_bh(&nf_conntrack_lock); + spin_lock_bh(&nf_conntrack_lock); if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != l4proto) { - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); ret = -EBUSY; goto out; } nf_ct_protos[l4proto->l3proto][l4proto->l4proto] = &nf_conntrack_l4proto_generic; - write_unlock_bh(&nf_conntrack_lock); + spin_unlock_bh(&nf_conntrack_lock); /* Somebody could be still looking at the proto in bh. */ synchronize_net();