ref: 73c79144626a3f34a719f920845de2982cf52ce0
parent: 413a40efbd10773e06efd6833efea42c920f7d2d
author: Michael Forney <[email protected]>
date: Mon Feb 14 07:32:16 EST 2022
fs: take reference to tree before lookup Otherwise, the tree may get replaced after we look at the current mount root, and the old tree destroyed while we are in btlookup.
--- a/fs.c
+++ b/fs.c
@@ -208,10 +208,12 @@
rlock(f->dent);
lock(f->mnt);
r = f->mnt->root;
+ ainc(&r->memref);
unlock(f->mnt);
e = btlookup(r, k, kv, buf, nbuf);
if(lk)
runlock(f->dent);
+ closesnap(r);
return e;
}