All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jon Maloy <jon.maloy@ericsson.com>,
	Allan Stephens <allan.stephens@windriver.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: tipc timeout handling.
Date: Fri, 16 May 2014 10:42:53 -0300	[thread overview]
Message-ID: <20140516134253.GD4223@kernel.org> (raw)

Hi Jon, Allan,

	While working on a fix for the per recvmmsg syscall timeout
handling I found this issue, can you take a look if this is acceptable?

Thanks,

- Arnaldo

commit 592bb2a330427750d323b1362bf0822db1695e29
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Fri May 16 10:33:02 2014 -0300

    tipc: Don't reset the timeout when restarting
    
    As it may then take longer than what the user specified using
    setsockopt(SO_RCVTIMEO).
    
    Cc: Allan Stephens <allan.stephens@windriver.com>
    Cc: David Miller <davem@davemloft.net>
    To: Jon Maloy <jon.maloy@ericsson.com>,
    Link: http://lkml.kernel.org/n/tip-@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 3f9912f87d0d..083c672a2a39 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -984,10 +984,11 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
 	return 0;
 }
 
-static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
+static int tipc_wait_for_rcvmsg(struct socket *sock, long *timeop)
 {
 	struct sock *sk = sock->sk;
 	DEFINE_WAIT(wait);
+	long timeo = *timeop;
 	int err;
 
 	for (;;) {
@@ -1012,6 +1013,7 @@ static int tipc_wait_for_rcvmsg(struct socket *sock, long timeo)
 			break;
 	}
 	finish_wait(sk_sleep(sk), &wait);
+	*timeop = timeo;
 	return err;
 }
 
@@ -1055,7 +1057,7 @@ static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock,
 restart:
 
 	/* Look for a message in receive queue; wait if necessary */
-	res = tipc_wait_for_rcvmsg(sock, timeo);
+	res = tipc_wait_for_rcvmsg(sock, &timeo);
 	if (res)
 		goto exit;
 
@@ -1153,7 +1155,7 @@ static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock,
 
 restart:
 	/* Look for a message in receive queue; wait if necessary */
-	res = tipc_wait_for_rcvmsg(sock, timeo);
+	res = tipc_wait_for_rcvmsg(sock, &timeo);
 	if (res)
 		goto exit;
 

             reply	other threads:[~2014-05-16 13:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 13:42 Arnaldo Carvalho de Melo [this message]
2014-05-16 21:22 ` tipc timeout handling Jon Maloy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140516134253.GD4223@kernel.org \
    --to=acme@kernel.org \
    --cc=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.