Commit 064a9177 authored by NeilBrown's avatar NeilBrown Committed by Trond Myklebust
Browse files

SUNRPC: use different lock keys for INET6 and LOCAL



xprtsock.c reclassifies sock locks based on the protocol.
However there are 3 protocols and only 2 classification keys.
The same key is used for both INET6 and LOCAL.

This causes lockdep complaints.  The complaints started since Commit
ea9afca8 ("SUNRPC: Replace use of socket sk_callback_lock with
sock_lock") which resulted in the sock locks beings used more.

So add another key, and renumber them slightly.

Fixes: ea9afca8 ("SUNRPC: Replace use of socket sk_callback_lock with sock_lock")
Fixes: 176e21ee ("SUNRPC: Support for RPC over AF_LOCAL transports")
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 268bb038
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1720,15 +1720,15 @@ static void xs_local_set_port(struct rpc_xprt *xprt, unsigned short port)
}

#ifdef CONFIG_DEBUG_LOCK_ALLOC
static struct lock_class_key xs_key[2];
static struct lock_class_key xs_slock_key[2];
static struct lock_class_key xs_key[3];
static struct lock_class_key xs_slock_key[3];

static inline void xs_reclassify_socketu(struct socket *sock)
{
	struct sock *sk = sock->sk;

	sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC",
		&xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]);
		&xs_slock_key[0], "sk_lock-AF_LOCAL-RPC", &xs_key[0]);
}

static inline void xs_reclassify_socket4(struct socket *sock)
@@ -1736,7 +1736,7 @@ static inline void xs_reclassify_socket4(struct socket *sock)
	struct sock *sk = sock->sk;

	sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC",
		&xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]);
		&xs_slock_key[1], "sk_lock-AF_INET-RPC", &xs_key[1]);
}

static inline void xs_reclassify_socket6(struct socket *sock)
@@ -1744,7 +1744,7 @@ static inline void xs_reclassify_socket6(struct socket *sock)
	struct sock *sk = sock->sk;

	sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC",
		&xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]);
		&xs_slock_key[2], "sk_lock-AF_INET6-RPC", &xs_key[2]);
}

static inline void xs_reclassify_socket(int family, struct socket *sock)