Commit f1980d3a authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: better behavior for sendmsg/recvmsg during async closes

parent a01f18ab
...@@ -476,9 +476,8 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, ...@@ -476,9 +476,8 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
return -EOPNOTSUPP; return -EOPNOTSUPP;
vcc = ATM_SD(sock); vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED,&vcc->flags) || if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
test_bit(ATM_VF_CLOSE,&vcc->flags)) test_bit(ATM_VF_CLOSE,&vcc->flags) ||
return -sk->sk_err; !test_bit(ATM_VF_READY, &vcc->flags))
if (!test_bit(ATM_VF_READY, &vcc->flags))
return 0; return 0;
skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error); skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error);
...@@ -530,12 +529,10 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -530,12 +529,10 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
size = m->msg_iov->iov_len; size = m->msg_iov->iov_len;
vcc = ATM_SD(sock); vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED, &vcc->flags) || if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
test_bit(ATM_VF_CLOSE, &vcc->flags)) { test_bit(ATM_VF_CLOSE, &vcc->flags) ||
error = -sk->sk_err; !test_bit(ATM_VF_READY, &vcc->flags)) {
goto out;
}
if (!test_bit(ATM_VF_READY, &vcc->flags)) {
error = -EPIPE; error = -EPIPE;
send_sig(SIGPIPE, current, 0);
goto out; goto out;
} }
if (!size) { if (!size) {
...@@ -561,12 +558,10 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, ...@@ -561,12 +558,10 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
break; break;
} }
if (test_bit(ATM_VF_RELEASED,&vcc->flags) || if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
test_bit(ATM_VF_CLOSE,&vcc->flags)) { test_bit(ATM_VF_CLOSE,&vcc->flags) ||
error = -sk->sk_err; !test_bit(ATM_VF_READY,&vcc->flags)) {
break;
}
if (!test_bit(ATM_VF_READY,&vcc->flags)) {
error = -EPIPE; error = -EPIPE;
send_sig(SIGPIPE, current, 0);
break; break;
} }
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
......
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