Skip to contentSkip to conversation

tipc timeout handling.

PATCH Arnaldo Carvalho de Melo 2 participants 2 messages May 16, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore 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 <[email protected]>
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 <[email protected]>
Cc: David Miller <[email protected]>
To: Jon Maloy <[email protected]>,

net/tipc/socket.c +5 -3
index 3f9912f87d0d..083c672a2a39 100644
@@ -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;
 
#1 lore raw

Hi Arnaldo,
Reviewed and tested. No problem.

Regards
///jon

Quoted 78 lines

-----Original Message-----
From: Arnaldo Carvalho de Melo [mailto:[email protected]]
Sent: May-16-14 9:43 AM
To: Jon Maloy; Allan Stephens
Cc: [email protected]; David Miller
Subject: tipc timeout handling.

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 <[email protected]>
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 <[email protected]>
Cc: David Miller <[email protected]>
To: Jon Maloy <[email protected]>,

net/tipc/socket.c index renamed from net/tipc/socket.c +0 -0

3f9912f87d0d..083c672a2a39 100644

net/tipc/socket.c +2 -1
@@ -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;
 
net/tipc/socket.c +3 -2
 	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;