ref: 06b1071dd423ba683f7e0d05fe365f57ad01752e
parent: 7bb45c4535df55709863e60008b3615feb6447bb
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 28 11:38:22 EST 2025
gefs: fix double-deadlist of block Because we can have blocks in-flight with gen==memgen, which both sides of the fork can free, we need to make sure that we don't deadlist them in the new snapshot. As a result, we need to use memgen, and not gen, in order to prevent the potential for a double deadlisting and subsequent free .
--- a/sys/src/cmd/gefs/snap.c
+++ b/sys/src/cmd/gefs/snap.c
@@ -408,8 +408,16 @@
n->ht = t->ht;
n->bp = t->bp;
n->succ = -1;
+ /*
+ * Because we can have blocks in-flight with gen==memgen,
+ * which both sides of the fork can free, we need to make
+ * sure that we don't deadlist them in the new snapshot.
+ *
+ * As a result, we need to use memgen, and not gen, in
+ * order to prevent the potential for a double free.
+ */
n->pred = t->gen;
- n->base = t->gen;
+ n->base = t->memgen;
n->gen = fs->nextgen++;
n->memgen = fs->nextgen++;
--
⑨