shithub: gefs

Download patch

ref: dffc95b10b789e3cc469a56b37b07e7bb39c1aa6
parent: 46f76ab77132a315d1e6280b1b3a47f6eb5ddd7b
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Nov 6 14:20:56 EST 2022

blk: log free messages before making the block allocatable

this prevents the freed block from becoming part of the free
list before it's recorded as free

--- a/blk.c
+++ b/blk.c
@@ -586,9 +586,9 @@
 
 	r = -1;
 	a = getarena(b);
-	if(freerange(a->free, b, Blksz) == -1)
-		goto out;
 	if(logop(a, b, Blksz, LogFree) == -1)
+		goto out;
+	if(freerange(a->free, b, Blksz) == -1)
 		goto out;
 	a->used -= Blksz;
 	r = 0;