autofs-5.0.3 - don't close direct root From: Ian Kent <raven@themaw.net> For direct mount multi-mounts with no real mount at their base we need to leave the file handle open so they will be expired. This patch corrects the check done at mount completion to do this so they will be expired. --- daemon/direct.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- autofs-5.0.1.orig/daemon/direct.c +++ autofs-5.0.1/daemon/direct.c @@ -1306,8 +1306,17 @@ static void *do_mount_direct(void *arg) !master_find_submount(ap, mt.name))) close_fd = 1; cache_writelock(mt.mc); - if (!close_fd && (me = cache_lookup_distinct(mt.mc, mt.name))) - me->ioctlfd = mt.ioctlfd; + if ((me = cache_lookup_distinct(mt.mc, mt.name))) { + /* + * Careful here, we need to leave the file handle open + * for direct mount multi-mounts with no real mount at + * their base so they will be expired. + */ + if (close_fd && me == me->multi) + close_fd = 0; + if (!close_fd) + me->ioctlfd = mt.ioctlfd; + } send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token); cache_unlock(mt.mc); if (close_fd)