Blame SOURCES/autofs-5.1.4-fix-monotonic_elapsed.patch

aea863
autofs-5.1.4 - fix monotonic_elapsed
aea863
aea863
From: NeilBrown <neilb@suse.com>
aea863
aea863
When automount probes multiple hosts to find the one which
aea863
responds most quickly, it currently ignores the nanoseconds.
aea863
This often makes the cost "0", which makes weights ineffective.
aea863
aea863
The cause is that monotonic_elapsed() casts tv_nsec to a
aea863
double *after* dividing by 1 billion, rather than before.
aea863
aea863
With this change, weights become effective for choosing
aea863
between hosts which respond in under one second.
aea863
aea863
Signed-off-by: NeilBrown <neilb@suse.com>
aea863
Signed-off-by: Ian Kent <raven@themaw.net>
aea863
---
aea863
 CHANGELOG      |    1 +
aea863
 lib/rpc_subs.c |    4 ++--
aea863
 2 files changed, 3 insertions(+), 2 deletions(-)
aea863
aea863
diff --git a/CHANGELOG b/CHANGELOG
aea863
index 104fca90..313730b1 100644
aea863
--- a/CHANGELOG
aea863
+++ b/CHANGELOG
aea863
@@ -10,6 +10,7 @@ xx/xx/2018 autofs-5.1.5
aea863
 - add error handling for ext_mount_add().
aea863
 - account for recent libnsl changes.
aea863
 - use_hostname_for_mounts shouldn't prevent selection among replicas.
aea863
+- fix monotonic_elapsed.
aea863
 
aea863
 19/12/2017 autofs-5.1.4
aea863
 - fix spec file url.
aea863
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
aea863
index 73097c9d..60ede9f8 100644
aea863
--- a/lib/rpc_subs.c
aea863
+++ b/lib/rpc_subs.c
aea863
@@ -1093,9 +1093,9 @@ double monotonic_elapsed(struct timespec start, struct timespec end)
aea863
 	double t1, t2;
aea863
 
aea863
 	t1 =  (double) start.tv_sec +
aea863
-		(double) (start.tv_nsec/(1000*1000*1000));
aea863
+		((double) start.tv_nsec/(1000*1000*1000));
aea863
 	t2 =  (double) end.tv_sec +
aea863
-		(double) (end.tv_nsec/(1000*1000*1000));
aea863
+		((double) end.tv_nsec/(1000*1000*1000));
aea863
 	return t2 - t1;
aea863
 }
aea863