From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Brown Subject: Re: Race between generic_forget_inode() and sync_sb_inodes()? Date: Fri, 30 Nov 2007 09:07:06 +1100 Message-ID: <18255.14346.684631.944181@notabene.brown> References: <20071129215544.GK115527101@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: lkml , linux-fsdevel To: David Chinner Return-path: Received: from ns2.suse.de ([195.135.220.15]:50399 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762711AbXK2WHN (ORCPT ); Thu, 29 Nov 2007 17:07:13 -0500 In-Reply-To: message from David Chinner on Friday November 30 Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi David, On Friday November 30, dgc@sgi.com wrote: > > > I came across this because I've been making changes to XFS to avoid the > inode hash, and I've found that I need to remove the inode from the > dirty list when setting I_WILL_FREE to avoid this race. I can't see > how this race is avoided when inodes are hashed, so I'm wondering > if we've just been lucky or there's something that I'm missing that > means the above does not occur. Looking at inode.c in 2.6.23-mm1, in generic_forget_inode, I see code: if (!hlist_unhashed(&inode->i_hash)) { if (!(inode->i_state & (I_DIRTY|I_SYNC))) list_move(&inode->i_list, &inode_unused); so it looks to me like: If the inode is hashed and dirty, then move it (off the s_dirty list) to inode_unused. So it seems to me that generic_forget_inode also finds it needs to remove the inode from the dirty list when setting I_WILL_FREE. Maybe we are looking at different kernel versions? Maybe I misunderstood your problem? NeilBrown