shithub: gefs

Download patch

ref: 6ae68dc6ae8464e75692031c085e39fc0b2a9435
parent: f63d327c4223b5e02226c2a843da81c9ba42871a
author: Ori Bernstein <[email protected]>
date: Sat Oct 23 19:56:45 EDT 2021

blk: possibly fix entry reuse

--- a/blk.c
+++ b/blk.c
@@ -563,8 +563,15 @@
 	b->bp.addr = bp;
 	b->bp.hash = -1;
 	b->bp.gen = fs->nextgen;
-	b->ref = 0;	/* cacheblk incremnets */
 	b->data = b->buf + Hdrsz;
+
+	b->ref = 0;	/* cacheblk incremnets */
+	b->nval = 0;
+	b->valsz = 0;
+	b->nbuf = 0;
+	b->bufsz = 0;
+	b->logsz = 0;
+	b->lognxt = 0;
 	return cacheblk(b);
 }
 
--- a/tree.c
+++ b/tree.c
@@ -812,8 +812,9 @@
 	if(p->idx == -1)
 		return 0;
 	if(pp != nil){
-		if((m = refblk(pp->n)) == nil)
+		if((m = pp->n) == nil)
 			return 0;
+		refblk(m);
 	}else{
 		if((m = getblk(km.bp, 0)) == nil)
 			return -1;