aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 3bb232eb5d90..49cabffd7fdb 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1173,6 +1173,35 @@ static int xs_bindresvport(struct sock_xprt *transport, struct socket *sock)
1173 return err; 1173 return err;
1174} 1174}
1175 1175
1176#ifdef CONFIG_DEBUG_LOCK_ALLOC
1177static struct lock_class_key xs_key[2];
1178static struct lock_class_key xs_slock_key[2];
1179
1180static inline void xs_reclassify_socket(struct socket *sock)
1181{
1182 struct sock *sk = sock->sk;
1183 BUG_ON(sk->sk_lock.owner != NULL);
1184 switch (sk->sk_family) {
1185 case AF_INET:
1186 sock_lock_init_class_and_name(sk, "slock-AF_INET-NFS",
1187 &xs_slock_key[0], "sk_lock-AF_INET-NFS", &xs_key[0]);
1188 break;
1189
1190 case AF_INET6:
1191 sock_lock_init_class_and_name(sk, "slock-AF_INET6-NFS",
1192 &xs_slock_key[1], "sk_lock-AF_INET6-NFS", &xs_key[1]);
1193 break;
1194
1195 default:
1196 BUG();
1197 }
1198}
1199#else
1200static inline void xs_reclassify_socket(struct socket *sock)
1201{
1202}
1203#endif
1204
1176/** 1205/**
1177 * xs_udp_connect_worker - set up a UDP socket 1206 * xs_udp_connect_worker - set up a UDP socket
1178 * @work: RPC transport to connect 1207 * @work: RPC transport to connect
@@ -1197,6 +1226,7 @@ static void xs_udp_connect_worker(struct work_struct *work)
1197 dprintk("RPC: can't create UDP transport socket (%d).\n", -err); 1226 dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
1198 goto out; 1227 goto out;
1199 } 1228 }
1229 xs_reclassify_socket(sock);
1200 1230
1201 if (xprt->resvport && xs_bindresvport(transport, sock) < 0) { 1231 if (xprt->resvport && xs_bindresvport(transport, sock) < 0) {
1202 sock_release(sock); 1232 sock_release(sock);
@@ -1282,6 +1312,7 @@ static void xs_tcp_connect_worker(struct work_struct *work)
1282 dprintk("RPC: can't create TCP transport socket (%d).\n", -err); 1312 dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
1283 goto out; 1313 goto out;
1284 } 1314 }
1315 xs_reclassify_socket(sock);
1285 1316
1286 if (xprt->resvport && xs_bindresvport(transport, sock) < 0) { 1317 if (xprt->resvport && xs_bindresvport(transport, sock) < 0) {
1287 sock_release(sock); 1318 sock_release(sock);