From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [rfc][patch] store-free path walking Date: Fri, 9 Oct 2009 12:08:12 +0200 Message-ID: <20091009100812.GV9228@kernel.dk> References: <20091006122623.GE30316@wotan.suse.de> <20091006124941.GS5216@kernel.dk> <20091007085849.GN30316@wotan.suse.de> <20091008123622.GA30316@wotan.suse.de> <20091008125746.GL9228@kernel.dk> <20091008132200.GB30316@wotan.suse.de> <20091009085451.GS9228@kernel.dk> <20091009095119.GT9228@kernel.dk> <20091009100249.GD17818@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org, Ravikiran G Thirumalai , Peter Zijlstra , chris.mason@oracle.com To: Nick Piggin Return-path: Content-Disposition: inline In-Reply-To: <20091009100249.GD17818@wotan.suse.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Oct 09 2009, Nick Piggin wrote: > On Fri, Oct 09, 2009 at 11:51:19AM +0200, Jens Axboe wrote: > > Nick, > > > > One more thing... I see you converted part of btrfs, but there's still > > this one sitting in btrfs_invalidate_inodes() > > > > if (atomic_read(&inode->i_count) > 1) > > d_prune_aliases(inode); > > > > Not sure how best to solve that, with a __d_prune_aliases() that assumed > > the lock was held it would be easy. But perhaps you have better ideas, > > this email is more of a heads-up since perhaps you missed this spot > > (CC'ing Chris). > > It's OK, you can load inode->i_count integer atomically -- in this > sequence d_prune_aliases can't have assumed anything about i_count > anyway because regardless of its type it might have changed in > between. Right, it was already racy wrt i_count. So the below should be OK. diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d3dadb6..7e02b5d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3419,8 +3419,10 @@ again: inode = igrab(&entry->vfs_inode); if (inode) { spin_unlock(&root->inode_lock); - if (atomic_read(&inode->i_count) > 1) + + if (inode->i_count > 1) d_prune_aliases(inode); + /* * btrfs_drop_inode will remove it from * the inode cache when its usage count -- Jens Axboe