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

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