autofs-5.0.3 - wait submount expire complete From: Ian Kent When expiring a submount expires away and proceeds to shutdown we can reach the end of the expire of the parent before the submount goes away. This can cause an incomplete expire during shutdown in some cases so, for the case the submount goes to state ST_SHUTDOWN, we need to wait until the submount either goes away or fails to shutdown before continuing. --- CHANGELOG | 1 + lib/master.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 23680bc..1377d89 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,7 @@ - fix map out of order map re-read on hup signal. - fix nisplus error return check and use after free error. - fix rootless direct multi-mount expire. +- wait submount expire thread completion. 14/01/2008 autofs-5.0.3 ----------------------- diff --git a/lib/master.c b/lib/master.c index 13302f1..ce5b987 100644 --- a/lib/master.c +++ b/lib/master.c @@ -870,6 +870,29 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state st_wait_task(this, state, 0); + /* + * If our submount gets to state ST_SHUTDOWN we need to + * wait until it goes away or changes to ST_READY. + */ + mounts_mutex_lock(ap); + st_mutex_lock(); + while ((this = __master_find_submount(ap, path))) { + struct timespec t = { 0, 300000000 }; + struct timespec r; + + if (this->state != ST_SHUTDOWN) + break; + + st_mutex_unlock(); + mounts_mutex_unlock(ap); + while (nanosleep(&t, &r) == -1 && errno == EINTR) + memcpy(&t, &r, sizeof(struct timespec)); + mounts_mutex_lock(ap); + st_mutex_lock(); + } + st_mutex_unlock(); + mounts_mutex_unlock(ap); + return ret; }