mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
[TIPC]: Use tipc_port_unlock
The file net/tipc/port.c takes a lock using the function tipc_port_lock and then releases the lock sometimes using tipc_port_unlock and sometimes using spin_unlock_bh(p_ptr->publ.lock). tipc_port_unlock simply does the spin_unlock_bh, but it seems cleaner to use it everywhere. The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ struct port *p_ptr; @@ p_ptr = tipc_port_lock(...) ... ( p_ptr = tipc_port_lock(...); | ?- spin_unlock_bh(p_ptr->publ.lock); + tipc_port_unlock(p_ptr); ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Jon Paul Maloy <maloy@donjonn.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cdcb006fbe
commit
4cec72c890
1 changed files with 10 additions and 10 deletions
|
@ -340,7 +340,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
|
||||||
if (!p_ptr)
|
if (!p_ptr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
*isunreliable = port_unreliable(p_ptr);
|
*isunreliable = port_unreliable(p_ptr);
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
return TIPC_OK;
|
return TIPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
|
||||||
if (!p_ptr)
|
if (!p_ptr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
*isunrejectable = port_unreturnable(p_ptr);
|
*isunrejectable = port_unreturnable(p_ptr);
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
return TIPC_OK;
|
return TIPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ static void port_dispatcher_sigh(void *dummy)
|
||||||
u32 peer_port = port_peerport(p_ptr);
|
u32 peer_port = port_peerport(p_ptr);
|
||||||
u32 peer_node = port_peernode(p_ptr);
|
u32 peer_node = port_peernode(p_ptr);
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (unlikely(!connected)) {
|
if (unlikely(!connected)) {
|
||||||
if (unlikely(published))
|
if (unlikely(published))
|
||||||
goto reject;
|
goto reject;
|
||||||
|
@ -867,7 +867,7 @@ static void port_dispatcher_sigh(void *dummy)
|
||||||
case TIPC_DIRECT_MSG:{
|
case TIPC_DIRECT_MSG:{
|
||||||
tipc_msg_event cb = up_ptr->msg_cb;
|
tipc_msg_event cb = up_ptr->msg_cb;
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (unlikely(connected))
|
if (unlikely(connected))
|
||||||
goto reject;
|
goto reject;
|
||||||
if (unlikely(!cb))
|
if (unlikely(!cb))
|
||||||
|
@ -882,7 +882,7 @@ static void port_dispatcher_sigh(void *dummy)
|
||||||
case TIPC_NAMED_MSG:{
|
case TIPC_NAMED_MSG:{
|
||||||
tipc_named_msg_event cb = up_ptr->named_msg_cb;
|
tipc_named_msg_event cb = up_ptr->named_msg_cb;
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (unlikely(connected))
|
if (unlikely(connected))
|
||||||
goto reject;
|
goto reject;
|
||||||
if (unlikely(!cb))
|
if (unlikely(!cb))
|
||||||
|
@ -913,7 +913,7 @@ err:
|
||||||
u32 peer_port = port_peerport(p_ptr);
|
u32 peer_port = port_peerport(p_ptr);
|
||||||
u32 peer_node = port_peernode(p_ptr);
|
u32 peer_node = port_peernode(p_ptr);
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (!connected || !cb)
|
if (!connected || !cb)
|
||||||
break;
|
break;
|
||||||
if (msg_origport(msg) != peer_port)
|
if (msg_origport(msg) != peer_port)
|
||||||
|
@ -929,7 +929,7 @@ err:
|
||||||
case TIPC_DIRECT_MSG:{
|
case TIPC_DIRECT_MSG:{
|
||||||
tipc_msg_err_event cb = up_ptr->err_cb;
|
tipc_msg_err_event cb = up_ptr->err_cb;
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (connected || !cb)
|
if (connected || !cb)
|
||||||
break;
|
break;
|
||||||
skb_pull(buf, msg_hdr_sz(msg));
|
skb_pull(buf, msg_hdr_sz(msg));
|
||||||
|
@ -942,7 +942,7 @@ err:
|
||||||
tipc_named_msg_err_event cb =
|
tipc_named_msg_err_event cb =
|
||||||
up_ptr->named_err_cb;
|
up_ptr->named_err_cb;
|
||||||
|
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
if (connected || !cb)
|
if (connected || !cb)
|
||||||
break;
|
break;
|
||||||
dseq.type = msg_nametype(msg);
|
dseq.type = msg_nametype(msg);
|
||||||
|
@ -1107,7 +1107,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance)
|
||||||
if (!p_ptr)
|
if (!p_ptr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
*importance = (unsigned int)msg_importance(&p_ptr->publ.phdr);
|
*importance = (unsigned int)msg_importance(&p_ptr->publ.phdr);
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
return TIPC_OK;
|
return TIPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,7 +1122,7 @@ int tipc_set_portimportance(u32 ref, unsigned int imp)
|
||||||
if (!p_ptr)
|
if (!p_ptr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
msg_set_importance(&p_ptr->publ.phdr, (u32)imp);
|
msg_set_importance(&p_ptr->publ.phdr, (u32)imp);
|
||||||
spin_unlock_bh(p_ptr->publ.lock);
|
tipc_port_unlock(p_ptr);
|
||||||
return TIPC_OK;
|
return TIPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue