diff --git a/CHANGELOG b/CHANGELOG index 24d9872..c625ec7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,7 @@ - note: if this is needed use only the map name and configure the URI entry in the ldap client configuration. - correct mistake in logic test in wildcard lookup. +- fix deadlock in alarm manager module. 20/2/2007 autofs-5.0.1 ---------------------- 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(¤t->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(¤t->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; } }