diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-08-06 11:58:04 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-09 17:16:26 -0400 |
commit | 8945ee5e27156ef9708bc3a11da87ba689aa38b6 (patch) | |
tree | ac6d0a0fd27b3d7f2acd2d50ab5d9e0941a4ff91 /net/sunrpc | |
parent | 95392c593e13fa7546857425971f87e4ded6e0c1 (diff) |
SUNRPC: Split xs_reclassify_socket into an IPv4 and IPv6 version
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprtsock.c | 38 |
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) | |||
1316 | static struct lock_class_key xs_key[2]; | 1316 | static struct lock_class_key xs_key[2]; |
1317 | static struct lock_class_key xs_slock_key[2]; | 1317 | static struct lock_class_key xs_slock_key[2]; |
1318 | 1318 | ||
1319 | static inline void xs_reclassify_socket(struct socket *sock) | 1319 | static 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: | 1328 | static 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 |
1339 | static inline void xs_reclassify_socket(struct socket *sock) | 1337 | static inline void xs_reclassify_socket4(struct socket *sock) |
1338 | { | ||
1339 | } | ||
1340 | |||
1341 | static 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); |