netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next v2 3/3] igmp: convert RTNL lock to a spinlock
Date: Thu, 06 Jun 2013 08:36:03 +0800	[thread overview]
Message-ID: <1370478963.31875.2.camel@cr0> (raw)
In-Reply-To: <1370425101-31683-3-git-send-email-amwang@redhat.com>

On Wed, 2013-06-05 at 17:38 +0800, Cong Wang wrote:
> -       while ((i = rtnl_dereference(in_dev->mc_list)) != NULL) {
> -               in_dev->mc_list = i->next_rcu;
> +       spin_lock(&ipv4_sk_mc_lock);
> +       while ((i = rcu_dereference_protected(in_dev->mc_list,
> +                       lockdep_is_held(&ipv4_sk_mc_lock))) != NULL) {
> +               rcu_assign_pointer(in_dev->mc_list, i->next_rcu);
>                 in_dev->mc_count--;
>  
>                 /* We've dropped the groups in ip_mc_down already */
>                 ip_mc_clear_src(i);
>                 ip_ma_put(i);
>         }
> +       spin_unlock(&ipv4_sk_mc_lock);
> +       synchronize_rcu(); 

Hmm, it seems this kind synchronize_rcu() is not needed, since we don't
free anything here, not very sure if it is okay that readers still have
the old value of ->mc_list... I think probably yes.

      reply	other threads:[~2013-06-06  0:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  9:38 [Patch net-next v2 1/3] igmp: fix return values of some functions Cong Wang
2013-06-05  9:38 ` [Patch net-next v2 2/3] ipv6,mcast: " Cong Wang
2013-06-05  9:38 ` [Patch net-next v2 3/3] igmp: convert RTNL lock to a spinlock Cong Wang
2013-06-06  0:36   ` Cong Wang [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=1370478963.31875.2.camel@cr0 \
    --to=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).