diff options
author | Weston Andros Adamson <dros@netapp.com> | 2012-10-23 10:43:39 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-04 14:43:41 -0500 |
commit | 1b7a1819078c68c4df4bba90f76b8113a08460de (patch) | |
tree | 28e13809dd756d0be47526787c462aad4f3462e6 /net/sunrpc/xprtsock.c | |
parent | 1bd58aaff44485ec9e3640af350f6ba1b33e2bec (diff) |
SUNRPC: remove BUG_ONs from *_reclassify_socket*
Replace multiple BUG_ON() calls with WARN_ON_ONCE() and early return when
sanity checking socket ownership (lock). The bind call will fail if the
socket was unsuccessfully reclassified.
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 75853cabf4c9..46c1a8798ed8 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1746,7 +1746,6 @@ static inline void xs_reclassify_socketu(struct socket *sock) | |||
1746 | { | 1746 | { |
1747 | struct sock *sk = sock->sk; | 1747 | struct sock *sk = sock->sk; |
1748 | 1748 | ||
1749 | BUG_ON(sock_owned_by_user(sk)); | ||
1750 | sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC", | 1749 | sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC", |
1751 | &xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]); | 1750 | &xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]); |
1752 | } | 1751 | } |
@@ -1755,7 +1754,6 @@ static inline void xs_reclassify_socket4(struct socket *sock) | |||
1755 | { | 1754 | { |
1756 | struct sock *sk = sock->sk; | 1755 | struct sock *sk = sock->sk; |
1757 | 1756 | ||
1758 | BUG_ON(sock_owned_by_user(sk)); | ||
1759 | sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC", | 1757 | sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC", |
1760 | &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]); | 1758 | &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]); |
1761 | } | 1759 | } |
@@ -1764,13 +1762,16 @@ static inline void xs_reclassify_socket6(struct socket *sock) | |||
1764 | { | 1762 | { |
1765 | struct sock *sk = sock->sk; | 1763 | struct sock *sk = sock->sk; |
1766 | 1764 | ||
1767 | BUG_ON(sock_owned_by_user(sk)); | ||
1768 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC", | 1765 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC", |
1769 | &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]); | 1766 | &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]); |
1770 | } | 1767 | } |
1771 | 1768 | ||
1772 | static inline void xs_reclassify_socket(int family, struct socket *sock) | 1769 | static inline void xs_reclassify_socket(int family, struct socket *sock) |
1773 | { | 1770 | { |
1771 | WARN_ON_ONCE(sock_owned_by_user(sock->sk)); | ||
1772 | if (sock_owned_by_user(sock->sk)) | ||
1773 | return; | ||
1774 | |||
1774 | switch (family) { | 1775 | switch (family) { |
1775 | case AF_LOCAL: | 1776 | case AF_LOCAL: |
1776 | xs_reclassify_socketu(sock); | 1777 | xs_reclassify_socketu(sock); |