ref: 06853fdba8929b1b049514207369fd8513693f64
parent: 7f8f7c4e79284a1d6657869d4b219efaf1118492
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Nov 7 01:15:14 EST 2023
fs: lock arena list on sync
--- a/fs.c
+++ b/fs.c
@@ -2237,8 +2237,10 @@
if(am->halt)
ainc(&fs->rdonly);
epochstart(id);
+ lock(&fs->mountlk);
for(mnt = fs->mounts; mnt != nil; mnt = mnt->next)
updatesnap(&mnt->root, mnt->root, mnt->name);
+ unlock(&fs->mountlk);
sync();
epochend(id);
epochclean();
--- a/tree.c
+++ b/tree.c
@@ -1413,14 +1413,15 @@
if(s->done)
return nil;
- s->ht = t->ht;
- if((s->path = calloc(t->ht, sizeof(Scanp))) == nil)
+ if((b = getroot(t, &s->ht)) == nil)
+ return Eio;
+ if((s->path = calloc(s->ht, sizeof(Scanp))) == nil){
+ dropblk(b);
return Enomem;
+ }
p = s->path;
- if((b = getblk(t->bp, 0)) == nil)
- return Eio;
p[0].b = b;
- for(i = 0; i < t->ht; i++){
+ for(i = 0; i < s->ht; i++){
p[i].vi = blksearch(b, &s->kv, &v, &same);
if(b->type == Tpivot){
if(p[i].vi == -1)