Re: [Patch]Memory leak in sysfs

From: Adam J. Richter
Date: Fri Dec 10 2004 - 10:16:50 EST


Zou, Nanhai wrote:
>Some stress testes show there is a memory leak in the latest kernel.
>I found the memory leak is in sysfs.
>Here is a patch against 2.6.10-rc2-mm4 to fix that.
>
>Signed-off-by: Zou Nan hai <Nanhai.Zou@xxxxxxxxx>
>
>["sysfs-memleak-fix.patch" (application/octet-stream)]
>
>diff -Nraup a/fs/sysfs/dir.c b/fs/sysfs/dir.c
>--- a/fs/sysfs/dir.c 2004-12-06 13:04:56.000000000 +0800
>+++ b/fs/sysfs/dir.c 2004-12-07 16:49:36.000000000 +0800
>@@ -349,6 +349,7 @@ static int sysfs_dir_close(struct inode
>
> down(&dentry->d_inode->i_sem);
> list_del_init(&cursor->s_sibling);
>+ sysfs_put(cursor);
> up(&dentry->d_inode->i_sem);
>
> return 0;


This is will be fixed when the patch that I posted
at http://marc.theaimsgroup.com/?l=linux-kernel&m=110204311025022&w=2
is applied (that patch calls release_sysfs_dirent, since there
is no need for the reference counting of sysfs_put in this case).
I believe that Greg had already indicated he was going to forward
that patch to Linus (without the BUG_ON statement in my patch, which
is fine with me).

__ ______________
Adam J. Richter \ /
adam@xxxxxxxxxxxxx | g g d r a s i l
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/