aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e8fa46c7cff2..644462729387 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1461,6 +1461,39 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
1461 return rc; 1461 return rc;
1462} 1462}
1463 1463
1464#ifdef CONFIG_DEBUG_LOCK_ALLOC
1465static struct lock_class_key cifs_key[2];
1466static struct lock_class_key cifs_slock_key[2];
1467
1468static inline void
1469cifs_reclassify_socket4(struct socket *sock)
1470{
1471 struct sock *sk = sock->sk;
1472 BUG_ON(sock_owned_by_user(sk));
1473 sock_lock_init_class_and_name(sk, "slock-AF_INET-CIFS",
1474 &cifs_slock_key[0], "sk_lock-AF_INET-CIFS", &cifs_key[0]);
1475}
1476
1477static inline void
1478cifs_reclassify_socket6(struct socket *sock)
1479{
1480 struct sock *sk = sock->sk;
1481 BUG_ON(sock_owned_by_user(sk));
1482 sock_lock_init_class_and_name(sk, "slock-AF_INET6-CIFS",
1483 &cifs_slock_key[1], "sk_lock-AF_INET6-CIFS", &cifs_key[1]);
1484}
1485#else
1486static inline void
1487cifs_reclassify_socket4(struct socket *sock)
1488{
1489}
1490
1491static inline void
1492cifs_reclassify_socket6(struct socket *sock)
1493{
1494}
1495#endif
1496
1464/* See RFC1001 section 14 on representation of Netbios names */ 1497/* See RFC1001 section 14 on representation of Netbios names */
1465static void rfc1002mangle(char *target, char *source, unsigned int length) 1498static void rfc1002mangle(char *target, char *source, unsigned int length)
1466{ 1499{
@@ -1495,6 +1528,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1495 /* BB other socket options to set KEEPALIVE, NODELAY? */ 1528 /* BB other socket options to set KEEPALIVE, NODELAY? */
1496 cFYI(1, ("Socket created")); 1529 cFYI(1, ("Socket created"));
1497 (*csocket)->sk->sk_allocation = GFP_NOFS; 1530 (*csocket)->sk->sk_allocation = GFP_NOFS;
1531 cifs_reclassify_socket4(*csocket);
1498 } 1532 }
1499 } 1533 }
1500 1534
@@ -1627,6 +1661,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1627 /* BB other socket options to set KEEPALIVE, NODELAY? */ 1661 /* BB other socket options to set KEEPALIVE, NODELAY? */
1628 cFYI(1, ("ipv6 Socket created")); 1662 cFYI(1, ("ipv6 Socket created"));
1629 (*csocket)->sk->sk_allocation = GFP_NOFS; 1663 (*csocket)->sk->sk_allocation = GFP_NOFS;
1664 cifs_reclassify_socket6(*csocket);
1630 } 1665 }
1631 } 1666 }
1632 1667