- fix memory leak on reload (bz545137).
This commit is contained in:
parent
48c41bb6bb
commit
89523c070a
72
autofs-5.0.5-fix-memory-leak-on-reload.patch
Normal file
72
autofs-5.0.5-fix-memory-leak-on-reload.patch
Normal file
@ -0,0 +1,72 @@
|
||||
autofs-5.0.5 - fix memory leak on reload
|
||||
|
||||
From: Ian Kent <raven@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) {
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.5
|
||||
Release: 14%{?dist}
|
||||
Release: 16%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
@ -26,6 +26,7 @@ Patch13: autofs-5.0.5-fix-pidof-init-script-usage.patch
|
||||
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@redhat.com> - 1:5.0.5-16
|
||||
- fix memory leak on reload (bz545137).
|
||||
|
||||
* Fri Dec 4 2009 Ian Kent <kpnt@redhat.com> - 1:5.0.5-14
|
||||
- fix rpc fail on large export list (bz543023).
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user