- fix fd leak at multi-mount non-fatal mount fail.

- fix incorrect multi-mount mountpoint calcualtion.
This commit is contained in:
Ian Kent 2008-09-26 06:07:00 +00:00
parent 50a4d88ce0
commit 883768c8fc
3 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,39 @@
autofs-5.0.3 - fix fd leak at multi-mount fail
From: Ian Kent <raven@themaw.net>
Fix file handle being left open following a multi-mount non-fatal mount
fail.
---
daemon/direct.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/daemon/direct.c b/daemon/direct.c
index 13f572c..b94601a 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1303,12 +1303,20 @@ static void *do_mount_direct(void *arg)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
if (status) {
struct mapent *me;
+ struct statfs fs;
+ unsigned int close_fd = 0;
+
+ if (statfs(mt.name, &fs) == -1 ||
+ (fs.f_type == AUTOFS_SUPER_MAGIC &&
+ !master_find_submount(ap, mt.name)))
+ close_fd = 1;
cache_writelock(mt.mc);
- me = cache_lookup_distinct(mt.mc, mt.name);
- if (me)
+ if (!close_fd && (me = cache_lookup_distinct(mt.mc, mt.name)))
me->ioctlfd = mt.ioctlfd;
send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
cache_unlock(mt.mc);
+ if (close_fd)
+ close(mt.ioctlfd);
info(ap->logopt, "mounted %s", mt.name);
} else {
send_fail(ap->logopt, mt.ioctlfd, mt.wait_queue_token);

View File

@ -0,0 +1,32 @@
autofs-5.0.3 - fix incorrect multi-mount mountpoint
From: Ian Kent <raven@themaw.net>
Fix case where an incorrect mount point path was being used when
mounting a multi-mount component.
---
modules/parse_sun.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 333f8a5..5a39113 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -1248,8 +1248,14 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
return 1;
}
} else if (rv < 0) {
+ char *mm_root_base = alloca(strlen(mm_root) + strlen(mm_base) + 1);
+
move = MOUNT_MOVE_NONE;
- ret = mount_multi_triggers(ap, me->multi, mm_root, start, mm_base);
+
+ strcpy(mm_root_base, mm_root);
+ strcat(mm_root_base, mm_base);
+
+ ret = mount_multi_triggers(ap, me->multi, mm_root_base, start, mm_base);
if (ret == -1) {
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");

View File

@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.3
Release: 23
Release: 25
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -57,6 +57,8 @@ Patch44: autofs-5.0.3-mtab-as-proc-mounts-fix.patch
Patch45: autofs-5.0.3-handle-zero-length-nis-key-update.patch
Patch46: autofs-5.0.3-fix-ifc-buff-size-fix-2.patch
Patch47: autofs-5.0.3-check-for-kernel-automount-fix.patch
Patch48: autofs-5.0.3-fix-fd-leak-at-multi-mount-fail.patch
Patch49: autofs-5.0.3-fix-incorrect-multi-mount-mountpoint.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs
Requires: kernel >= 2.6.17
@ -145,6 +147,8 @@ echo %{version}-%{release} > .version
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -197,6 +201,10 @@ fi
%{_libdir}/autofs/
%changelog
* Fri Sep 26 2008 Ian Kent <ikent@redhat.com> - 5.0.3-25
- fix fd leak at multi-mount non-fatal mount fail.
- fix incorrect multi-mount mountpoint calcualtion.
* Fri Sep 19 2008 Ian Kent <ikent@redhat.com> - 5.0.3-23
- add upstream bug fixes
- bug fix for mtab check.