From: Geliang Tang <tanggeliang@kylinos.cn>
The mptcp_nvme.sh selftest reports lockdep "possible recursive locking"
warnings when running NVMe over MPTCP. The issue occurs because MPTCP
sockets and their subflows share the same k-sk_lock-AF_INET lockdep class,
causing lockdep to flag false warnings in paths that hold the MPTCP socket
lock and then lock a subflow (setsockopt, connect, bind, worker send-ack).
This series fixes the issue by giving MPTCP sockets their own distinct
lockdep class (sk_lock-AF_INET-MPTCP for IPv4, sk_lock-AF_INET6-MPTCP for
IPv6), similar to how nvme-tcp handles it. This approach is more efficient
than reclassifying each subflow individually, properly supports IPv6, and
follows existing kernel patterns.
A KUnit test is included to verify the fix works correctly.
v2:
- Move reclassification to __mptcp_init_sock() to cover cloned sockets,
as Matt suggested
- Extract mptcp_reclassify_socket() helper for reuse in PM listener socket
creation
- Remove #ifdef CONFIG_DEBUG_LOCK_ALLOC wrapper as suggested by Matt
- Update lock class names to msk_lock-AF_INET/msk_lock-AF_INET6
- Note: checkpatch.pl warns about line length > 80 columns in pm_kernel.c,
but kept for consistency with existing code style
v1:
- https://patchwork.kernel.org/project/mptcp/cover/cover.1792060837.git.tanggeliang@kylinos.cn/
Geliang Tang (2):
mptcp: give MPTCP sockets a distinct lockdep class
mptcp: kunit: add sockopt test for subflow socket locking
net/mptcp/Makefile | 4 +++-
net/mptcp/pm_kernel.c | 18 ++++++++++++------
net/mptcp/protocol.c | 3 +++
net/mptcp/protocol.h | 2 ++
net/mptcp/sockopt_test.c | 37 +++++++++++++++++++++++++++++++++++++
5 files changed, 57 insertions(+), 7 deletions(-)
create mode 100644 net/mptcp/sockopt_test.c
--
2.55.0