Bug#372618: Fwd: Bug#372618: mdadm --monitor consumes much memory
and idle cpu
Neil Brown
neilb at suse.de
Sun Jun 11 09:49:32 UTC 2006
On Saturday June 10, madduck at debian.org wrote:
>
> Neil, this one should be of interest to you. Please reply to
> 372618 at bugs.debian.org (reply-to set).
>
> ----- Forwarded message from Elimar Riesebieter <riesebie at lxtec.de> -----
>
...
>
> The memory and cpu consumption grows up to around 50% running
> /sbin/mdadm --monitor --pid-file /var/run/mdadm.pid --mail root
> --daemonise --scan
>
Yeah, thanks...
See patch.
NeilBrown
Fix memory leak in monitor mode
When rescanning /dev, we didn't free the old list.
Also don't search for device with a number of 0,0
Signed-off-by: Neil Brown <neilb at suse.de>
### Diffstat output
./util.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff ./util.c~current~ ./util.c
--- ./util.c~current~ 2006-06-11 19:48:02.000000000 +1000
+++ ./util.c 2006-06-11 19:39:27.000000000 +1000
@@ -416,10 +416,23 @@ char *map_dev(int major, int minor, int
struct devmap *p;
char *std = NULL, *nonstd=NULL;
int did_check = 0;
+
+ if (major == 0 && minor == 0) {
+ if (!create)
+ return NULL;
+ else
+ return "0:0";
+ }
retry:
if (!devlist_ready) {
char *dev = "/dev";
struct stat stb;
+ while(devlist) {
+ struct devmap *d = devlist;
+ devlist = d->next;
+ free(d->name);
+ free(d);
+ }
if (lstat(dev, &stb)==0 &&
S_ISLNK(stb.st_mode))
dev = "/dev/.";
More information about the pkg-mdadm-devel
mailing list