mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
nbd: only set sndtimeo if we have a timeout set
A user reported that he was getting immediate disconnects with my
sndtimeo patch applied. This is because by default the OSS nbd client
doesn't set a timeout, so we end up setting the sndtimeo to 0, which of
course means we have send errors a lot. Instead only set our sndtimeo
if the user specified a timeout, otherwise we'll just wait forever like
we did previously.
Fixes: dc88e34d69 ("nbd: set sk->sk_sndtimeo for our sockets")
Reported-by: Adam Borowski <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
b4b2aeccf0
commit
a7ee8cf190
1 changed files with 5 additions and 2 deletions
|
|
@ -908,7 +908,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
|
|||
continue;
|
||||
}
|
||||
sk_set_memalloc(sock->sk);
|
||||
sock->sk->sk_sndtimeo = nbd->tag_set.timeout;
|
||||
if (nbd->tag_set.timeout)
|
||||
sock->sk->sk_sndtimeo = nbd->tag_set.timeout;
|
||||
atomic_inc(&config->recv_threads);
|
||||
refcount_inc(&nbd->config_refs);
|
||||
old = nsock->sock;
|
||||
|
|
@ -1077,7 +1078,9 @@ static int nbd_start_device(struct nbd_device *nbd)
|
|||
return -ENOMEM;
|
||||
}
|
||||
sk_set_memalloc(config->socks[i]->sock->sk);
|
||||
config->socks[i]->sock->sk->sk_sndtimeo = nbd->tag_set.timeout;
|
||||
if (nbd->tag_set.timeout)
|
||||
config->socks[i]->sock->sk->sk_sndtimeo =
|
||||
nbd->tag_set.timeout;
|
||||
atomic_inc(&config->recv_threads);
|
||||
refcount_inc(&nbd->config_refs);
|
||||
INIT_WORK(&args->work, recv_work);
|
||||
|
|
|
|||
Loading…
Reference in a new issue