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

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