All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira <pablo@eurodev.net>
To: Harald Welte <laforge@netfilter.org>
Cc: netfilter-devel@lists.netfilter.org,
	Patrick McHardy <kaber@trash.net>,
	Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>
Subject: Re: Question about reference count of expectations in 2.6.14 tree
Date: Fri, 12 Aug 2005 03:19:02 +0200	[thread overview]
Message-ID: <42FBF906.50906@eurodev.net> (raw)
In-Reply-To: <20050811192050.GH5353@rama.de.gnumonks.org>

Harald Welte wrote:
> On Thu, Aug 11, 2005 at 04:40:32PM +0200, Patrick McHardy wrote:
> 
> 
>>>I think it would be possible to remove the second atomic_inc() and all
>>>the ip_conntrack_put() that immediately follow ulink_expect() - but
>>>would it be worth the effort?  Isn't it an over-optimization that is
>>>likely to cause bugs later on?
>>
>>There is one spot where it isn't possible, in find_expectation
>>the timer reference isn't dropped but returned to the caller.
>>Changing it would either require a special version of unlink_expect
>>or an additional atomic_inc in this function. I don't think its
>>worth the trouble, we do take two references so this seems the
>>cleanest way to me.
> 
> I think I'll add some comment to the code explaining why we need to get
> two references.  

Sure, Yasuyuki and I have asked the same thing in a very short time. So 
this probably will help others.

BTW, I'm still willing to post two patches related with this stuff:

a) kill __ip_ct_expect_unlink_destroy. As Patrick pointed out, it's kind 
of confusing. Actually the only user is conntrack_netlink. So we can 
just export unlink_expect and use it calling ip_conntrack_expect_put 
(already exported).

b) don't increase master conntrack refcount for non-confirmed 
conntracks. It could deadlock. If expectations are killed before the 
master conntrack, we call ip_conntrack_put holding ip_conntrack_lock as 
Yasuyuki described. Actually such thing shouldn't ever happen because 
non-fulfilled(confirmed) expectations are always killed first. Hm, but 
it still looks to me a bit ugly. So I'm proposing to increase the master 
conntrack refcount just once the expectation is fulfilled.

--
Pablo

  reply	other threads:[~2005-08-12  1:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200508100111.j7A1Bok9010084@toshiba.co.jp>
2005-08-11 13:35 ` Question about reference count of expectations in 2.6.14 tree Harald Welte
2005-08-11 13:51   ` Harald Welte
2005-08-11 14:40     ` Patrick McHardy
2005-08-11 19:20       ` Harald Welte
2005-08-12  1:19         ` Pablo Neira [this message]
2005-08-12  1:19         ` Yasuyuki KOZAKAI
2005-08-10  1:11 Yasuyuki KOZAKAI
  -- strict thread matches above, loose matches on Subject: below --
2005-08-09 10:45 Yasuyuki KOZAKAI

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=42FBF906.50906@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=kaber@trash.net \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=yasuyuki.kozakai@toshiba.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.