From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Krzysztof Piotr Oledzki <ole@ans.pl>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: add locking for counters zeroing
Date: Wed, 24 Sep 2008 18:11:42 +0200 [thread overview]
Message-ID: <48DA66BE.6090209@trash.net> (raw)
In-Reply-To: <alpine.LNX.1.10.0809241206030.16193@fbirervta.pbzchgretzou.qr>
Jan Engelhardt wrote:
> On Wednesday 2008-09-24 12:01, Patrick McHardy wrote:
>>> @@ -545,6 +545,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct
>>> netlink_callback *cb)
>>> u_int8_t l3proto = nfmsg->nfgen_family;
>>>
>>> rcu_read_lock();
>>> + spin_lock_bh(&nf_conntrack_lock);
>> We only need the spinlock. I'm not so happy about taking it
>> unconditionally even though we might not be zeroing the
>> counters. Moving it in the inner loop will greatly increase
>> the amount of locks/unlocks on the other hand.
>>
>> How about moving the inner loop to a new function and adding
>> back the ctnetlink_dump_counterzero (or whatever it was called)
>> function? It would take the spinlock, while normal dumping
>> would only use rcu_read_lock().
>
> Perhaps this might work?
>
> + if (cb->args[0] >= nf_conntrack_htable_size) {
> + nf_ct_put(cb->args[1]);
> + return skb->len;
> + }
I'm not sure what you're trying to fix here. Its a race
between counter zeroing and changing them during packet
processing. Any patch that doesn't include a spin_lock
can't really fix the problem :)
next prev parent reply other threads:[~2008-09-24 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 16:46 [PATCH] netfilter: add locking for counters zeroing Krzysztof Piotr Oledzki
2008-09-24 16:01 ` Patrick McHardy
2008-09-24 16:08 ` Jan Engelhardt
2008-09-24 16:11 ` Patrick McHardy [this message]
2008-09-24 16:27 ` Jan Engelhardt
2008-09-24 16:42 ` Patrick McHardy
2008-09-24 16:57 ` Patrick McHardy
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=48DA66BE.6090209@trash.net \
--to=kaber@trash.net \
--cc=jengelh@medozas.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=ole@ans.pl \
/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