[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4990515B.3070409@trash.net>
Date: Mon, 09 Feb 2009 16:52:59 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Eric Dumazet <dada1@...mosbay.com>
CC: Stephen Hemminger <shemminger@...tta.com>,
David Miller <davem@...emloft.net>,
Rick Jones <rick.jones2@...com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
netdev@...r.kernel.org, netfilter-devel@...r.kernel.org
Subject: Re: [RFT 3/3] iptables: lock free counters
Eric Dumazet wrote:
> Stephen Hemminger a écrit :
>> @@ -939,14 +973,30 @@ static struct xt_counters * alloc_counte
>> counters = vmalloc_node(countersize, numa_node_id());
>>
>> if (counters == NULL)
>> - return ERR_PTR(-ENOMEM);
>> + goto nomem;
>> +
>> + tmp = xt_alloc_table_info(private->size);
>> + if (!tmp)
>> + goto free_counters;
>> +
>
>> + xt_zero_table_entries(tmp);
> This is not correct. We must copy rules and zero counters on the copied stuff.
Indeed.
>> static int
>> do_add_counters(struct net *net, void __user *user, unsigned int len, int compat)
>> @@ -1393,13 +1422,14 @@ do_add_counters(struct net *net, void __
>> goto free;
>> }
>>
>> - write_lock_bh(&t->lock);
>> + mutex_lock(&t->lock);
>> private = t->private;
>> if (private->number != num_counters) {
>> ret = -EINVAL;
>> goto unlock_up_free;
>> }
>>
>> + preempt_disable();
>> i = 0;
>> /* Choose the copy that is on our node */
This isn't actually necessary, its merely an optimization. Since this
can take quite a while, it might be nicer not to disable preempt.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists