mptcp: Avoid acquiring PM lock for subflow priority changes
authorMat Martineau <mathew.j.martineau@linux.intel.com>
Tue, 5 Jul 2022 21:32:12 +0000 (14:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Jul 2022 11:50:26 +0000 (12:50 +0100)
commitc21b50d5912b68c4414c60ef5b30416c103f9fd8
treed2fce0d2ddd4ba453076c27f9cd9dfc398d15576
parent5ccecaec5c1e85cabfda848c6f146da0d8d55bd6
mptcp: Avoid acquiring PM lock for subflow priority changes

The in-kernel path manager code for changing subflow flags acquired both
the msk socket lock and the PM lock when possibly changing the "backup"
and "fullmesh" flags. mptcp_pm_nl_mp_prio_send_ack() does not access
anything protected by the PM lock, and it must release and reacquire
the PM lock.

By pushing the PM lock to where it is needed in mptcp_pm_nl_fullmesh(),
the lock is only acquired when the fullmesh flag is changed and the
backup flag code no longer has to release and reacquire the PM lock. The
change in locking context requires the MIB update to be modified - move
that to a better location instead.

This change also makes it possible to call
mptcp_pm_nl_mp_prio_send_ack() for the userspace PM commands without
manipulating the in-kernel PM lock.

Fixes: 0f9f696a502e ("mptcp: add set_flags command in PM netlink")
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/options.c
net/mptcp/pm_netlink.c