Commit cf2ce339 authored by Taehee Yoo's avatar Taehee Yoo Committed by David S. Miller

mld: get rid of inet6_dev->mc_lock

The purpose of mc_lock is to protect inet6_dev->mc_tomb.
But mc_tomb is already protected by RTNL and all functions,
which manipulate mc_tomb are called under RTNL.
So, mc_lock is not needed.
Furthermore, it is spinlock so the critical section is atomic.
In order to reduce atomic context, it should be removed.
Suggested-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d9a93b4
...@@ -167,7 +167,6 @@ struct inet6_dev { ...@@ -167,7 +167,6 @@ struct inet6_dev {
struct ifmcaddr6 *mc_list; struct ifmcaddr6 *mc_list;
struct ifmcaddr6 *mc_tomb; struct ifmcaddr6 *mc_tomb;
spinlock_t mc_lock;
unsigned char mc_qrv; /* Query Robustness Variable */ unsigned char mc_qrv; /* Query Robustness Variable */
unsigned char mc_gq_running; unsigned char mc_gq_running;
......
...@@ -752,10 +752,8 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) ...@@ -752,10 +752,8 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
} }
spin_unlock_bh(&im->mca_lock); spin_unlock_bh(&im->mca_lock);
spin_lock_bh(&idev->mc_lock);
pmc->next = idev->mc_tomb; pmc->next = idev->mc_tomb;
idev->mc_tomb = pmc; idev->mc_tomb = pmc;
spin_unlock_bh(&idev->mc_lock);
} }
static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
...@@ -764,7 +762,6 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) ...@@ -764,7 +762,6 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
struct ip6_sf_list *psf; struct ip6_sf_list *psf;
struct in6_addr *pmca = &im->mca_addr; struct in6_addr *pmca = &im->mca_addr;
spin_lock_bh(&idev->mc_lock);
pmc_prev = NULL; pmc_prev = NULL;
for (pmc = idev->mc_tomb; pmc; pmc = pmc->next) { for (pmc = idev->mc_tomb; pmc; pmc = pmc->next) {
if (ipv6_addr_equal(&pmc->mca_addr, pmca)) if (ipv6_addr_equal(&pmc->mca_addr, pmca))
...@@ -777,7 +774,6 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) ...@@ -777,7 +774,6 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
else else
idev->mc_tomb = pmc->next; idev->mc_tomb = pmc->next;
} }
spin_unlock_bh(&idev->mc_lock);
spin_lock_bh(&im->mca_lock); spin_lock_bh(&im->mca_lock);
if (pmc) { if (pmc) {
...@@ -801,10 +797,8 @@ static void mld_clear_delrec(struct inet6_dev *idev) ...@@ -801,10 +797,8 @@ static void mld_clear_delrec(struct inet6_dev *idev)
{ {
struct ifmcaddr6 *pmc, *nextpmc; struct ifmcaddr6 *pmc, *nextpmc;
spin_lock_bh(&idev->mc_lock);
pmc = idev->mc_tomb; pmc = idev->mc_tomb;
idev->mc_tomb = NULL; idev->mc_tomb = NULL;
spin_unlock_bh(&idev->mc_lock);
for (; pmc; pmc = nextpmc) { for (; pmc; pmc = nextpmc) {
nextpmc = pmc->next; nextpmc = pmc->next;
...@@ -1907,7 +1901,6 @@ static void mld_send_cr(struct inet6_dev *idev) ...@@ -1907,7 +1901,6 @@ static void mld_send_cr(struct inet6_dev *idev)
int type, dtype; int type, dtype;
read_lock_bh(&idev->lock); read_lock_bh(&idev->lock);
spin_lock(&idev->mc_lock);
/* deleted MCA's */ /* deleted MCA's */
pmc_prev = NULL; pmc_prev = NULL;
...@@ -1941,7 +1934,6 @@ static void mld_send_cr(struct inet6_dev *idev) ...@@ -1941,7 +1934,6 @@ static void mld_send_cr(struct inet6_dev *idev)
} else } else
pmc_prev = pmc; pmc_prev = pmc;
} }
spin_unlock(&idev->mc_lock);
/* change recs */ /* change recs */
for (pmc = idev->mc_list; pmc; pmc = pmc->next) { for (pmc = idev->mc_list; pmc; pmc = pmc->next) {
...@@ -2582,7 +2574,6 @@ void ipv6_mc_up(struct inet6_dev *idev) ...@@ -2582,7 +2574,6 @@ void ipv6_mc_up(struct inet6_dev *idev)
void ipv6_mc_init_dev(struct inet6_dev *idev) void ipv6_mc_init_dev(struct inet6_dev *idev)
{ {
write_lock_bh(&idev->lock); write_lock_bh(&idev->lock);
spin_lock_init(&idev->mc_lock);
idev->mc_gq_running = 0; idev->mc_gq_running = 0;
INIT_DELAYED_WORK(&idev->mc_gq_work, mld_gq_work); INIT_DELAYED_WORK(&idev->mc_gq_work, mld_gq_work);
idev->mc_tomb = NULL; idev->mc_tomb = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment