ref: 42b86431edeed372635a23fc6b22b7b04e015669
parent: fa22219b828a9b33ee050ac1697aef0764c5b9b3
author: Ori Bernstein <[email protected]>
date: Mon Dec 25 18:14:53 EST 2023
mutlk: hold mutation lock for all of the io in the sync operation
--- a/fs.c
+++ b/fs.c
@@ -2343,6 +2343,10 @@
ainc(&fs->rdonly);
break;
}
+
+ if(am->halt)
+ ainc(&fs->rdonly);
+ qlock(&fs->mutlk);
for(i = 0; i < fs->narena; i++){
a = &fs->arenas[i];
qlock(a);
@@ -2361,10 +2365,10 @@
epochend(id);
epochclean();
}
- if(am->halt)
- ainc(&fs->rdonly);
+ qunlock(&fs->mutlk);
sync();
+ qlock(&fs->mutlk);
for(i = 0; i < fs->narena; i++){
for(bp = oldhd[i]; bp.addr != -1; bp = nb){
epochstart(id);
@@ -2377,6 +2381,8 @@
epochclean();
}
}
+ qunlock(&fs->mutlk);
+
if(am->halt){
postnote(PNGROUP, getpid(), "halted");
exits(nil);