summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-20 15:22:24 +0200
committerSimon Rettberg2021-04-20 15:22:24 +0200
commit046d3878b760f17e534752541368f97497eceda2 (patch)
tree60ef37e9d60446925513a854459a2cc933cfb72e
parent[KERNEL] Clean alt-server list first when connecting (diff)
downloaddnbd3-046d3878b760f17e534752541368f97497eceda2.tar.gz
dnbd3-046d3878b760f17e534752541368f97497eceda2.tar.xz
dnbd3-046d3878b760f17e534752541368f97497eceda2.zip
[KERNEL] Even more RTT fakery on manual server switch
-rw-r--r--src/kernel/blk.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/kernel/blk.c b/src/kernel/blk.c
index 21c49a8..82469f4 100644
--- a/src/kernel/blk.c
+++ b/src/kernel/blk.c
@@ -238,12 +238,19 @@ static int dnbd3_blk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
}
} else {
/* switch succeeded */
- /* fake very low RTT so we don't switch away again soon */
+ /* fake RTT so we don't switch away again soon */
mutex_lock(&dev->alt_servers_lock);
- if (is_same_server(&alt_server->host, &new_addr)) {
- alt_server->rtts[0] = alt_server->rtts[1] = alt_server->rtts[2]
- = alt_server->rtts[3] = 4;
- alt_server->best_count = 100;
+ for (i = 0; i < NUMBER_SERVERS; ++i) {
+ alt_server = &dev->alt_servers[i];
+ if (is_same_server(&alt_server->host, &new_addr)) {
+ alt_server->rtts[0] = alt_server->rtts[1] = alt_server->rtts[2]
+ = alt_server->rtts[3] = 4;
+ alt_server->best_count = 100;
+ } else {
+ alt_server->rtts[0] <<= 2;
+ alt_server->rtts[2] <<= 2;
+ alt_server->best_count = 0;
+ }
}
mutex_unlock(&dev->alt_servers_lock);
}