Blame SOURCES/autofs-5.1.6-move-submount-check-into-conditional_alarm_add.patch

49b67f
autofs-5.1.6 - move submount check into conditional_alarm_add()
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
The expire of submounts is driven by the top level autofs mount in the
49b67f
mount tree so an expire alarm doesn't need to set if the autofs point
49b67f
is a submount.
49b67f
49b67f
Take that check into conditional_alarm_add().
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG          |    1 +
49b67f
 daemon/automount.c |    6 ++----
49b67f
 daemon/direct.c    |    3 +--
49b67f
 daemon/indirect.c  |    3 +--
49b67f
 daemon/state.c     |   26 +++++++++-----------------
49b67f
 lib/alarm.c        |    2 ++
49b67f
 lib/mounts.c       |    6 ++----
49b67f
 7 files changed, 18 insertions(+), 29 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -132,6 +132,7 @@ xx/xx/2018 autofs-5.1.5
49b67f
 - use struct mnt_list mounted list for expire.
49b67f
 - remove unused function tree_get_mnt_list().
49b67f
 - only add expre alarm for active mounts.
49b67f
+- move submount check into conditional_alarm_add().
49b67f
 
49b67f
 19/12/2017 autofs-5.1.4
49b67f
 - fix spec file url.
49b67f
--- autofs-5.1.4.orig/daemon/automount.c
49b67f
+++ autofs-5.1.4/daemon/automount.c
49b67f
@@ -1843,8 +1843,7 @@ int handle_mounts_exit(struct autofs_poi
49b67f
 	}
49b67f
 
