From: Jan Kara <jack@suse.cz>
To: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
npiggin@kernel.dk, a.p.zijlstra@chello.nl
Subject: Re: [bug] radix_tree_gang_lookup_tag_slot() looping endlessly
Date: Thu, 19 Aug 2010 17:58:39 +0200 [thread overview]
Message-ID: <20100819155838.GB3295@quack.suse.cz> (raw)
In-Reply-To: <20100819132552.GU10429@dastard>
Hi Dave,
On Thu 19-08-10 23:25:52, Dave Chinner wrote:
> It looks to me like radix_tree_set_tag_if_tagged() is fundamentally
> broken. All the tag set/clear code stores the tree path in a cursor
> and uses that to propagate the tags if and only if the full path
> from root to leaf is resolved. radix_tree_set_tag_if_tagged() sets
> tags on intermediate nodes before it has resolved the full path and
> hence can set tags when it should not. The "should not" cases occur
> when we have to tag sub-ranges or the scan aborts because it's
> reached the number ot tag in a batch.
Thanks for debugging this! You are right that the code can leave dangling
tag when we end the scan at the end of given range but the first tagged
leaf is after the end of the given range (there shouldn't be a problem with
the batches because there we can exit only just after we tag a leaf so that
should be OK).
There are two possibilities how to fix the bug:
a) Always tag bottom up - i.e., when we see leaf that should be tagged, go
up and tag the parent as well if it is not already tagged.
b) When we exit the search and we didn't not set any leaf tag since last
time we went down, we walk up the tree and do an equivalent of
radix_tree_clear_tag().
I'll probably go for a) since it looks more robust but b) would be
probably faster.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-08-19 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 13:56 [bug] radix_tree_gang_lookup_tag_slot() looping endlessly Dave Chinner
2010-08-18 17:37 ` Jan Kara
2010-08-18 23:29 ` Dave Chinner
2010-08-19 7:25 ` Dave Chinner
2010-08-19 13:25 ` Dave Chinner
2010-08-19 15:58 ` Jan Kara [this message]
2010-08-19 22:25 ` Dave Chinner
2010-08-20 2:04 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100819155838.GB3295@quack.suse.cz \
--to=jack@suse.cz \
--cc=a.p.zijlstra@chello.nl \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@kernel.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).