rpms/autofs/F-12 autofs-5.0.5-fix-memory-leak-on-reload.patch, NONE, 1.1 autofs.spec, 1.295, 1.296

Ian Kent iankent at fedoraproject.org
Tue Dec 8 02:56:29 UTC 2009


Author: iankent

Update of /cvs/pkgs/rpms/autofs/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8840

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.5-fix-memory-leak-on-reload.patch 
Log Message:
* Tue Dec 8 2009 Ian Kent <kpnt at redhat.com> - 1:5.0.5-17
- fix memory leak on reload (bz545137).


autofs-5.0.5-fix-memory-leak-on-reload.patch:
 CHANGELOG    |    1 +
 lib/master.c |   17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

--- NEW FILE autofs-5.0.5-fix-memory-leak-on-reload.patch ---
autofs-5.0.5 - fix memory leak on reload

From: Ian Kent <raven at themaw.net>

When sending a signal to the automount daemon to re-load the maps a map
entry cache is pre-allocated before checking if the entry already exists.
If the master map entry was found to exist the pre-allocated cache was
not being freed.

If there are a large number of entries in the master map and there are
frequent re-load requests sent to the daemon the memory leak will cause
the system to become unstable fairly quilkly.

Since the map entry cache (allocated for each map entry) is fairly large
these days (and is configurable) pre-allocating it is no longer a cheap
operation. This patch fixes the memory leak and only allocates a map
entry cache if the entry does not already exist.
---

 CHANGELOG    |    1 +
 lib/master.c |   17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 20566a6..df2ec09 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@
 - check for path mount location in generic module.
 - dont fail mount on access fail.
 - fix rpc fail on large export list.
+- fix memory leak on reload.
 
 03/09/2009 autofs-5.0.5
 -----------------------
diff --git a/lib/master.c b/lib/master.c
index 8455f40..83019aa 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -190,9 +190,15 @@ master_add_map_source(struct master_mapent *entry,
 
 	master_source_writelock(entry);
 
-	if (!entry->maps)
+	if (!entry->maps) {
+		source->mc = cache_init(entry->ap, source);
+		if (!source->mc) {
+			master_free_map_source(source, 0);
+			master_source_unlock(entry);
+			return NULL;
+		}
 		entry->maps = source;
-	else {
+	} else {
 		struct map_source *this, *last, *next;
 
 		/* Typically there only a few map sources */
@@ -205,6 +211,13 @@ master_add_map_source(struct master_mapent *entry,
 			return this;
 		}
 
+		source->mc = cache_init(entry->ap, source);
+		if (!source->mc) {
+			master_free_map_source(source, 0);
+			master_source_unlock(entry);
+			return NULL;
+		}
+
 		last = NULL;
 		next = entry->maps;
 		while (next) {


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-12/autofs.spec,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -p -r1.295 -r1.296
--- autofs.spec	3 Dec 2009 02:38:48 -0000	1.295
+++ autofs.spec	8 Dec 2009 02:56:29 -0000	1.296
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.5
-Release: 15%{?dist}
+Release: 17%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -26,6 +26,7 @@ Patch13: autofs-5.0.5-fix-pidof-init-scr
 Patch14: autofs-5.0.5-check-for-path-mount-location-in-generic-module.patch
 Patch15: autofs-5.0.5-dont-fail-mount-on-access-fail.patch
 Patch16: autofs-5.0.5-fix-rpc-large-export-list.patch
+Patch17: autofs-5.0.5-fix-memory-leak-on-reload.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 libtirpc-devel
 Requires: kernel >= 2.6.17
@@ -83,6 +84,7 @@ echo %{version}-%{release} > .version
 %patch14 -p1
 %patch15 -p1
 %patch16 -p1
+%patch17 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -135,6 +137,9 @@ fi
 %{_libdir}/autofs/
 
 %changelog
+* Tue Dec 8 2009 Ian Kent <kpnt at redhat.com> - 1:5.0.5-17
+- fix memory leak on reload (bz545137).
+
 * Thu Dec 3 2009 Ian Kent <kpnt at redhat.com> - 1:5.0.5-15
 - fix rpc fail on large export list (bz543023).
 




More information about the fedora-extras-commits mailing list