From: Andrew Morton Subject: Re: [PATCH] ext3 [linux-2.6.2.]: accessing already freed inodes when under memory pressure Date: Tue, 24 Feb 2004 14:55:18 -0800 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040224145518.4cbb9b57.akpm@osdl.org> References: <200402191321.39592.cotte@freenet.de> <20040220164325.659c4e45.akpm@osdl.org> <200402241338.57855.cotte@freenet.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: cotte@freenet.de, sct@redhat.com, torvalds@osdl.org, linux-fsdevel@vger.kernel.org, schwidefsky@de.ibm.com, cotte@de.ibm.com Return-path: Received: from fw.osdl.org ([65.172.181.6]:47813 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S262516AbUBXWxk (ORCPT ); Tue, 24 Feb 2004 17:53:40 -0500 To: Carsten Otte In-Reply-To: <200402241338.57855.cotte@freenet.de> List-Id: linux-fsdevel.vger.kernel.org Carsten Otte wrote: > > Am Samstag 21 Februar 2004 01:43 schrieb Andrew Morton: > > Could you chage it so we generate a backtrace in iput() if the inode has an > > i_count of one (the dentry) and it is still on the orphan list? > > I did change iput() to the following: > void iput(struct inode *inode) > { > if (inode) { > struct super_operations *op = inode->i_sb->s_op; > > if (inode->i_state == I_CLEAR) > BUG(); > > if (op && op->put_inode) > op->put_inode(inode); > > if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) > iput_final(inode); > if (atomic_read(&inode->i_count) == 1) > if (!strcmp(inode->i_sb->s_type->name, "ext3")) { > struct ext3_inode_info *ext3_i; > ext3_i = container_of(inode, > struct ext3_inode_info, > vfs_inode); > if (!list_empty(&ext3_i->i_orphan)) > WARN_ON(1); > } > } > } atomic_dec_and_lock() decrements i_count, so this warning will be triggered by people calling iput() with an orphan inode which has a refcount of 2, not of 1. Please change the if (atomic_read(&inode->i_count) == 1) to if (atomic_read(&inode->i_count) == 0) Thanks.