On Tue, 2023-03-21 at 12:44 +1100, NeilBrown wrote: > > > Hi, > I've been playing with automount and recently tried "kill -1" to get > it > to re-read the config file. It crashed. > > Crash happens in try_remount(). > > if (MM_PARENT(me)->key[0] == '/') { > > MM_PARENT() is NULL. > My guess is that MM_PARENT() is only non-NULL for offset mounts and > the > breakage was introduced in > Commit ba9fe0a (\"autofs-5.1.8 - fix incorrect path for is_mounted() > in try_remount()\") > > The very latest patch. > Prior to this patch it would only try MM_PARENT when type == > t_offset. > Now it always accesses it. Yes, I saw that. In fact I have 35-40 unpublished (mostly) cleanup patches in my patch queue. I'm pretty sure this is ok for a fix. autofs-5.1.8 - fix mount tree startup reconnect From: Ian Kent <raven@xxxxxxxxxx> When reconnecting to an existing mount tree at startup trying to work out if we created the mountpoint directory uses the parent path of the current map entry. But if the current map entry has no parent we should use the map entry path. Signed-off-by: Ian Kent <raven@xxxxxxxxxx> --- CHANGELOG | 1 + lib/mounts.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 45fd9dde..1eab3d53 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -69,6 +69,7 @@ - add command pipe handling functions. - switch to application wide command pipe. - get rid of unused field submnt_count. +- fix mount tree startup reconnect. 19/10/2021 autofs-5.1.8 - add xdr_exports(). diff --git a/lib/mounts.c b/lib/mounts.c index ec28e2bc..8778caf1 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -2807,6 +2807,7 @@ static int remount_active_mount(struct autofs_point *ap, int try_remount(struct autofs_point *ap, struct mapent *me, unsigned int type) { struct ioctl_ops *ops = get_ioctl_ops(); + struct mapent *mapent; const char *path; int ret, fd; dev_t devid; @@ -2841,12 +2842,13 @@ int try_remount(struct autofs_point *ap, struct mapent *me, unsigned int type) } me->flags &= ~MOUNT_FLAG_DIR_CREATED; + mapent = IS_MM(me) ? MM_PARENT(me) : me; /* Direct or offset mount, key is full path */ - if (MM_PARENT(me)->key[0] == '/') { - if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL)) + if (mapent->key[0] == '/') { + if (!is_mounted(mapent->key, MNTS_REAL)) me->flags |= MOUNT_FLAG_DIR_CREATED; } else { - char *p_key = MM_PARENT(me)->key; + char *p_key = mapent->key; char mp[PATH_MAX + 1]; int len;