af_iucv patches for linux-2.6.31
Subsystems (3)
PATCH 2/2 af_iucv: Return -EAGAIN if iucv msg limit is exceeded
In reply to Ursula BraunFrom: Hendrik Brueckner <[email protected]>
If the iucv message limit for a communication path is exceeded, sendmsg() returns -EAGAIN instead of -EPIPE.
The calling application can then handle this error situtation, e.g. to try again after waiting some time.
For blocking sockets, sendmsg() waits up to the socket timeout before returning -EAGAIN. For the new wait condition, a macro has been introduced and the iucv_sock_wait_state() has been refactored to this macro.
---
include/net/iucv/af_iucv.h | 2 net/iucv/af_iucv.c | 144 ++++++++++++++++++++++++++++++++------------- 2 files changed, 103 insertions(+), 43 deletions(-)
include/net/iucv/af_iucv.h +0 -2
@@ -94,8 +94,6 @@ unsigned int iucv_sock_poll(struct file poll_table *wait);void iucv_sock_link (struct iucv_sock_list *l,struct sock *s);void iucv_sock_unlink (struct iucv_sock_list *l,struct sock *s); -int iucv_sock_wait_state (struct sock *sk,int state,int state2, -unsigned long timeo);int iucv_sock_wait_cnt (struct sock *sk,unsigned long timeo);void iucv_accept_enqueue (struct sock *parent,struct sock *sk);void iucv_accept_unlink (struct sock *sk);
net/iucv/af_iucv.c +103 -41
208 lines not on this page · raw message
PATCH 1/2 af_iucv: Change if condition in sendmsg() for more readability
In reply to Ursula BraunFrom: Hendrik Brueckner <[email protected]>
Change the if condition to exit sendmsg() if the socket in not connected.
---
net/iucv/af_iucv.c | 165 ++++++++++++++++++++++++++--------------------------- 1 file changed, 82 insertions(+), 83 deletions(-)
net/iucv/af_iucv.c +82 -83
@@ -864,108 +864,107 @@ static int iucv_sock_sendmsg(struct kioc goto out; } -if (sk->sk_state ==IUCV_CONNECTED ) { -/* initialize defaults */ - cmsg_done =0 ;/* check for duplicate headers */ - txmsg.class =0 ; +/* Return if the socket is not in connected state */ +if (sk->sk_state !=IUCV_CONNECTED ) { + err = -ENOTCONN ; + goto out; + } -/* iterate over control messages */ -for (cmsg =CMSG_FIRSTHDR (msg); cmsg; - cmsg =CMSG_NXTHDR (msg, cmsg)) { +/* initialize defaults */ + cmsg_done =0 ;/* check for duplicate headers */ + txmsg.class =0 ; + +/* iterate over control messages */ +for (cmsg =CMSG_FIRSTHDR (msg); cmsg; + cmsg =CMSG_NXTHDR (msg, cmsg)) { -if (!CMSG_OK (msg, cmsg)) { - err = -EINVAL ; - goto out; - } +if (!CMSG_OK (msg, cmsg)) { + err = -EINVAL ; + goto out; + } -if (cmsg->cmsg_level !=SOL_IUCV ) -continue ; +if (cmsg->cmsg_level !=SOL_IUCV ) +continue ; + +if (cmsg->cmsg_type & cmsg_done) { + err = -EINVAL ; + goto out; + } + cmsg_done |= cmsg->cmsg_type; -if (cmsg->cmsg_type & cmsg_done) { +switch (cmsg->cmsg_type) { +case SCM_IUCV_TRGCLS : +if (cmsg->cmsg_len !=CMSG_LEN (TRGCLS_SIZE )) { err = -EINVAL ; goto out; } - cmsg_done |= cmsg->cmsg_type; -switch (cmsg->cmsg_type) { -case SCM_IUCV_TRGCLS : -if (cmsg->cmsg_len !=CMSG_LEN (TRGCLS_SIZE )) { - err = -EINVAL ; - goto out; - } - -/* set iucv message target class */ -memcpy (&txmsg.class, - (void *)CMSG_DATA (cmsg),TRGCLS_SIZE ); +/* set iucv message target class */ +memcpy (&txmsg.class, + (void *)CMSG_DATA (cmsg),TRGCLS_SIZE ); -break ; +break ; -default : - err = -EINVAL ; - goto out; -break ; - } +default : + err = -EINVAL ; + goto out; +break ; } + } -/* allocate one skb for each iucv message: -* this is fine for SOCK_SEQPACKET (unless we want to support -* segmented records using the MSG_EOR flag), but -* for SOCK_STREAM we might want to improve it in future */ -if (!(skb =sock_alloc_send_skb (sk, len, - msg->msg_flags &MSG_DONTWAIT , - &err))) - goto out; +/* allocate one skb for each iucv message: +* this is fine for SOCK_SEQPACKET (unless we want to support +* segmented records using the MSG_EOR flag), but +* for SOCK_STREAM we might want to improve it in future */ + skb =sock_alloc_send_skb (sk, len, msg->msg_flags &MSG_DONTWAIT , + &err); +if (!skb) + goto out; +if (memcpy_fromiovec (skb_put (skb, len), msg->msg_iov, len)) { + err = -EFAULT ; + goto fail; + } -if (memcpy_fromiovec (skb_put (skb, len), msg->msg_iov, len)) { - err = -EFAULT ; - goto fail; +/* increment and save iucv message tag for msg_completion cbk */ + txmsg.tag = iucv->send_tag++; +memcpy (CB_TAG (skb), &txmsg.tag,CB_TAG_LEN ); +skb_queue_tail (&iucv->send_skb_q, skb); + +if (((iucv->path->flags &IUCV_IPRMDATA ) & iucv->flags) + && skb->len <=7 ) { + err =iucv_send_iprm (iucv->path, &txmsg, skb); + +/* on success: there is no message_complete callback +* for an IPRMDATA msg; remove skb from send queue */ +if (err ==0 ) { +skb_unlink (skb, &iucv->send_skb_q); +kfree_skb (skb); } -/* increment and save iucv message tag for msg_completion cbk */ - txmsg.tag = iucv->send_tag++; -memcpy (CB_TAG (skb), &txmsg.tag,CB_TAG_LEN ); -skb_queue_tail (&iucv->send_skb_q, skb); - -if (((iucv->path->flags &IUCV_IPRMDATA ) & iucv->flags) - && skb->len <=7 ) { - err =iucv_send_iprm (iucv->path, &txmsg, skb); - -/* on success: there is no message_complete callback -* for an IPRMDATA msg; remove skb from send queue */ -if (err ==0 ) { -skb_unlink (skb, &iucv->send_skb_q); -kfree_skb (skb); - } - -/* this error should never happen since the -* IUCV_IPRMDATA path flag is set... sever path */ -if (err ==0x15 ) { -iucv_path_sever (iucv->path,NULL ); -skb_unlink (skb, &iucv->send_skb_q); - err = -EPIPE ; - goto fail; - } - }else - err =iucv_message_send (iucv->path, &txmsg,0 ,0 , - (void *) skb->data, skb->len); -if (err) { -if (err ==3 ) { - user_id[8 ] =0 ; -memcpy (user_id, iucv->dst_user_id,8 ); - appl_id[8 ] =0 ; -memcpy (appl_id, iucv->dst_name,8 ); -pr_err ("Application %s on z/VM guest %s" -" exceeds message limit\n" , - user_id, appl_id); - } +/* this error should never happen since the +* IUCV_IPRMDATA path flag is set... sever path */ +if (err ==0x15 ) { +iucv_path_sever (iucv->path,NULL );skb_unlink (skb, &iucv->send_skb_q); err = -EPIPE ; goto fail; } - - }else { - err = -ENOTCONN ; - goto out; + }else + err =iucv_message_send (iucv->path, &txmsg,0 ,0 , + (void *) skb->data, skb->len); +if (err) { +if (err ==3 ) { + user_id[8 ] =0 ; +memcpy (user_id, iucv->dst_user_id,8 ); + appl_id[8 ] =0 ; +memcpy (appl_id, iucv->dst_name,8 ); +pr_err ("Application %s on z/VM guest %s" +" exceeds message limit\n" , + appl_id, user_id); + } +skb_unlink (skb, &iucv->send_skb_q); + err = -EPIPE ; + goto fail; }release_sock (sk);
cover af_iucv patches for linux-2.6.31
Dave,
Hendrik has built 2 af_iucv patches fixing inappropriate return code handling for sendmsg. They are built against linux-2.6.30. We would like to see them included in 2.6.31 - if possible.
Regards, Ursula
David Miller
maintainerFrom: Ursula Braun <[email protected]>
Date: Thu, 18 Jun 2009 09:54:46 +0200
Quoted 3 lines
Hendrik has built 2
af_iucvpatches fixing inappropriate return code handling for sendmsg. They are built against linux-2.6.30. We would like to see them included in 2.6.31 - if possible.
These patches do not apply cleanly against Linus's current tree nor net-next-2.6 which is what you should be subumitting patches again.
This late in the merge window it really behooves you to do anything other than submit patches against the previous release... it's almost guarenteed to fail, really.
Quoted 7 lines · David Miller
From: Ursula Braun <[email protected]>
Date: Thu, 18 Jun 2009 09:54:46 +0200Quoted 3 lines
Hendrik has built 2
af_iucvpatches fixing inappropriate return code handling for sendmsg. They are built against linux-2.6.30. We would like to see them included in 2.6.31 - if possible.
Quoted 6 lines
These patches do not apply cleanly against Linus's current tree nor net-next-2.6 which is what you should be subumitting patches again.
This late in the merge window it really behooves you to do anything other than submit patches against the previous release... it's almost guarenteed to fail, really.
Dave,
sorry, I did a git pull on linux-2.6.git first, and the af_iucv patches applied cleanly on my system. Anyway, I understand that I have been too late in the merge window. I will submit the patches against net-next-2.6 again.
Regards, Ursula
David Miller
maintainerFrom: Ursula Braun <[email protected]>
Date: Thu, 18 Jun 2009 14:44:54 +0200
Quoted 2 lines
sorry, I did a git pull on linux-2.6.git first, and the
af_iucvpatches applied cleanly on my system.
It couldn't have applied to Linus's tree because all the IUCV bits you submitted to me for 2.6.31 are in his tree and that is what created the conflicts.
Hi David,
Quoted 9 lines · On Thu, 18 Jun 2009 11:19:57 -0700 (PDT) David Miller <[email protected]>…
From: Ursula Braun <[email protected]>
Date: Thu, 18 Jun 2009 14:44:54 +0200Quoted 2 lines
sorry, I did a git pull on linux-2.6.git first, and the
af_iucvpatches applied cleanly on my system.It couldn't have applied to Linus's tree because all the IUCV bits you submitted to me for 2.6.31 are in his tree and that is what created the conflicts.
Now I am confused. I just tested the two patches Uschi sent with todays upstream tree. The patches apply fine. Where is the problem, wrong tree?
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.
David Miller
maintainerFrom: Martin Schwidefsky <[email protected]>
Date: Fri, 19 Jun 2009 09:04:26 +0200
Quoted 11 lines
Hi David,
Quoted 6 lines · On Thu, 18 Jun 2009 11:19:57 -0700 (PDT) David Miller <[email protected]>…
From: Ursula Braun <[email protected]>
Date: Thu, 18 Jun 2009 14:44:54 +0200Quoted 2 lines
sorry, I did a git pull on linux-2.6.git first, and the
af_iucvpatches applied cleanly on my system.
Quoted 6 lines
Quoted 3 lines
It couldn't have applied to Linus's tree because all the IUCV bits you submitted to me for 2.6.31 are in his tree and that is what created the conflicts.
Now I am confused. I just tested the two patches Uschi sent with todays upstream tree. The patches apply fine. Where is the problem, wrong tree?
Weird, I just retried and they do apply cleanly.
I have no idea what happened, sorry.
They are in my tree now, thanks.