autofs-5.0.8 - fix symlink expire From: Ian Kent The expire code uses the list of mounts to decide if additional expire check requests should be sent to the kernel. This doesn't take into account the possibility there could be symlinks that might be able to be expired. count_mounts() does count symlinks so use that only when working out how many expire requests should be sent. --- CHANGELOG | 1 + daemon/indirect.c | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3bd9c04..d419737 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -24,6 +24,7 @@ - fix cache readlock not taken on lookup. - pass map_source as function paramter where possible. - check for bind onto self in mount_bind.c. +- fix symlink expire. 17/10/2013 autofs-5.0.8 ======================= diff --git a/daemon/indirect.c b/daemon/indirect.c index f4476dc..d872175 100644 --- a/daemon/indirect.c +++ b/daemon/indirect.c @@ -388,6 +388,7 @@ void *expire_proc_indirect(void *arg) struct expire_args ec; unsigned int now; int offsets, submnts, count; + int retries; int ioctlfd, cur_state; int status, ret, left; @@ -533,20 +534,17 @@ void *expire_proc_indirect(void *arg) /* * If there are no more real mounts left we could still - * have some offset mounts with no '/' offset so we need to - * umount them here. + * have some offset mounts with no '/' offset or symlinks + * so we need to umount or unlink them here. */ - if (mnts) { - int retries; - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); - retries = (count_mounts(ap->logopt, ap->path, ap->dev) + 1); - while (retries--) { - ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now); - if (ret) - left++; - } - pthread_setcancelstate(cur_state, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); + retries = (count_mounts(ap->logopt, ap->path, ap->dev) + 1); + while (retries--) { + ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now); + if (ret) + left++; } + pthread_setcancelstate(cur_state, NULL); pthread_cleanup_pop(1); count = offsets = submnts = 0;