Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1322346 > unrolled thread
| Started by | Weidong Wang <wangweidong1@huawei.com> |
|---|---|
| First post | 2016-01-30 13:30 +0100 |
| Last post | 2016-02-01 17:50 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket Weidong Wang <wangweidong1@huawei.com> - 2016-01-30 13:30 +0100
Re: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket Florian Westphal <fw@strlen.de> - 2016-01-30 22:40 +0100
Re: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket Weidong Wang <wangweidong1@huawei.com> - 2016-01-31 04:40 +0100
RE: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket David Laight <David.Laight@ACULAB.COM> - 2016-02-01 17:50 +0100
| From | Weidong Wang <wangweidong1@huawei.com> |
|---|---|
| Date | 2016-01-30 13:30 +0100 |
| Subject | [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket |
| Message-ID | <qWCP8-2Cc-7@gated-at.bofh.it> |
In the 'for(...) {}', the *bucket alwasy < net->ct.htable_size,
so remove the check
Signed-off-by: Weidong Wang <wangweidong1@huawei.com>
---
net/netfilter/nf_conntrack_core.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 3cb3cb8..cd7d5c8 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1383,14 +1383,12 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS];
local_bh_disable();
spin_lock(lockp);
- if (*bucket < net->ct.htable_size) {
- hlist_nulls_for_each_entry(h, n, &net->ct.hash[*bucket], hnnode) {
- if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
- continue;
- ct = nf_ct_tuplehash_to_ctrack(h);
- if (iter(ct, data))
- goto found;
- }
+ hlist_nulls_for_each_entry(h, n, &net->ct.hash[*bucket], hnnode) {
+ if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
+ continue;
+ ct = nf_ct_tuplehash_to_ctrack(h);
+ if (iter(ct, data))
+ goto found;
}
spin_unlock(lockp);
local_bh_enable();
--
2.7.0
[toc] | [next] | [standalone]
| From | Florian Westphal <fw@strlen.de> |
|---|---|
| Date | 2016-01-30 22:40 +0100 |
| Subject | Re: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket |
| Message-ID | <qWLpo-1sy-11@gated-at.bofh.it> |
| In reply to | #1322346 |
Weidong Wang <wangweidong1@huawei.com> wrote:
> In the 'for(...) {}', the *bucket alwasy < net->ct.htable_size,
> so remove the check
> @@ -1383,14 +1383,12 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
> lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS];
> local_bh_disable();
> spin_lock(lockp);
> - if (*bucket < net->ct.htable_size) {
AFAIU net->ct.htable_size can shrink between for-test and aquiring
the bucket lockp, so this additional if-test is needed.
[toc] | [prev] | [next] | [standalone]
| From | Weidong Wang <wangweidong1@huawei.com> |
|---|---|
| Date | 2016-01-31 04:40 +0100 |
| Message-ID | <qWR1L-5Ji-3@gated-at.bofh.it> |
| In reply to | #1322516 |
On 2016/1/31 5:30, Florian Westphal wrote:
> Weidong Wang <wangweidong1@huawei.com> wrote:
>> In the 'for(...) {}', the *bucket alwasy < net->ct.htable_size,
>> so remove the check
>> @@ -1383,14 +1383,12 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
>> lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS];
>> local_bh_disable();
>> spin_lock(lockp);
>> - if (*bucket < net->ct.htable_size) {
>
> AFAIU net->ct.htable_size can shrink between for-test and aquiring
> the bucket lockp, so this additional if-test is needed.
>
ok, Got it.
So ignore this patch.
Regards,
Weidong
> .
>
[toc] | [prev] | [next] | [standalone]
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Date | 2016-02-01 17:50 +0100 |
| Subject | RE: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket |
| Message-ID | <qXpPQ-5F8-9@gated-at.bofh.it> |
| In reply to | #1322516 |
From: Florian Westphal
> Sent: 30 January 2016 21:30
> Weidong Wang <wangweidong1@huawei.com> wrote:
> > In the 'for(...) {}', the *bucket alwasy < net->ct.htable_size,
> > so remove the check
> > @@ -1383,14 +1383,12 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
> > lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS];
> > local_bh_disable();
> > spin_lock(lockp);
> > - if (*bucket < net->ct.htable_size) {
>
> AFAIU net->ct.htable_size can shrink between for-test and aquiring
> the bucket lockp, so this additional if-test is needed.
If the table can shrink, can it not also grow - in which case
the references bucket will be incorrect?
David
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web