]> git.neil.brown.name Git - LaFS.git/commitdiff
Handle write clusters which point to themselves.
authorNeilBrown <neilb@suse.de>
Mon, 28 Jun 2010 22:04:45 +0000 (08:04 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 28 Jun 2010 22:22:55 +0000 (08:22 +1000)
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 <neilb@suse.de>
clean.c

diff --git a/clean.c b/clean.c
index dcf4b2026f2919399e8554ee4c609d2861f1c51a..95e2eaa5ad0f270fb89b04957625290c188ec299 100644 (file)
--- 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 {