Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751452Ab0HTIAp (ORCPT ); Fri, 20 Aug 2010 04:00:45 -0400 Received: from ipmail06.adl2.internode.on.net ([150.101.137.129]:48629 "EHLO ipmail06.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849Ab0HTIAm (ORCPT ); Fri, 20 Aug 2010 04:00:42 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAEvQbUx5Ld90/2dsb2JhbACgWnK6eIU3BA Date: Fri, 20 Aug 2010 18:00:39 +1000 From: Nick Piggin To: Dave Chinner Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, jack@suse.cz, npiggin@kernel.dk Subject: Re: [PATCH 1/2] radix-tree: clear all tags in radix_tree_node_rcu_free Message-ID: <20100820080039.GB3777@amd> References: <1282281727-15088-1-git-send-email-david@fromorbit.com> <1282281727-15088-2-git-send-email-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1282281727-15088-2-git-send-email-david@fromorbit.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2058 Lines: 57 On Fri, Aug 20, 2010 at 03:22:06PM +1000, Dave Chinner wrote: > From: Dave Chinner > > Commit f446daaea9d4a420d16c606f755f3689dcb2d0ce ("mm: implement > writeback livelock avoidance using page tagging") introduced a new > radix tree tag, increasing the number of tags in each node from 2 to > 3. It did not, however, fix up the code in > radix_tree_node_rcu_free() that cleans up after radix_tree_shrink() > and hence could leave stray tags set in the new tag array. > > The result is that the livelock avoidance code added in the the > above commit would hit stale tags when doing tag based lookups, > resulting in livelocks when trying to traverse the tree. > > Fix this problem in radix_tree_node_rcu_free() so it doesn't happen > again in the future by using a loop to walk all the tags up to > RADIX_TREE_MAX_TAGS to clear the stray tags radix_tree_shrink() > leaves behind. > > Signed-off-by: Dave Chinner Acked-by: Nick Piggin > --- > lib/radix-tree.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/radix-tree.c b/lib/radix-tree.c > index e907858..1014171 100644 > --- a/lib/radix-tree.c > +++ b/lib/radix-tree.c > @@ -174,14 +174,16 @@ static void radix_tree_node_rcu_free(struct rcu_head *head) > { > struct radix_tree_node *node = > container_of(head, struct radix_tree_node, rcu_head); > + int i; > > /* > * must only free zeroed nodes into the slab. radix_tree_shrink > * can leave us with a non-NULL entry in the first slot, so clear > * that here to make sure. > */ > - tag_clear(node, 0, 0); > - tag_clear(node, 1, 0); > + for (i = 0; i < RADIX_TREE_MAX_TAGS; i++) > + tag_clear(node, i, 0); > + > node->slots[0] = NULL; > node->count = 0; > > -- > 1.7.1 -- 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/