Received: from mnm [127.0.0.1]
	by localhost with POP3 (fetchmail-5.9.0)
	for akpm@localhost (single-drop); Tue, 09 Mar 2004 23:41:04 -0800 (PST)
Received: from fire-2.osdl.org (air1.pdx.osdl.net [172.20.0.5])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i2A7V1E26897
	for <akpm@mail.gateway.osdl.net>; Tue, 9 Mar 2004 23:31:01 -0800
Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.104])
	by fire-2.osdl.org (8.12.8/8.12.8) with ESMTP id i2A7Uw5q007057
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL)
	for <akpm@osdl.org>; Tue, 9 Mar 2004 23:31:00 -0800
Received: from northrelay02.pok.ibm.com (northrelay02.pok.ibm.com [9.56.224.150])
	by e4.ny.us.ibm.com (8.12.10/8.12.2) with ESMTP id i2A7UqG9748752;
	Wed, 10 Mar 2004 02:30:52 -0500
Received: from bigbang.in.ibm.com (d01av02.pok.ibm.com [9.56.224.216])
	by northrelay02.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id i2A7Um4l078202;
	Wed, 10 Mar 2004 02:30:50 -0500
Received: by bigbang.in.ibm.com (Postfix, from userid 500)
	id 0FE681C734; Wed, 10 Mar 2004 02:35:51 -0500 (EST)
Date: Wed, 10 Mar 2004 13:05:51 +0530
From: Maneesh Soni <maneesh@in.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Greg KH <greg@kroah.com>
Subject: [PATCH] sysfs_remove_subdir-dentry-leak-fix.patch
Message-ID: <20040310073551.GA1251@in.ibm.com>
Reply-To: maneesh@in.ibm.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4.1i
X-MIMEDefang-Filter: osdl$Revision: 1.55 $
X-Scanned-By: MIMEDefang 2.36
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on mnm
X-Spam-Level: 
X-Spam-Status: No, hits=-4.9 required=2.0 tests=BAYES_00 autolearn=ham 
	version=2.60

Hello Andrew,

The current sysfs_remove_subdir-dentry-leak-fix.patch in -mm tree is buggy. It
seems to still leak dentry in case of un-named attribute group 
(grp->name == NULL). I request you to please replace it with the following 
patch.


Thanks
Maneesh


o The following patch fixes the dentry refcounting, during sysfs_create_group()
  sysfs_remove_group() 
  

 fs/sysfs/group.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -puN fs/sysfs/group.c~sysfs_remove_subdir-dentry-leak-fix fs/sysfs/group.c
--- linux-2.6.4-rc2-mm1/fs/sysfs/group.c~sysfs_remove_subdir-dentry-leak-fix	2004-03-10 11:54:07.000000000 +0530
+++ linux-2.6.4-rc2-mm1-maneesh/fs/sysfs/group.c	2004-03-10 11:54:33.000000000 +0530
@@ -55,8 +55,8 @@ int sysfs_create_group(struct kobject * 
 	if ((error = create_files(dir,grp))) {
 		if (grp->name)
 			sysfs_remove_subdir(dir);
-		dput(dir);
 	}
+	dput(dir);
 	return error;
 }
 
@@ -68,12 +68,13 @@ void sysfs_remove_group(struct kobject *
 	if (grp->name)
 		dir = sysfs_get_dentry(kobj->dentry,grp->name);
 	else
-		dir = kobj->dentry;
+		dir = dget(kobj->dentry);
 
 	remove_files(dir,grp);
-	dput(dir);
 	if (grp->name)
 		sysfs_remove_subdir(dir);
+	/* release the ref. taken in this routine */
+	dput(dir);
 }
 
 

_
-- 
Maneesh Soni
Linux Technology Center, 
IBM Software Lab, Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-25044999 Fax: 91-80-25268553
T/L : 9243696