diff --git a/daemon/state.c b/daemon/state.c index d5eca8b..2fa78aa 100644 --- a/daemon/state.c +++ b/daemon/state.c @@ -190,10 +190,10 @@ void expire_cleanup(void *arg) if (next != ST_INVAL) nextstate(statefd, next); - state_mutex_unlock(ap); - st_set_done(ap); + state_mutex_unlock(ap); + return; } @@ -326,11 +326,10 @@ static void do_readmap_cleanup(void *arg) state_mutex_lock(ap); nextstate(ap->state_pipe[1], ST_READY); + st_set_done(ap); state_mutex_unlock(ap); - st_set_done(ap); - if (!ap->submount) alarm_add(ap, ap->exp_runfreq); @@ -480,10 +479,6 @@ static unsigned int st_readmap(struct autofs_point *ap) assert(ap->state == ST_READY); assert(ap->readmap_thread == 0); - /* Turn off timeouts for this mountpoint */ - if (!ap->submount) - alarm_delete(ap); - ap->state = ST_READMAP; ra = malloc(sizeof(struct readmap_args)); @@ -549,10 +544,6 @@ static unsigned int st_prepare_shutdown(struct autofs_point *ap) debug(ap->logopt, "state %d path %s", ap->state, ap->path); - /* Turn off timeouts for this mountpoint */ - if (!ap->submount) - alarm_delete(ap); - assert(ap->state == ST_READY || ap->state == ST_EXPIRE); ap->state = ST_SHUTDOWN_PENDING; @@ -579,10 +570,6 @@ static unsigned int st_force_shutdown(struct autofs_point *ap) debug(ap->logopt, "state %d path %s", ap->state, ap->path); - /* Turn off timeouts for this mountpoint */ - if (!ap->submount) - alarm_delete(ap); - assert(ap->state == ST_READY || ap->state == ST_EXPIRE); ap->state = ST_SHUTDOWN_FORCE; @@ -610,10 +597,6 @@ static unsigned int st_prune(struct autofs_point *ap) assert(ap->state == ST_READY); ap->state = ST_PRUNE; - /* Turn off timeouts while we prune */ - if (!ap->submount) - alarm_delete(ap); - switch (expire_proc(ap, 1)) { case EXP_ERROR: case EXP_PARTIAL: @@ -635,10 +618,6 @@ static unsigned int st_expire(struct autofs_point *ap) assert(ap->state == ST_READY); ap->state = ST_EXPIRE; - /* Turn off timeouts while we expire */ - if (!ap->submount) - alarm_delete(ap); - switch (expire_proc(ap, 0)) { case EXP_ERROR: case EXP_PARTIAL: @@ -723,7 +702,7 @@ int st_add_task(struct autofs_point *ap, enum states state) empty = 0; /* Don't add duplicate tasks */ - if (task->state == state || + if ((task->state == state && !task->done) || (ap_state == ST_SHUTDOWN_PENDING || ap_state == ST_SHUTDOWN_FORCE)) break; @@ -888,6 +867,7 @@ static void st_set_thid(struct autofs_point *ap, pthread_t thid) return; } +/* Requires state mutex to be held */ static void st_set_done(struct autofs_point *ap) { struct list_head *p, *head;