Skip to content

Commit 598411d

Browse files
Jon Paul Maloydavem330
authored andcommitted
tipc: make resetting of links non-atomic
In order to facilitate future improvements to the locking structure, we want to make resetting and establishing of links non-atomic. I.e., the functions tipc_node_link_up() and tipc_node_link_down() should be called from outside the node lock context, and grab/release the node lock themselves. This requires that we can freeze the link state from the moment it is set to RESETTING or PEER_RESET in one lock context until it is set to RESET or ESTABLISHING in a later context. The recently introduced link FSM makes this possible, so we are now ready to introduce the above change. This commit implements this. Tested-by: Ying Xue <[email protected]> Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cf14881 commit 598411d

File tree

3 files changed

+127
-70
lines changed

3 files changed

+127
-70
lines changed

net/tipc/link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq)
489489
xmit = true;
490490
mtyp = ACTIVATE_MSG;
491491
break;
492-
case LINK_RESETTING:
493492
case LINK_PEER_RESET:
493+
case LINK_RESETTING:
494494
case LINK_FAILINGOVER:
495495
break;
496496
default:

net/tipc/msg.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,4 +916,33 @@ static inline bool __tipc_skb_queue_sorted(struct sk_buff_head *list,
916916
return false;
917917
}
918918

919+
/* tipc_skb_queue_splice_tail - append an skb list to lock protected list
920+
* @list: the new list to append. Not lock protected
921+
* @head: target list. Lock protected.
922+
*/
923+
static inline void tipc_skb_queue_splice_tail(struct sk_buff_head *list,
924+
struct sk_buff_head *head)
925+
{
926+
spin_lock_bh(&head->lock);
927+
skb_queue_splice_tail(list, head);
928+
spin_unlock_bh(&head->lock);
929+
}
930+
931+
/* tipc_skb_queue_splice_tail_init - merge two lock protected skb lists
932+
* @list: the new list to add. Lock protected. Will be reinitialized
933+
* @head: target list. Lock protected.
934+
*/
935+
static inline void tipc_skb_queue_splice_tail_init(struct sk_buff_head *list,
936+
struct sk_buff_head *head)
937+
{
938+
struct sk_buff_head tmp;
939+
940+
__skb_queue_head_init(&tmp);
941+
942+
spin_lock_bh(&list->lock);
943+
skb_queue_splice_tail_init(list, &tmp);
944+
spin_unlock_bh(&list->lock);
945+
tipc_skb_queue_splice_tail(&tmp, head);
946+
}
947+
919948
#endif

0 commit comments

Comments
 (0)