From: NeilBrown Date: Mon, 28 Jun 2010 22:04:45 +0000 (+1000) Subject: Handle write clusters which point to themselves. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=c58401feb3963f050151a5fa0eb60ed48068f4c2;p=LaFS.git Handle write clusters which point to themselves. This can happen at the end of a cleaner segment, and in general it is best to be cautious. So if the next pointer isn't further along in this segment, don't follow it. Signed-off-by: NeilBrown --- diff --git a/clean.c b/clean.c index dcf4b20..95e2eaa 100644 --- a/clean.c +++ b/clean.c @@ -327,8 +327,8 @@ static int try_clean(struct fs *fs, struct toclean *tc) /* Finished with that cluster, try another. */ u64 next; next = le64_to_cpu(tc->ch->next_addr); - if (in_seg(fs, tc->dev, tc->seg, next)) { - BUG_ON(next <= tc->haddr); + if (next > tc->haddr && + in_seg(fs, tc->dev, tc->seg, next)) { tc->haddr = next; tc->ac.state = 1; } else {