From: Eric Dumazet <eric.dumazet@gmail.com>
To: roy.qing.li@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] ipv6: replace write lock with read lock when get route info
Date: Wed, 12 Sep 2012 09:45:07 +0200 [thread overview]
Message-ID: <1347435907.13103.693.camel@edumazet-glaptop> (raw)
In-Reply-To: <1347427553-17781-1-git-send-email-roy.qing.li@gmail.com>
On Wed, 2012-09-12 at 13:25 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> geting route info does not write rt->rt6i_table, so replace
> write lock with read lock
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
> net/ipv6/route.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 399613b..8be1d86 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
> if (!table)
> return NULL;
>
> - write_lock_bh(&table->tb6_lock);
> + read_lock_bh(&table->tb6_lock);
> fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0);
> if (!fn)
> goto out;
> @@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
> break;
> }
> out:
> - write_unlock_bh(&table->tb6_lock);
> + read_unlock_bh(&table->tb6_lock);
> return rt;
> }
>
> @@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
> if (!table)
> return NULL;
>
> - write_lock_bh(&table->tb6_lock);
> + read_lock_bh(&table->tb6_lock);
> for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) {
> if (dev == rt->dst.dev &&
> ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
> @@ -1905,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
> }
> if (rt)
> dst_hold(&rt->dst);
> - write_unlock_bh(&table->tb6_lock);
> + read_unlock_bh(&table->tb6_lock);
> return rt;
> }
>
Why dont you also change addrconf_get_prefix_route() ?
next prev parent reply other threads:[~2012-09-12 7:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 5:25 [PATCH] ipv6: replace write lock with read lock when get route info roy.qing.li
2012-09-12 7:45 ` Eric Dumazet [this message]
2012-09-12 7:49 ` RongQing Li
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=1347435907.13103.693.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=roy.qing.li@gmail.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