Commit 8945ee5e authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

SUNRPC: Split xs_reclassify_socket into an IPv4 and IPv6 version

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 95392c59
...@@ -1316,27 +1316,29 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock) ...@@ -1316,27 +1316,29 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock)
static struct lock_class_key xs_key[2]; static struct lock_class_key xs_key[2];
static struct lock_class_key xs_slock_key[2]; static struct lock_class_key xs_slock_key[2];
static inline void xs_reclassify_socket(struct socket *sock) static inline void xs_reclassify_socket4(struct socket *sock)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
BUG_ON(sk->sk_lock.owner != NULL); BUG_ON(sk->sk_lock.owner != NULL);
switch (sk->sk_family) { sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC",
case AF_INET: &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]);
sock_lock_init_class_and_name(sk, "slock-AF_INET-NFS", }
&xs_slock_key[0], "sk_lock-AF_INET-NFS", &xs_key[0]);
break;
case AF_INET6: static inline void xs_reclassify_socket6(struct socket *sock)
sock_lock_init_class_and_name(sk, "slock-AF_INET6-NFS", {
&xs_slock_key[1], "sk_lock-AF_INET6-NFS", &xs_key[1]); struct sock *sk = sock->sk;
break;
default: BUG_ON(sk->sk_lock.owner != NULL);
BUG(); sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC",
} &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]);
} }
#else #else
static inline void xs_reclassify_socket(struct socket *sock) static inline void xs_reclassify_socket4(struct socket *sock)
{
}
static inline void xs_reclassify_socket6(struct socket *sock)
{ {
} }
#endif #endif
...@@ -1394,7 +1396,7 @@ static void xs_udp_connect_worker4(struct work_struct *work) ...@@ -1394,7 +1396,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
dprintk("RPC: can't create UDP transport socket (%d).\n", -err); dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
goto out; goto out;
} }
xs_reclassify_socket(sock); xs_reclassify_socket4(sock);
if (xs_bind4(transport, sock)) { if (xs_bind4(transport, sock)) {
sock_release(sock); sock_release(sock);
...@@ -1435,7 +1437,7 @@ static void xs_udp_connect_worker6(struct work_struct *work) ...@@ -1435,7 +1437,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
dprintk("RPC: can't create UDP transport socket (%d).\n", -err); dprintk("RPC: can't create UDP transport socket (%d).\n", -err);
goto out; goto out;
} }
xs_reclassify_socket(sock); xs_reclassify_socket6(sock);
if (xs_bind6(transport, sock) < 0) { if (xs_bind6(transport, sock) < 0) {
sock_release(sock); sock_release(sock);
...@@ -1538,7 +1540,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work) ...@@ -1538,7 +1540,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
dprintk("RPC: can't create TCP transport socket (%d).\n", -err); dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
goto out; goto out;
} }
xs_reclassify_socket(sock); xs_reclassify_socket4(sock);
if (xs_bind4(transport, sock) < 0) { if (xs_bind4(transport, sock) < 0) {
sock_release(sock); sock_release(sock);
...@@ -1599,7 +1601,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work) ...@@ -1599,7 +1601,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
dprintk("RPC: can't create TCP transport socket (%d).\n", -err); dprintk("RPC: can't create TCP transport socket (%d).\n", -err);
goto out; goto out;
} }
xs_reclassify_socket(sock); xs_reclassify_socket6(sock);
if (xs_bind6(transport, sock) < 0) { if (xs_bind6(transport, sock) < 0) {
sock_release(sock); sock_release(sock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment