- fix deadlock in alarm manager module.

This commit is contained in:
Ian Kent 2007-06-07 07:52:23 +00:00
parent c373ac6ae8
commit d35ca7c13d
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,66 @@
diff --git a/lib/alarm.c b/lib/alarm.c
index e0e6fd4..4a72605 100755
--- a/lib/alarm.c
+++ b/lib/alarm.c
@@ -168,7 +168,6 @@ void alarm_delete(struct autofs_point *ap)
static void *alarm_handler(void *arg)
{
struct list_head *head;
- struct autofs_point *ap;
struct timespec expire;
time_t now;
int status;
@@ -192,10 +191,11 @@ static void *alarm_handler(void *arg)
current = list_entry(head->next, struct alarm, list);
- ap = current->ap;
now = time(NULL);
if (current->time <= now) {
+ struct autofs_point *ap;
+
list_del(&current->list);
if (current->cancel) {
@@ -203,11 +203,15 @@ static void *alarm_handler(void *arg)
continue;
}
+ ap = current->ap;
+ free(current);
+ alarm_unlock();
+
state_mutex_lock(ap);
nextstate(ap->state_pipe[1], ST_EXPIRE);
state_mutex_unlock(ap);
- free(current);
+ alarm_lock();
continue;
}
@@ -215,6 +219,7 @@ static void *alarm_handler(void *arg)
expire.tv_nsec = 0;
while (1) {
+ struct autofs_point *ap;
struct alarm *next;
status = pthread_cond_timedwait(&cond, &mutex, &expire);
@@ -232,12 +237,15 @@ static void *alarm_handler(void *arg)
break;
list_del(&current->list);
+ ap = current->ap;
free(current);
+ alarm_unlock();
state_mutex_lock(ap);
nextstate(ap->state_pipe[1], ST_EXPIRE);
state_mutex_unlock(ap);
+ alarm_lock();
break;
}
}

View File

@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.1
Release: 12
Release: 14
Epoch: 1
License: GPL
Group: System Environment/Daemons
@ -29,6 +29,7 @@ Patch16: autofs-5.0.1-disable-exports-check.patch
Patch17: autofs-5.0.1-cmd-global-options-fix.patch
Patch18: autofs-5.0.1-allow-dot-in-master-macro.patch
Patch19: autofs-5.0.1-correct-logic-test-wild-lookup.patch
Patch20: autofs-5.0.1-alarm-deadlock.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
@ -89,6 +90,7 @@ echo %{version}-%{release} > .version
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -141,6 +143,9 @@ fi
%{_libdir}/autofs/
%changelog
* Thu Jun 7 2007 Ian Kent <ikent@redhat.com> - 5.0.1-14
- fix deadlock in alarm manager module.
* Sun Jun 3 2007 Ian Kent <ikent@redhat.com> - 5.0.1-12
- correct mistake in logic test in wildcard lookup.