ref: 674086d9ed1009b5378e4358d5bf888a4f987dca
parent: 821f716f5d2851e636b927561241318cc5a21fbd
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Jan 10 17:56:55 EST 2024
snap: fix block leak on dl append
--- a/fs.c
+++ b/fs.c
@@ -392,14 +392,14 @@
static void
truncwait(Dent *de, int id)
{
+ epochend(id);
qunlock(&fs->mutlk);
qlock(&de->trunclk);
- epochend(id);
while(de->trunc)
rsleep(&de->truncrz);
- epochstart(id);
qunlock(&de->trunclk);
qlock(&fs->mutlk);
+ epochstart(id);
}
static int
--- a/snap.c
+++ b/snap.c
@@ -17,6 +17,7 @@
return;
traceb("dlflush", dl->ins->bp);
enqueue(dl->ins);
+ dropblk(dl->ins);
dl->ins = nil;
m.op = Oinsert;
dlist2kv(dl, &m, kvbuf, sizeof(kvbuf));
@@ -560,8 +561,10 @@
}
if(dl->ins == nil || Logspc - dl->ins->logsz < Logslop){
b = newblk(&fs->snap, Tdlist, 0);
- if(dl->ins != nil)
+ if(dl->ins != nil){
enqueue(dl->ins);
+ dropblk(dl->ins);
+ }
if(dl->tl.addr == -1)
dl->tl = b->bp;
b->logp = dl->hd;