49b67f
 	if (ap->state != ST_SHUTDOWN) {
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		/* Return to ST_READY is done immediately */
49b67f
 		st_add_task(ap, ST_READY);
49b67f
 		if (ap->submount)
49b67f
@@ -1888,8 +1887,7 @@ int handle_mounts_exit(struct autofs_poi
49b67f
 
49b67f
 	/* Failed shutdown returns to ready */
49b67f
 	warn(ap->logopt, "can't shutdown: filesystem %s still busy", ap->path);
49b67f
-	if (!ap->submount)
49b67f
-		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+	conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 	/* Return to ST_READY is done immediately */
49b67f
 	st_add_task(ap, ST_READY);
49b67f
 	if (ap->submount)
49b67f
--- autofs-5.1.4.orig/daemon/direct.c
49b67f
+++ autofs-5.1.4/daemon/direct.c
49b67f
@@ -1246,8 +1246,7 @@ static void *do_mount_direct(void *arg)
49b67f
 
49b67f
 		mnts_set_mounted_mount(ap, mt.name);
49b67f
 
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 	} else {
49b67f
 		/* TODO: get mount return status from lookup_nss_mount */
49b67f
 		ops->send_fail(ap->logopt,
49b67f
--- autofs-5.1.4.orig/daemon/indirect.c
49b67f
+++ autofs-5.1.4/daemon/indirect.c
49b67f
@@ -754,8 +754,7 @@ static void *do_mount_indirect(void *arg
49b67f
 
49b67f
 		mnts_set_mounted_mount(ap, mt.name);
49b67f
 
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 	} else {
49b67f
 		/* TODO: get mount return status from lookup_nss_mount */
49b67f
 		ops->send_fail(ap->logopt,
49b67f
--- autofs-5.1.4.orig/daemon/state.c
49b67f
+++ autofs-5.1.4/daemon/state.c
49b67f
@@ -154,7 +154,7 @@ void expire_cleanup(void *arg)
49b67f
 			} else if (ap->submount > 1)
49b67f
 				ap->submount = 1;
49b67f
 
49b67f
-			if (ap->state == ST_EXPIRE && !ap->submount)
49b67f
+			if (ap->state == ST_EXPIRE)
49b67f
 				conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 
49b67f
 			/* FALLTHROUGH */
49b67f
@@ -172,8 +172,7 @@ void expire_cleanup(void *arg)
49b67f
 			rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
49b67f
 			if (!rv && !idle && !ap->shutdown) {
49b67f
 				next = ST_READY;
49b67f
-				if (!ap->submount)
49b67f
-					conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+				conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 				break;
49b67f
 			}
49b67f
 
49b67f
@@ -186,8 +185,7 @@ void expire_cleanup(void *arg)
49b67f
 
49b67f
 			/* Failed shutdown returns to ready */
49b67f
 			warn(ap->logopt, "filesystem %s still busy", ap->path);
49b67f
-			if (!ap->submount)
49b67f
-				conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 			next = ST_READY;
49b67f
 			break;
49b67f
 #endif
49b67f
@@ -577,8 +575,7 @@ static unsigned int st_readmap(struct au
49b67f
 		error(ap->logopt, "failed to malloc readmap cond struct");
49b67f
 		/* It didn't work: return to ready */
49b67f
 		st_ready(ap);
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		return 0;
49b67f
 	}
49b67f
 
49b67f
@@ -604,8 +601,7 @@ static unsigned int st_readmap(struct au
49b67f
 		free(ra);
49b67f
 		/* It didn't work: return to ready */
49b67f
 		st_ready(ap);
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		return 0;
49b67f
 	}
49b67f
 	ap->readmap_thread = thid;
49b67f
@@ -640,8 +636,7 @@ static unsigned int st_prepare_shutdown(
49b67f
 	case EXP_ERROR:
49b67f
 	case EXP_PARTIAL:
49b67f
 		/* It didn't work: return to ready */
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		st_ready(ap);
49b67f
 		return 0;
49b67f
 
49b67f
@@ -666,8 +661,7 @@ static unsigned int st_force_shutdown(st
49b67f
 	case EXP_ERROR:
49b67f
 	case EXP_PARTIAL:
49b67f
 		/* It didn't work: return to ready */
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		st_ready(ap);
49b67f
 		return 0;
49b67f
 
49b67f
@@ -699,8 +693,7 @@ static unsigned int st_prune(struct auto
49b67f
 	switch (expire_proc(ap, AUTOFS_EXP_IMMEDIATE)) {
49b67f
 	case EXP_ERROR:
49b67f
 	case EXP_PARTIAL:
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		st_ready(ap);
49b67f
 		return 0;
49b67f
 
49b67f
@@ -720,8 +713,7 @@ static unsigned int st_expire(struct aut
49b67f
 	switch (expire_proc(ap, AUTOFS_EXP_NORMAL)) {
49b67f
 	case EXP_ERROR:
49b67f
 	case EXP_PARTIAL:
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		st_ready(ap);
49b67f
 		return 0;
49b67f
 
49b67f
--- autofs-5.1.4.orig/lib/alarm.c
49b67f
+++ autofs-5.1.4/lib/alarm.c
49b67f
@@ -187,6 +187,8 @@ int conditional_alarm_add(struct autofs_
49b67f
 {
49b67f
 	int status;
49b67f
 
49b67f
+	if (ap->submount)
49b67f
+		return 1;
49b67f
 	if (!mnts_has_mounted_mounts(ap))
49b67f
 		return 1;
49b67f
 
49b67f
--- autofs-5.1.4.orig/lib/mounts.c
49b67f
+++ autofs-5.1.4/lib/mounts.c
49b67f
@@ -1921,8 +1921,7 @@ static int do_remount_direct(struct auto
49b67f
 
49b67f
 		info(ap->logopt, "re-connected to %s", path);
49b67f
 
49b67f
-		if (!ap->submount)
49b67f
-			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+		conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 	} else {
49b67f
 		status = REMOUNT_FAIL;
49b67f
 		info(ap->logopt, "failed to re-connect %s", path);
49b67f
@@ -1997,8 +1996,7 @@ static int do_remount_indirect(struct au
49b67f
 
49b67f
 			info(ap->logopt, "re-connected to %s", buf);
49b67f
 
49b67f
-			if (!ap->submount)
49b67f
-				conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
+			conditional_alarm_add(ap, ap->exp_runfreq);
49b67f
 		} else {
49b67f
 			status = REMOUNT_FAIL;
49b67f
 			info(ap->logopt, "failed to re-connect %s", buf);