aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtsock.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index fcbfae82cb12..01121a4f0851 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1316,27 +1316,29 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock)
1316static struct lock_class_key xs_key[2]; 1316static struct lock_class_key xs_key[2];
1317static struct lock_class_key xs_slock_key[2]; 1317static struct lock_class_key xs_slock_key[2];
1318 1318
1319static inline void xs_reclassify_socket(struct socket *sock) 1319static inline void xs_reclassify_socket4(struct socket *sock)
1320{ 1320{
1321 struct sock *sk = sock->sk; 1321 struct sock *sk = sock->sk;
1322
1322 BUG_ON(sk->sk_lock.owner != NULL); 1323 BUG_ON(sk->sk_lock.owner != NULL);
1323 switch (sk->sk_family) { 1324 sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC",
1324 case AF_INET: 1325 &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]);
1325 sock_lock_init_class_and_name(sk, "slock-AF_INET-NFS", 1326}
1326 &xs_slock_key[0], "sk_lock-AF_INET-NFS", &xs_key[0]);
1327 break;
1328 1327
1329 case AF_INET6: 1328static inline void xs_reclassify_socket6(struct socket *sock)
1330 sock_lock_init_class_and_name(sk, "slock-AF_INET6-NFS", 1329{
1331 &xs_slock_key[1], "sk_lock-AF_INET6-NFS", &xs_key[1]); 1330 struct sock *sk = sock->sk;
1332 break;
1333 1331
1334 default: 1332 BUG_ON(sk->sk_lock.owner != NULL);
1335 BUG(); 1333 sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC",
1336 } 1334 &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]);
1337} 1335}
1338#else 1336#else
1339static inline void xs_reclassify_socket(struct socket *sock) 1337static inline void xs_reclassify_socket4(struct socket *sock)
1338{
1339}
1340
1341static inline void xs_reclassify_socket6(struct socket *sock)
1340{ 1342{
1341} 1343}
1342#endif 1344#endif
@@ -1394,7 +1396,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
1394 dprintk("RPC: can't create UDP transport socket (%d).\n", -err); 1396 dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
1395 goto out; 1397 goto out;
1396 } 1398 }
1397 xs_reclassify_socket(sock); 1399 xs_reclassify_socket4(sock);
1398 1400
1399 if (xs_bind4(transport, sock)) { 1401 if (xs_bind4(transport, sock)) {
1400 sock_release(sock); 1402 sock_release(sock);
@@ -1435,7 +1437,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
1435 dprintk("RPC: can't create UDP transport socket (%d).\n", -err); 1437 dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
1436 goto out; 1438 goto out;
1437 } 1439 }
1438 xs_reclassify_socket(sock); 1440 xs_reclassify_socket6(sock);
1439 1441
1440 if (xs_bind6(transport, sock) < 0) { 1442 if (xs_bind6(transport, sock) < 0) {
1441 sock_release(sock); 1443 sock_release(sock);
@@ -1538,7 +1540,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1538 dprintk("RPC: can't create TCP transport socket (%d).\n", -err); 1540 dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
1539 goto out; 1541 goto out;
1540 } 1542 }
1541 xs_reclassify_socket(sock); 1543 xs_reclassify_socket4(sock);
1542 1544
1543 if (xs_bind4(transport, sock) < 0) { 1545 if (xs_bind4(transport, sock) < 0) {
1544 sock_release(sock); 1546 sock_release(sock);
@@ -1599,7 +1601,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1599 dprintk("RPC: can't create TCP transport socket (%d).\n", -err); 1601 dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
1600 goto out; 1602 goto out;
1601 } 1603 }
1602 xs_reclassify_socket(sock); 1604 xs_reclassify_socket6(sock);
1603 1605
1604 if (xs_bind6(transport, sock) < 0) { 1606 if (xs_bind6(transport, sock) < 0) {
1605 sock_release(sock); 1607 sock_release(sock);