autofs/autofs-5.0.3-fix-rootless-direct-multi-mount-expire.patch
Ian Kent d55e640fa8 - don't close file handle for rootless direct mounti-mount at mount.
- wait submount expire thread completion when expire successful.
- add inadvertantly ommitted server list locking in LDAP module.
2008-10-23 03:24:17 +00:00

37 lines
1.1 KiB
Diff

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.3.orig/daemon/direct.c
+++ autofs-5.0.3/daemon/direct.c
@@ -1311,8 +1311,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)