]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: clean up skb list lock handling on send path
authorJon Maloy <jon.maloy@ericsson.com>
Thu, 15 Aug 2019 14:42:50 +0000 (16:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Aug 2019 21:01:07 +0000 (14:01 -0700)
commit79b20e3ffa76bab8148ceaa6b1c1bcc5c780f476
tree1b3b3af06442bae94101ca20f1c0b6ca06d54e44
parente8e9e36586072c612a6a37a3e1ad2866fed5cdb1
tipc: clean up skb list lock handling on send path

The policy for handling the skb list locks on the send and receive paths
is simple.

- On the send path we never need to grab the lock on the 'xmitq' list
  when the destination is an exernal node.

- On the receive path we always need to grab the lock on the 'inputq'
  list, irrespective of source node.

However, when transmitting node local messages those will eventually
end up on the receive path of a local socket, meaning that the argument
'xmitq' in tipc_node_xmit() will become the 'ínputq' argument in  the
function tipc_sk_rcv(). This has been handled by always initializing
the spinlock of the 'xmitq' list at message creation, just in case it
may end up on the receive path later, and despite knowing that the lock
in most cases never will be used.

This approach is inaccurate and confusing, and has also concealed the
fact that the stated 'no lock grabbing' policy for the send path is
violated in some cases.

We now clean up this by never initializing the lock at message creation,
instead doing this at the moment we find that the message actually will
enter the receive path. At the same time we fix the four locations
where we incorrectly access the spinlock on the send/error path.

This patch also reverts commit afaff801f049 ("tipc: ensure head->lock
is initialised") which has now become redundant.

CC: Eric Dumazet <edumazet@google.com>
Reported-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/bcast.c
net/tipc/group.c
net/tipc/link.c
net/tipc/name_distr.c
net/tipc/node.c
net/tipc/socket.c