* [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes
@ 2004-01-15 4:16 chas williams
2004-01-15 8:19 ` David S. Miller
0 siblings, 1 reply; 4+ messages in thread
From: chas williams @ 2004-01-15 4:16 UTC (permalink / raw)
To: davem; +Cc: netdev
2.6 version of the same 2.4 patch
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1513 -> 1.1514
# net/atm/common.c 1.61 -> 1.62
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/14 chas@relax.cmf.nrl.navy.mil 1.1514
# [ATM]: better behavior for sendmsg/recvmsg during async closes
# --------------------------------------------
#
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c Wed Jan 14 23:06:24 2004
+++ b/net/atm/common.c Wed Jan 14 23:06:24 2004
@@ -476,9 +476,8 @@
return -EOPNOTSUPP;
vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags))
- return -sk->sk_err;
- if (!test_bit(ATM_VF_READY, &vcc->flags))
+ test_bit(ATM_VF_CLOSE,&vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags))
return 0;
skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error);
@@ -530,12 +529,10 @@
size = m->msg_iov->iov_len;
vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
- test_bit(ATM_VF_CLOSE, &vcc->flags)) {
- error = -sk->sk_err;
- goto out;
- }
- if (!test_bit(ATM_VF_READY, &vcc->flags)) {
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
goto out;
}
if (!size) {
@@ -561,12 +558,10 @@
break;
}
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags)) {
- error = -sk->sk_err;
- break;
- }
- if (!test_bit(ATM_VF_READY,&vcc->flags)) {
+ test_bit(ATM_VF_CLOSE,&vcc->flags) ||
+ !test_bit(ATM_VF_READY,&vcc->flags)) {
error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
break;
}
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes
2004-01-15 4:16 [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes chas williams
@ 2004-01-15 8:19 ` David S. Miller
2004-01-16 3:03 ` chas williams
0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-01-15 8:19 UTC (permalink / raw)
To: chas3; +Cc: chas, netdev
On Wed, 14 Jan 2004 23:16:28 -0500
chas williams (contractor) <chas@cmf.nrl.navy.mil> wrote:
> 2.6 version of the same 2.4 patch
I applied the 2.6.x version, the 2.4.x version did not apply cleanly at all.
Please regenerate the 2.4.x patch for me, thanks Chas.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes
2004-01-15 8:19 ` David S. Miller
@ 2004-01-16 3:03 ` chas williams
0 siblings, 0 replies; 4+ messages in thread
From: chas williams @ 2004-01-16 3:03 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
In message <20040115001921.5d3edcbc.davem@redhat.com>,"David S. Miller" writes:
>I applied the 2.6.x version, the 2.4.x version did not apply cleanly at all.
>Please regenerate the 2.4.x patch for me, thanks Chas.
looks like my local 2.4 tree has diverged too much. here is something
that is more likely to be useful when patching 2.4:
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1383 -> 1.1384
# net/atm/common.c 1.27 -> 1.28
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/15 chas@relax.cmf.nrl.navy.mil 1.1384
# [ATM]: better behavior for sendmsg/recvmsg during async closes
# --------------------------------------------
#
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c Thu Jan 15 12:28:21 2004
+++ b/net/atm/common.c Thu Jan 15 12:28:21 2004
@@ -510,9 +510,8 @@
return -EOPNOTSUPP;
vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags))
- return vcc->reply;
- if (!test_bit(ATM_VF_READY, &vcc->flags))
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags))
return 0;
skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error);
@@ -568,12 +567,10 @@
size = m->msg_iov->iov_len;
vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
- test_bit(ATM_VF_CLOSE, &vcc->flags)) {
- error = vcc->reply;
- goto out;
- }
- if (!test_bit(ATM_VF_READY, &vcc->flags)) {
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
goto out;
}
if (!size) {
@@ -601,12 +598,10 @@
break;
}
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags)) {
- error = vcc->reply;
- break;
- }
- if (!test_bit(ATM_VF_READY,&vcc->flags)) {
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
break;
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes
@ 2004-01-15 4:16 chas williams
0 siblings, 0 replies; 4+ messages in thread
From: chas williams @ 2004-01-15 4:16 UTC (permalink / raw)
To: davem; +Cc: netdev
sendmsg() should probably just return -EPIPE (and send SIGPIPE) instead
of returning the error from sigd during an asynchronus close. often
the error code is 0 when the other side cleanly terminates the svc
since its likely the other side closed the svc without a 'hard' error.
recvmsg() shouldnt return EPIPE (this isnt a 'valid' return code for
recvmsg). returning 0 (end of file) seems the best idea when the remote
side has closed first.
please apply to 2.4
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1168 -> 1.1169
# net/atm/common.c 1.36 -> 1.37
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/14 chas@relax.cmf.nrl.navy.mil 1.1169
# [ATM]: better behavior for sendmsg/recvmsg during async closes
# --------------------------------------------
#
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c Wed Jan 14 22:13:22 2004
+++ b/net/atm/common.c Wed Jan 14 22:13:22 2004
@@ -629,11 +629,10 @@
if (flags & ~MSG_DONTWAIT) /* only handle MSG_DONTWAIT */
return -EOPNOTSUPP;
vcc = ATM_SD(sock);
- if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags))
- return -sk->err;
- if (!test_bit(ATM_VF_READY, &vcc->flags))
- return 0;
+ if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags))
+ return 0; /* end of file */
skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error);
if (!skb)
@@ -688,12 +687,10 @@
size = m->msg_iov->iov_len;
vcc = ATM_SD(sock);
if (test_bit(ATM_VF_RELEASED, &vcc->flags) ||
- test_bit(ATM_VF_CLOSE, &vcc->flags)) {
- error = -sk->err;
- goto out;
- }
- if (!test_bit(ATM_VF_READY, &vcc->flags)) {
- error = -EPIPE;
+ test_bit(ATM_VF_CLOSE, &vcc->flags) ||
+ !test_bit(ATM_VF_READY, &vcc->flags)) {
+ error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
goto out;
}
if (!size) {
@@ -721,12 +718,10 @@
break;
}
if (test_bit(ATM_VF_RELEASED,&vcc->flags) ||
- test_bit(ATM_VF_CLOSE,&vcc->flags)) {
- error = -sk->err;
- break;
- }
- if (!test_bit(ATM_VF_READY,&vcc->flags)) {
+ test_bit(ATM_VF_CLOSE,&vcc->flags) ||
+ !test_bit(ATM_VF_READY,&vcc->flags)) {
error = -EPIPE;
+ send_sig(SIGPIPE, current, 0);
break;
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-01-16 3:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-15 4:16 [PATCH][ATM]: better behavior for sendmsg/recvmsg during async closes chas williams
2004-01-15 8:19 ` David S. Miller
2004-01-16 3:03 ` chas williams
-- strict thread matches above, loose matches on Subject: below --
2004-01-15 4:16 chas williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).