Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262976AbTH0Ng5 (ORCPT ); Wed, 27 Aug 2003 09:36:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263150AbTH0Ng5 (ORCPT ); Wed, 27 Aug 2003 09:36:57 -0400 Received: from d12lmsgate-2.de.ibm.com ([194.196.100.235]:47072 "EHLO d12lmsgate.de.ibm.com") by vger.kernel.org with ESMTP id S262976AbTH0Ngz (ORCPT ); Wed, 27 Aug 2003 09:36:55 -0400 Subject: [PATCH] memory leak in sysfs To: mochel@osdl.org Cc: linux-kernel@vger.kernel.org X-Mailer: Lotus Notes Release 5.0.12 February 13, 2003 Message-ID: From: "Thomas Spatzier" Date: Wed, 27 Aug 2003 15:33:24 +0200 X-MIMETrack: Serialize by Router on D12ML041/12/M/IBM(Release 5.0.9a |January 7, 2002) at 27/08/2003 15:37:03 MIME-Version: 1.0 Content-type: multipart/mixed; Boundary="0__=4EBBE71CDFDA98698f9e8a93df938690918c4EBBE71CDFDA9869" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4412 Lines: 74 --0__=4EBBE71CDFDA98698f9e8a93df938690918c4EBBE71CDFDA9869 Content-type: text/plain; charset=us-ascii Hello Patrick, please verify the following patch. We found a memory leak in sysfs. Entries in the dentry_cache allocated for objects in sysfs are not freed when the objects in sysfs are deleted. This effect is due to inconsistent reference counting in sysfs. Furthermore, when calling sysfs_remove_dir the deleted directory was not removed from its parent's list of children. The attached patch should fix the problems. (See attached file: linux-2.6.0-test3-sysfs.patch) Best regards, Thomas --0__=4EBBE71CDFDA98698f9e8a93df938690918c4EBBE71CDFDA9869 Content-type: application/octet-stream; name="linux-2.6.0-test3-sysfs.patch" Content-Disposition: attachment; filename="linux-2.6.0-test3-sysfs.patch" Content-transfer-encoding: base64 ZGlmZiAtdXJOIGxpbnV4LTIuNS9mcy9zeXNmcy9iaW4uYyBsaW51eC0y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BE71CDFDA98698f9e8a93df938690918c4EBBE71CDFDA9869-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/