]> git.neil.brown.name Git - LaFS.git/commitdiff
Make sure last segment allocated is properly registered in table
authorNeilBrown <neilb@suse.de>
Sat, 10 Jul 2010 11:42:34 +0000 (21:42 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 10 Jul 2010 11:42:34 +0000 (21:42 +1000)
otherwise bad things happen when we try to de-register it.

Signed-off-by: NeilBrown <neilb@suse.de>
segments.c

index 2f1961d2bc7a2022cfda22f289cba1d01cbcc830..d9b7a8b06c1b39dfc6d927ffffa771938cb339f0 100644 (file)
@@ -1091,9 +1091,16 @@ again:
                /* FIXME should more generally delay the update if we
                 * are in any checkpoint.
                 */
+
+               /* FIXME avoid this code duplication?? see below */
+               fs->segtrack->free.first = ss->next;
+               if (fs->segtrack->free.first == 0xFFFF)
+                       fs->segtrack->free.last = 0xFFFF;
+               fs->segtrack->free.cnt--;
+               ss->score = SCORE_ACTIVE;
+               /* still in table, but unlinked */
                spin_unlock(&fs->lock);
-               if (db)
-                       putdref(db, MKREF(youth));
+               putdref(db, MKREF(youth));
                return;
        }