Commit a632875f authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[NET]: Uninline {lock,release}_sock().

parent 19774a6d
......@@ -542,24 +542,9 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
extern void __lock_sock(struct sock *sk);
extern void __release_sock(struct sock *sk);
#define sock_owned_by_user(sk) ((sk)->sk_lock.owner)
#define lock_sock(__sk) \
do { might_sleep(); \
spin_lock_bh(&((__sk)->sk_lock.slock)); \
if ((__sk)->sk_lock.owner) \
__lock_sock(__sk); \
(__sk)->sk_lock.owner = (void *)1; \
spin_unlock_bh(&((__sk)->sk_lock.slock)); \
} while(0)
#define release_sock(__sk) \
do { spin_lock_bh(&((__sk)->sk_lock.slock)); \
if ((__sk)->sk_backlog.tail) \
__release_sock(__sk); \
(__sk)->sk_lock.owner = NULL; \
if (waitqueue_active(&((__sk)->sk_lock.wq))) \
wake_up(&((__sk)->sk_lock.wq)); \
spin_unlock_bh(&((__sk)->sk_lock.slock)); \
} while(0)
extern void lock_sock(struct sock *sk);
extern void release_sock(struct sock *sk);
/* BH context may only use the following locking interface. */
#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
......
......@@ -1119,6 +1119,31 @@ void sock_init_data(struct socket *sock, struct sock *sk)
atomic_set(&sk->sk_refcnt, 1);
}
void lock_sock(struct sock *sk)
{
might_sleep();
spin_lock_bh(&(sk->sk_lock.slock));
if (sk->sk_lock.owner)
__lock_sock(sk);
sk->sk_lock.owner = (void *)1;
spin_unlock_bh(&(sk->sk_lock.slock));
}
EXPORT_SYMBOL(lock_sock);
void release_sock(struct sock *sk)
{
spin_lock_bh(&(sk->sk_lock.slock));
if (sk->sk_backlog.tail)
__release_sock(sk);
sk->sk_lock.owner = NULL;
if (waitqueue_active(&(sk->sk_lock.wq)))
wake_up(&(sk->sk_lock.wq));
spin_unlock_bh(&(sk->sk_lock.slock));
}
EXPORT_SYMBOL(release_sock);
EXPORT_SYMBOL(__lock_sock);
EXPORT_SYMBOL(__release_sock);
EXPORT_SYMBOL(sk_alloc);
......
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