File 0002-Fix-monotonic_elapsed.patch of Package autofs.23455
From 4af750d2b48190c6d52fda1ce96c2cc86cd14d51 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Mon, 29 Jan 2018 18:06:21 +1100
Subject: [PATCH] Fix monotonic_elapsed.
When automount probes multiple hosts to find the one which
responds most quickly, it currently ignores the nanoseconds.
This often makes the cost "0", which makes weights ineffective.
The cause is that monotonic_elapsed() casts tv_nsec to a
double *after* dividing by 1 billion, rather than before.
With this change, weights become effective for choosing
between hosts which respond in under one second.
Signed-off-by: NeilBrown <neilb@suse.com>
---
lib/rpc_subs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -1078,9 +1078,9 @@ double monotonic_elapsed(struct timespec
double t1, t2;
t1 = (double) start.tv_sec +
- (double) (start.tv_nsec/(1000*1000*1000));
+ ((double) start.tv_nsec/(1000*1000*1000));
t2 = (double) end.tv_sec +
- (double) (end.tv_nsec/(1000*1000*1000));
+ ((double) end.tv_nsec/(1000*1000*1000));
return t2 - t1;
}