netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 3/3] nfnetlink_queue: use hash table to speed up entry finding.
Date: Fri, 16 Apr 2010 17:30:26 +0200	[thread overview]
Message-ID: <4BC88292.1090203@trash.net> (raw)
In-Reply-To: <q2z412e6f7f1004160650vf55ed233n69d332c62593ceb8@mail.gmail.com>

Changli Gao wrote:
> On Thu, Apr 15, 2010 at 11:35 PM, Patrick McHardy <kaber@trash.net> wrote:
>> Changli Gao wrote:
>>> static int
>>> nfqnl_rcv_nl_event(struct notifier_block *this,
>>>                    unsigned long event, void *ptr)
>>> {
>>>         struct netlink_notify *n = ptr;
>>>
>>>         if (event == NETLINK_URELEASE && n->protocol == NETLINK_NETFILTER) {
>>>                 int i;
>>>
>>>                 /* destroy all instances for this pid */
>>>                 spin_lock(&instances_lock);
>>>                 for (i = 0; i < INSTANCE_BUCKETS; i++) {
>>>                         struct hlist_node *tmp, *t2;
>>>                         struct nfqnl_instance *inst;
>>>                         struct hlist_head *head = &instance_table[i];
>>>
>>>                         hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
>>>                                 if ((n->net == &init_net) &&
>>>                                     (n->pid == inst->peer_pid))
>>>                                         __instance_destroy(inst);
>>>                         }
>>>                 }
>>>                 spin_unlock(&instances_lock);
>>>         }
>>>         return NOTIFY_DONE;
>>> }
>>>
>>> static struct notifier_block nfqnl_rtnl_notifier = {
>>>         .notifier_call  = nfqnl_rcv_nl_event,
>>> };
>>>
>> Ah, right. So call nfnl_lock() or convert the spinlock to a
>> mutex.
>>
> 
> We can't convert the spinlock to a mutex simply. The notifier chain is
> an atomic notifier chain.

Well, then use reference counting, redo the lookup, or whatever.
Really, this isn't that hard.

      reply	other threads:[~2010-04-16 15:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09  4:13 [PATCH 3/3] nfnetlink_queue: use hash table to speed up entry finding Changli Gao
2010-04-09  4:50 ` Eric Dumazet
2010-04-13 10:09 ` Patrick McHardy
2010-04-13 11:06   ` Changli Gao
2010-04-13 12:44     ` Eric Dumazet
2010-04-13 13:02       ` Changli Gao
2010-04-13 13:09       ` Changli Gao
2010-04-13 13:23         ` Eric Dumazet
2010-04-13 13:25           ` Patrick McHardy
2010-04-15  6:53             ` Changli Gao
2010-04-15  8:23               ` Eric Dumazet
2010-04-15  8:30                 ` Changli Gao
2010-04-15 10:36               ` Patrick McHardy
2010-04-15 14:35                 ` Changli Gao
2010-04-15 14:40                   ` Patrick McHardy
2010-04-15 14:46                     ` Patrick McHardy
2010-04-15 15:01                       ` Changli Gao
2010-04-15 15:05                         ` Patrick McHardy
2010-04-15 15:11                           ` Changli Gao
2010-04-15 15:35                             ` Patrick McHardy
2010-04-16 13:50                               ` Changli Gao
2010-04-16 15:30                                 ` Patrick McHardy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BC88292.1090203@trash.net \
    --to=kaber@trash.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=xiaosuo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).