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