summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-16 12:19:24 +0200
committerSimon Rettberg2020-07-16 12:19:24 +0200
commit643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a (patch)
treea9a82d8752d991a021346bde0c3daf7ee9096ea6 /src
parent[KERNEL] do_gettimeofday was removed in 5.0 (diff)
downloaddnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.tar.gz
dnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.tar.xz
dnbd3-ng-643d6e9ffe417f2cb519d1b5ecfa3eaae50b2b3a.zip
[KERNEL] Assign socket timeouts directly, like other kernel modules
Diffstat (limited to 'src')
-rw-r--r--src/kernel/net.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/kernel/net.c b/src/kernel/net.c
index b229164..7058b8b 100644
--- a/src/kernel/net.c
+++ b/src/kernel/net.c
@@ -608,7 +608,6 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock,
struct dnbd3_server *server)
{
int result = 0;
- struct timeval timeout;
if (server->host.port == 0 || server->host.type == 0) {
error_sock(sock, "host or port not set");
@@ -619,8 +618,6 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock,
return -EIO;
}
- timeout.tv_sec = SOCKET_TIMEOUT_CLIENT_DATA;
- timeout.tv_usec = 0;
result = dnbd3_sock_create(server->host.type, SOCK_STREAM, IPPROTO_TCP,
&sock->sock);
if (result < 0) {
@@ -628,10 +625,8 @@ static int __dnbd3_socket_connect(struct dnbd3_sock *sock,
goto error;
}
- kernel_setsockopt(sock->sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout,
- sizeof(timeout));
- kernel_setsockopt(sock->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,
- sizeof(timeout));
+ sock->sock->sk->sk_rcvtimeo = sock->sock->sk->sk_sndtimeo
+ = SOCKET_TIMEOUT_CLIENT_DATA * HZ;
sock->sock->sk->sk_allocation = GFP_NOIO;
if (server->host.type == HOST_IP4) {
struct sockaddr_in sin;