shithub: gefs

Download patch

ref: cb50c004a6b8062439ee685c1707a93b0058f62d
parent: 2025a538a718859f040bfb343761703e9cb184ec
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Apr 26 21:55:01 EDT 2023

blk: lock around log chain grafting

--- a/blk.c
+++ b/blk.c
@@ -1116,7 +1116,7 @@
 		rsleep(&fs->syncrz);
 	for(i = 0; i < fs->narena; i++){
 		a = &fs->arenas[i];
-
+		lock(a);
 		if(a->deferhd.addr != -1){
 			chainlog(a->logtl, a->deferhd.addr);
 			loadlog(a, a->deferhd);
@@ -1124,12 +1124,12 @@
 			a->deferhd = (Bptr){-1, -1, -1};
 			a->defertl = nil;
 		}
-
 		finalize(a->logtl);
 		if(syncblk(a->logtl) == -1)
 			sysfatal("sync arena: %r");
 		if(syncarena(a) == -1)
 			sysfatal("sync arena: %r");
+		unlock(a);
 	}
 	qunlock(&fs->synclk);
 }