Commit 22196d36 authored by David S. Miller's avatar David S. Miller

decnet: Remove SOCK_SLEEP_{PRE,POST} usage.

Just expand the wait sequence.  And as a nice side-effect
the timeout is respected now.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8ce9c6ed
...@@ -1719,6 +1719,8 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1719,6 +1719,8 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
* See if there is data ready to read, sleep if there isn't * See if there is data ready to read, sleep if there isn't
*/ */
for(;;) { for(;;) {
DEFINE_WAIT(wait);
if (sk->sk_err) if (sk->sk_err)
goto out; goto out;
...@@ -1748,14 +1750,11 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1748,14 +1750,11 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
goto out; goto out;
} }
set_bit(SOCK_ASYNC_WAITDATA, &sock->flags); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
SOCK_SLEEP_PRE(sk) set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
sk_wait_event(sk, &timeo, dn_data_ready(sk, queue, flags, target));
if (!dn_data_ready(sk, queue, flags, target)) clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
schedule(); finish_wait(sk->sk_sleep, &wait);
SOCK_SLEEP_POST(sk)
clear_bit(SOCK_ASYNC_WAITDATA, &sock->flags);
} }
for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) { for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) {
...@@ -2002,18 +2001,19 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -2002,18 +2001,19 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
* size. * size.
*/ */
if (dn_queue_too_long(scp, queue, flags)) { if (dn_queue_too_long(scp, queue, flags)) {
DEFINE_WAIT(wait);
if (flags & MSG_DONTWAIT) { if (flags & MSG_DONTWAIT) {
err = -EWOULDBLOCK; err = -EWOULDBLOCK;
goto out; goto out;
} }
SOCK_SLEEP_PRE(sk) prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
if (dn_queue_too_long(scp, queue, flags)) sk_wait_event(sk, &timeo,
schedule(); !dn_queue_too_long(scp, queue, flags));
clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
SOCK_SLEEP_POST(sk) finish_wait(sk->sk_sleep, &wait);
continue; continue;
} }
......
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