netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Jamal Hadi Salim <hadi@cyberus.ca>,
	netdev@vger.kernel.org
Subject: Re: [PATCH][NET_SCHED] cls_u32: refcounting fix for u32_delete()
Date: Fri, 11 Apr 2008 15:22:51 +0200	[thread overview]
Message-ID: <47FF662B.2040302@trash.net> (raw)
In-Reply-To: <20080411132304.GB2701@ff.dom.local>

Jarek Poplawski wrote:
> On Fri, Apr 11, 2008 at 02:55:27PM +0200, Patrick McHardy wrote:
>> Jarek Poplawski wrote:
>>> [NET_SCHED] cls_u32: refcounting fix for u32_delete()
>>>
>>> @@ -441,8 +443,10 @@ static int u32_delete(struct tcf_proto *tp, unsigned long arg)
>>>  	if (tp->root == ht)
>>>  		return -EINVAL;
>>>  -	if (--ht->refcnt == 0)
>>> +	if (ht->refcnt == 1) {
>>> +		ht->refcnt--;
>>>  		u32_destroy_hnode(tp, ht);
>>> +	}
>>>  
>> Shouldn't the refcount be decremented unconditionally?
>> Otherwise I'd suggest to reject the removal if refcnt > 1,
>> but silently doing nothing doesn't seem right.
> 
> If someone tries deleting and the refcnt is e.g. 3 (2 links)
> unconditional deleting could decrease refcnt without deleting
> and then unlinking would make it below 0. I think it's OK now:
> we can't delete hnode until it's referenced, but I could add
> a warning if you like?


I'd suggest to behave similar to qdiscs when trying to
removing classes that are still referenced, return -EBUSY.

  reply	other threads:[~2008-04-11 13:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 12:45 [PATCH][NET_SCHED] cls_u32: refcounting fix for u32_delete() Jarek Poplawski
2008-04-11 12:55 ` Patrick McHardy
2008-04-11 13:23   ` Jarek Poplawski
2008-04-11 13:22     ` Patrick McHardy [this message]
2008-04-11 13:48       ` [PATCH take2][NET_SCHED] " Jarek Poplawski
2008-04-11 13:55         ` jamal
2008-04-13  1:37           ` David Miller
2008-04-11 14:00         ` 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=47FF662B.2040302@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).