Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>,
	serge.hallyn@canonical.com, ebiederm@xmission.com,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	netdev@vger.kernel.org, containers@lists.linux-foundation.org
Subject: Re: [PATCH net-next v2 1/2] inetpeer: add namespace support for inetpeer
Date: Tue, 05 Jun 2012 14:00:30 +0200	[thread overview]
Message-ID: <1338897630.2760.2433.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120605112728.GB27795@secunet.com>

On Tue, 2012-06-05 at 13:27 +0200, Steffen Klassert wrote:

> > 
> > By the way, I think we have a bug in inetpeer_gc_worker()
> > 
> > Steffen ?
> > 
> > We have no rcu grace period to make sure the following is safe :
> > 
> > if (!atomic_read(&p->refcnt)) {
> > 	list_del(&p->gc_list);
> > 	kmem_cache_free(peer_cachep, p);
> > }
> 
> I think this is ok as it is. inetpeer_invalidate_tree()
> unlinks the whole inetpeer tree from the inetpeer base and
> adds it to a gc_list. These intetpeer entries are stale,
> they can't be looked up again. So noone should increment the
> refcount, they just wait until the refcount get zero.
> 

Its not OK, lookups are done under rcu.

Since there is no RCU grace period, the worker free the entries while
another cpus are doing their lookups.

Alternative would be to wait a RCU grace period before feeding them to
worker.

  reply	other threads:[~2012-06-05 12:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05  7:52 [PATCH net-next v2 1/2] inetpeer: add namespace support for inetpeer Gao feng
     [not found] ` <1338882737-11914-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-06-05  7:52   ` [PATCH net-next v2 2/2] inetpeer: add parameter net for inet_getpeer_v4, v6 Gao feng
2012-06-05  8:57 ` [PATCH net-next v2 1/2] inetpeer: add namespace support for inetpeer Eric Dumazet
2012-06-05 11:27   ` Steffen Klassert
2012-06-05 12:00     ` Eric Dumazet [this message]
2012-06-05 12:15       ` Steffen Klassert
     [not found]         ` <20120605121510.GD27795-opNxpl+3fjRBDgjK7y7TUQ@public.gmane.org>
2012-06-05 12:18           ` Eric Dumazet
2012-06-05 12:29   ` Gao feng
2012-06-06 17:43 ` David Miller
     [not found]   ` <20120606.104323.1698446129331745479.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-06-07 21:43     ` David Miller
     [not found]       ` <20120607.144301.1259354794384347085.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-06-08  1:44         ` Gao feng
2012-06-08  3:53           ` David Miller
     [not found]             ` <20120607.205348.913373847915721607.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-06-08  5:27               ` Gao feng

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=1338897630.2760.2433.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=steffen.klassert@secunet.com \
    /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