From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next-2.6] ipv6: no more dev_put() in datagram_send_ctl()
Date: Mon, 2 Nov 2009 14:35:25 -0800 [thread overview]
Message-ID: <20091102223525.GC6795@linux.vnet.ibm.com> (raw)
In-Reply-To: <4AEEC0A2.1070502@gmail.com>
On Mon, Nov 02, 2009 at 12:21:06PM +0100, Eric Dumazet wrote:
> Avoids touching device refcount in datagram_send_ctl(), thanks to RCU
Quite a series of patches!!! I am impressed!!!
Thanx, Paul
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> net/ipv6/datagram.c | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
> index 9f70452..e6f9cdf 100644
> --- a/net/ipv6/datagram.c
> +++ b/net/ipv6/datagram.c
> @@ -537,12 +537,17 @@ int datagram_send_ctl(struct net *net,
>
> addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
>
> + rcu_read_lock();
> if (fl->oif) {
> - dev = dev_get_by_index(net, fl->oif);
> - if (!dev)
> + dev = dev_get_by_index_rcu(net, fl->oif);
> + if (!dev) {
> + rcu_read_unlock();
> return -ENODEV;
> - } else if (addr_type & IPV6_ADDR_LINKLOCAL)
> + }
> + } else if (addr_type & IPV6_ADDR_LINKLOCAL) {
> + rcu_read_unlock();
> return -EINVAL;
> + }
>
> if (addr_type != IPV6_ADDR_ANY) {
> int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
> @@ -553,8 +558,7 @@ int datagram_send_ctl(struct net *net,
> ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr);
> }
>
> - if (dev)
> - dev_put(dev);
> + rcu_read_unlock();
>
> if (err)
> goto exit_f;
> --
> 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
prev parent reply other threads:[~2009-11-02 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 11:21 [PATCH net-next-2.6] ipv6: no more dev_put() in datagram_send_ctl() Eric Dumazet
2009-11-02 11:43 ` David Miller
2009-11-02 22:35 ` Paul E. McKenney [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=20091102223525.GC6795@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.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).