[NetLabel]: correct usage of RCU locking
This fixes some awkward, and perhaps even problematic, RCU lock usage in the NetLabel code as well as some other related trivial cleanups found when looking through the RCU locking. Most of the changes involve removing the redundant RCU read locks wrapping spinlocks in the case of a RCU writer. Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
此提交包含在:
@@ -85,11 +85,9 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
|
||||
*/
|
||||
void netlbl_mgmt_protocount_inc(void)
|
||||
{
|
||||
rcu_read_lock();
|
||||
spin_lock(&netlabel_mgmt_protocount_lock);
|
||||
netlabel_mgmt_protocount++;
|
||||
spin_unlock(&netlabel_mgmt_protocount_lock);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,12 +101,10 @@ void netlbl_mgmt_protocount_inc(void)
|
||||
*/
|
||||
void netlbl_mgmt_protocount_dec(void)
|
||||
{
|
||||
rcu_read_lock();
|
||||
spin_lock(&netlabel_mgmt_protocount_lock);
|
||||
if (netlabel_mgmt_protocount > 0)
|
||||
netlabel_mgmt_protocount--;
|
||||
spin_unlock(&netlabel_mgmt_protocount_lock);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
新增問題並參考
封鎖使用者