ref: 212df701f94618c47177f756409bd72976667b68
parent: e159d02fe024d5bbf02b68209197ce58acd655e4
author: Michael Forney <[email protected]>
date: Tue Feb 22 02:55:31 EST 2022
tree: calculate hash of new root before updating root pointer Otherwise, we end up with the previous hash in t->bp.hash, not the new one. This leads to corrupt block errors when we try to load the filesystem again.
--- a/tree.c
+++ b/tree.c
@@ -1152,6 +1152,7 @@
memmove(p+2, p, 2*(nbuf+i-ri));
PBIT16(p, o);
}
+ enqueue(r);
lock(&t->lk);
t->bp = r->bp;
t->dirty = 1;
@@ -1158,7 +1159,6 @@
unlock(&t->lk);
freeblk(t, b);
- enqueue(r);
putblk(b);
putblk(r);
return nil;