6bbd11
autofs-5.0.8 - fix symlink expire
6bbd11
6bbd11
From: Ian Kent <raven@themaw.net>
6bbd11
6bbd11
The expire code uses the list of mounts to decide if additional expire
6bbd11
check requests should be sent to the kernel. This doesn't take into
6bbd11
account the possibility there could be symlinks that might be able to
6bbd11
be expired.
6bbd11
6bbd11
count_mounts() does count symlinks so use that only when working out
6bbd11
how many expire requests should be sent.
6bbd11
---
6bbd11
 CHANGELOG         |    1 +
6bbd11
 daemon/indirect.c |   22 ++++++++++------------
6bbd11
 2 files changed, 11 insertions(+), 12 deletions(-)
6bbd11
6bbd11
--- autofs-5.0.7.orig/CHANGELOG
6bbd11
+++ autofs-5.0.7/CHANGELOG
6bbd11
@@ -86,6 +86,7 @@
6bbd11
 - fix undefined authtype_requires_creds err if ldap enabled but without sasl.
6bbd11
 - pass map_source as function paramter where possible.
6bbd11
 - check for bind onto self in mount_bind.c.
6bbd11
+- fix symlink expire.
6bbd11
 
6bbd11
 25/07/2012 autofs-5.0.7
6bbd11
 =======================
6bbd11
--- autofs-5.0.7.orig/daemon/indirect.c
6bbd11
+++ autofs-5.0.7/daemon/indirect.c
6bbd11
@@ -388,6 +388,7 @@ void *expire_proc_indirect(void *arg)
6bbd11
 	struct expire_args ec;
6bbd11
 	unsigned int now;
6bbd11
 	int offsets, submnts, count;
6bbd11
+	int retries;
6bbd11
 	int ioctlfd, cur_state;
6bbd11
 	int status, ret, left;
6bbd11
 
6bbd11
@@ -533,20 +534,17 @@ void *expire_proc_indirect(void *arg)
6bbd11
 
6bbd11
 	/*
6bbd11
 	 * If there are no more real mounts left we could still
6bbd11
-	 * have some offset mounts with no '/' offset so we need to
6bbd11
-	 * umount them here.
6bbd11
+	 * have some offset mounts with no '/' offset or symlinks
6bbd11
+	 * so we need to umount or unlink them here.
6bbd11
 	 */
6bbd11
-	if (mnts) {
6bbd11
-		int retries;
6bbd11
-		pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
-		retries = (count_mounts(ap->logopt, ap->path, ap->dev) + 1);
6bbd11
-		while (retries--) {
6bbd11
-			ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now);
6bbd11
-			if (ret)
6bbd11
-				left++;
6bbd11
-		}
6bbd11
-		pthread_setcancelstate(cur_state, NULL);
6bbd11
+	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
+	retries = (count_mounts(ap->logopt, ap->path, ap->dev) + 1);
6bbd11
+	while (retries--) {
6bbd11
+		ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now);
6bbd11
+		if (ret)
6bbd11
+			left++;
6bbd11
 	}
6bbd11
+	pthread_setcancelstate(cur_state, NULL);
6bbd11
 	pthread_cleanup_pop(1);
6bbd11
 
6bbd11
 	count = offsets = submnts = 0;