nbd: handle interrupted sendmsg with a sndtimeo set
authorJosef Bacik <jbacik@fb.com>
Tue, 24 Oct 2017 19:57:18 +0000 (15:57 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 25 Oct 2017 00:50:59 +0000 (18:50 -0600)
commit32e67a3a06b88904155170560b7a63d372b320bd
treeb51b63e136dec5ffeb42af6c68fe866b719fbd6d
parent875397464a55dd750198f799626959ad4cf45563
nbd: handle interrupted sendmsg with a sndtimeo set

If you do not set sk_sndtimeo you will get -ERESTARTSYS if there is a
pending signal when you enter sendmsg, which we handle properly.
However if you set a timeout for your commands we'll set sk_sndtimeo to
that timeout, which means that sendmsg will start returning -EINTR
instead of -ERESTARTSYS.  Fix this by checking either cases and doing
the correct thing.

Cc: stable@vger.kernel.org
Fixes: dc88e34d69d8 ("nbd: set sk->sk_sndtimeo for our sockets")
Reported-and-tested-by: Daniel Xu <dlxu@fb.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c