File autofs-5-1-1-define-pending-condition-init-helper-function.patch of Package autofs.14028

From: Yu Ning <>
Subject: autofs-5.1.1 - define pending condition init helper function
Git-repo: git://
Git-commit: 90517499f624476f3aa58322b0ddcca5e9b8699a
Patch-mainline: 5.1.2
References: bsc#1046493

The time returned by gettimeofday() is affected by discontinuous jumps
in the system time, so it causes an issue that autofs may not auto
unmount a mount point if system time is manually changed by the system

To fix the issue we need to convert to using a monotonic clock source
instead of the clock source used by gettimeofday().

We also want to use a monotonic clock source for the condition wait
of both the direct and indirect mount thread creation as well the
expire thread creation of each. So create a common helper function
to initialize a condition variable to use a monotonic clock source.

Signed-off-by: Yu Ning <>
Signed-off-by: Ian Kent <>
Acked-by: Jeff Mahoney <>
 include/automount.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

--- a/include/automount.h
+++ b/include/automount.h
@@ -395,6 +395,27 @@ struct pending_args {
+static void pending_cond_init(void *arg)
+	struct pending_args *mt = (struct pending_args *) arg;
+	pthread_condattr_t condattrs;
+	int status;
+	status = pthread_condattr_init(&condattrs);
+	if (status)
+		fatal(status);
+	status = pthread_condattr_setclock(&condattrs, CLOCK_MONOTONIC);
+	if (status)
+		fatal(status);
+	status = pthread_cond_init(&mt->cond, &condattrs);
+	if (status)
+		fatal(status);
+	pthread_condattr_destroy(&condattrs);
 static void pending_cond_destroy(void *arg)
 	struct pending_args *mt = (struct pending_args *) arg;
openSUSE Build Service is sponsored by