rpms/autofs/devel autofs-5.0.2-hi-res-time.patch, NONE, 1.1 autofs.spec, 1.209, 1.210

Ian Kent (iankent) fedora-extras-commits at redhat.com
Wed Jul 18 09:30:21 UTC 2007


Author: iankent

Update of /cvs/pkgs/rpms/autofs/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25336

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.2-hi-res-time.patch 
Log Message:
* Wed Jul 18 2007 Ian Kent <ikent at redhat.com> - 5.0.2-6
- fix wait time resolution in alarm and state queue handlers (bz 247711).


autofs-5.0.2-hi-res-time.patch:

--- NEW FILE autofs-5.0.2-hi-res-time.patch ---
diff --git a/daemon/state.c b/daemon/state.c
index 6c373c8..39f4497 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -894,6 +894,7 @@ static void *st_queue_handler(void *arg)
 	struct list_head *head;
 	struct list_head *p;
 	struct timespec wait;
+	struct timeval now;
 	int status, ret;
 
 	st_mutex_lock();
@@ -904,8 +905,9 @@ static void *st_queue_handler(void *arg)
 		 * entry is added.
 		 */
 		head = &state_queue;
-		wait.tv_sec = time(NULL) + 1;
-		wait.tv_nsec = 0;
+		gettimeofday(&now, NULL);
+		wait.tv_sec = now.tv_sec + 1;
+		wait.tv_nsec = now.tv_usec * 1000;
 
 		while (list_empty(head)) {
 			status = pthread_cond_timedwait(&cond, &mutex, &wait);
@@ -939,8 +941,9 @@ static void *st_queue_handler(void *arg)
 		}
 
 		while (1) {
-			wait.tv_sec = time(NULL) + 1;
-			wait.tv_nsec = 0;
+			gettimeofday(&now, NULL);
+			wait.tv_sec = now.tv_sec + 1;
+			wait.tv_nsec = now.tv_usec * 1000;
 
 			signaled = 0;
 			while (!signaled) {
diff --git a/lib/alarm.c b/lib/alarm.c
index c6c4ba3..90bf7aa 100755
--- a/lib/alarm.c
+++ b/lib/alarm.c
@@ -192,12 +192,14 @@ static void *alarm_handler(void *arg)
 		now = time(NULL);
 
 		if (first->time > now) {
+			struct timeval usecs;
 			/* 
 			 * Wait for alarm to trigger or a new alarm 
 			 * to be added.
 			 */
+			gettimeofday(&usecs, NULL);
 			expire.tv_sec = first->time;
-			expire.tv_nsec = 0;
+			expire.tv_nsec = usecs.tv_usec * 1000;
 
 			status = pthread_cond_timedwait(&cond, &mutex, &expire);
 			if (status && status != ETIMEDOUT)


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -r1.209 -r1.210
--- autofs.spec	16 Jul 2007 06:27:30 -0000	1.209
+++ autofs.spec	18 Jul 2007 09:29:49 -0000	1.210
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.2
-Release: 5
+Release: 6
 Epoch: 1
 License: GPL
 Group: System Environment/Daemons
@@ -16,6 +16,7 @@
 Patch3: autofs-5.0.2-add-multi-nsswitch-lookup.patch
 Patch4: autofs-5.0.2-fix-offset-dir-create.patch
 Patch5: autofs-5.0.2-quote-exports.patch
+Patch6: autofs-5.0.2-hi-res-time.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
 Conflicts: kernel < 2.6.17
@@ -63,6 +64,7 @@
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -115,6 +117,9 @@
 %{_libdir}/autofs/
 
 %changelog
+* Wed Jul 18 2007 Ian Kent <ikent at redhat.com> - 5.0.2-6
+- fix wait time resolution in alarm and state queue handlers (bz 247711).
+
 * Mon Jul 16 2007 Ian Kent <ikent at redhat.com> - 5.0.2-5
 - fix mount point directory creation for bind mounts.
 - add quoting for exports gathered by hosts map.




More information about the scm-commits mailing list