From: David Miller <davem@davemloft.net>
To: ebiederm@xmission.com
Cc: den@openvz.org, devel@openvz.org, netdev@vger.kernel.org,
containers@lists.osdl.org
Subject: Re: [PATCH] various dst_ifdown routines to catch refcounting bugs
Date: Thu, 27 Sep 2007 12:44:38 -0700 (PDT) [thread overview]
Message-ID: <20070927.124438.56162804.davem@davemloft.net> (raw)
In-Reply-To: <m1myv8kr9c.fsf@ebiederm.dsl.xmission.com>
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Thu, 27 Sep 2007 10:27:43 -0600
> "Denis V. Lunev" <den@openvz.org> writes:
>
> > Moving dst entries into init_net.loopback_dev is not a good thing.
> > This hides obvious and non-obvious ref-counting bugs.
>
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Patch applied.
> I do have a question I would like to bring up, because I like avoiding
> explicit references to loopback_dev when I can.
>
> /* Dirty hack. We did it in 2.2 (in __dst_free),
> * we have _very_ good reasons not to repeat
> * this mistake in 2.3, but we have no choice
> * now. _It_ _is_ _explicit_ _deliberate_
> * _race_ _condition_.
> *
> * Commented and originally written by Alexey.
> */
>
> What is the race that is talked about in that comment. Can we just
> assign NULL instead of the loopback device when we bring a route down.
> My gut feeling is that something like:
> dst->input = dst->output = dst_discard;
> may be enough. But I don't know where the deliberate race is.
The packet output path accesses the cached route device
asynchronously, and we are resetting the device to be loopback without
any synchronization whatsoever. None is in fact possible, and we
don't want to add it because that would be way too expensive.
So another thread on the system can either see the original device or
the loopback one.
It all works out because as the device goes down we'll purge any
packets queued into the transmit queue and packet scheduler for that
device.
prev parent reply other threads:[~2007-09-27 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-27 13:47 [PATCH] various dst_ifdown routines to catch refcounting bugs Denis V. Lunev
2007-09-27 16:27 ` Eric W. Biederman
2007-09-27 19:44 ` David Miller [this message]
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=20070927.124438.56162804.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=containers@lists.osdl.org \
--cc=den@openvz.org \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.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).