aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2017-07-25 13:31:19 -0400
committerJens Axboe <axboe@kernel.dk>2017-07-25 15:58:34 -0400
commit7a362ea96d0df873397be04f4556e92f7e37c5ec (patch)
tree5e781d1f34127a19e16f72be4b901a9c1582e8e5
parent76451d79bde6bed17e113f057e58e1fa5fb79e78 (diff)
nbd: clear disconnected on reconnect
If our device loses its connection for longer than the dead timeout we will set NBD_DISCONNECTED in order to quickly fail any pending IO's that flood in after the IO's that were waiting during the dead timer. However if we re-connect at some point in the future we'll still see this DISCONNECTED flag set if we then lose our connection again after that, which means we won't get notifications for our newly lost connections. Fix this by just clearing the DISCONNECTED flag on reconnect in order to make sure everything works as it's supposed to. Reported-by: Dan Melnic <dmm@fb.com> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/nbd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 64b19b10b739..5bdf923294a5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -923,6 +923,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
923 mutex_unlock(&nsock->tx_lock); 923 mutex_unlock(&nsock->tx_lock);
924 sockfd_put(old); 924 sockfd_put(old);
925 925
926 clear_bit(NBD_DISCONNECTED, &config->runtime_flags);
927
926 /* We take the tx_mutex in an error path in the recv_work, so we 928 /* We take the tx_mutex in an error path in the recv_work, so we
927 * need to queue_work outside of the tx_mutex. 929 * need to queue_work outside of the tx_mutex.
928 */ 930 */