From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
daniel.lezcano@free.fr, ebiederm@xmission.com,
hans.schillstrom@ericsson.com, netdev@vger.kernel.org
Subject: Re: BUG ? ipip unregister_netdevice_many()
Date: Thu, 14 Oct 2010 16:28:04 -0700 [thread overview]
Message-ID: <20101014232804.GI2447@linux.vnet.ibm.com> (raw)
In-Reply-To: <1287028631.2649.100.camel@edumazet-laptop>
On Thu, Oct 14, 2010 at 05:57:11AM +0200, Eric Dumazet wrote:
> Le mercredi 13 octobre 2010 à 16:23 -0700, David Miller a écrit :
> > From: Daniel Lezcano <daniel.lezcano@free.fr>
[ . . . ]
> > for (i = 0; i <= rt_hash_mask; i++) {
> > + struct rtable *list = NULL, **pprev;
> > +
> > if (process_context && need_resched())
> > cond_resched();
> > rth = rt_hash_table[i].chain;
> > @@ -726,41 +727,27 @@ static void rt_do_flush(int process_context)
> > continue;
> >
> > spin_lock_bh(rt_hash_lock_addr(i));
> > -#ifdef CONFIG_NET_NS
> > - {
> > - struct rtable ** prev, * p;
> >
> > - rth = rt_hash_table[i].chain;
> > + pprev = &rt_hash_table[i].chain;
> > + rth = *pprev;
> > + while (rth) {
> > + next = rth->dst.rt_next;
> > + if (dev_net(rth->dst.dev) == net) {
>
> if (net_eq(dev_net(rth->dst.dev), net)) {
>
>
> > + *pprev = next;
> >
> > - /* defer releasing the head of the list after spin_unlock */
> > - for (tail = rth; tail; tail = tail->dst.rt_next)
> > - if (!rt_is_expired(tail))
> > - break;
> > - if (rth != tail)
> > - rt_hash_table[i].chain = tail;
> > -
> > - /* call rt_free on entries after the tail requiring flush */
> > - prev = &rt_hash_table[i].chain;
> > - for (p = *prev; p; p = next) {
> > - next = p->dst.rt_next;
> > - if (!rt_is_expired(p)) {
> > - prev = &p->dst.rt_next;
> > - } else {
> > - *prev = next;
> > - rt_free(p);
> > - }
> > - }
> > + rth->dst.rt_next = list;
> > + list = rth;
>
> I was wondering about RCU rules here.
> We change pointers while a reader might enter in a loop.
> It seems fine : At soon as we spin_unlock(), the loop should be closed.
I don't see where the structure pointed to by list came from, but
especially if it is newly allocated, we do need an rcu_assign_pointer().
Thanx, Paul
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> minor coding style : You should add a brace in the else clause :
>
> pprev = &rt_hash_table[i].chain;
> for (rth = *pprev; rth != NULL; rth = next) {
> next = rth->dst.rt_next;
> if (net_eq(dev_net(rth->dst.dev), net)) {
> *pprev = next;
> rth->dst.rt_next = list;
> list = rth;
> } else {
> pprev = &rth->dst.rt_next;
> }
> }
>
> Thanks !
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-10-14 23:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 8:48 BUG ? ipip unregister_netdevice_many() Hans Schillstrom
2010-10-08 11:19 ` Daniel Lezcano
2010-10-08 11:53 ` Hans Schillstrom
2010-10-08 12:28 ` Hans Schillstrom
2010-10-08 15:53 ` Daniel Lezcano
2010-10-08 16:17 ` Daniel Lezcano
2010-10-08 16:58 ` Eric W. Biederman
2010-10-08 17:29 ` Daniel Lezcano
2010-10-08 17:47 ` Daniel Lezcano
2010-10-08 16:45 ` Eric W. Biederman
2010-10-08 17:20 ` David Miller
2010-10-08 17:32 ` Eric W. Biederman
2010-10-12 20:05 ` David Miller
2010-10-13 11:19 ` Jarek Poplawski
2010-10-13 21:58 ` David Miller
2010-10-14 6:41 ` Hans Schillstrom
2010-10-13 22:16 ` Daniel Lezcano
2010-10-13 23:23 ` David Miller
2010-10-14 3:57 ` Eric Dumazet
2010-10-14 23:28 ` Paul E. McKenney [this message]
2010-10-14 4:40 ` Eric W. Biederman
2010-10-14 4:50 ` David Miller
2010-10-14 5:20 ` Eric W. Biederman
2010-10-14 15:09 ` David Miller
2010-10-14 18:35 ` Eric W. Biederman
2010-10-08 16:51 ` Eric W. Biederman
2010-10-08 16:06 ` Eric W. Biederman
-- strict thread matches above, loose matches on Subject: below --
2010-10-14 19:21 Octavian Purdila
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=20101014232804.GI2447@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=daniel.lezcano@free.fr \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=eric.dumazet@gmail.com \
--cc=hans.schillstrom@ericsson.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).