ref: 84ddc4cd4b0fae049f9fa68ee586fbc53cfa2f83
parent: b9bf9f1d547fe819d87d7dbb2ec58bd0b53d711a
author: cinap_lenrek <[email protected]>
date: Fri Nov 16 14:55:58 EST 2012
hjfs: fix potential deadlock in putloc()
--- a/sys/src/cmd/hjfs/fs1.c
+++ b/sys/src/cmd/hjfs/fs1.c
@@ -428,11 +428,17 @@
while(loop && l != nil && l->ref <= 1){
freeit:
if((l->flags & LGONE) != 0){
+ /*
+ * safe to unlock here, the file is gone and
+ * we'r the last reference.
+ */
+ qunlock(&fs->loctree);
b = getbuf(fs->d, l->blk, TDENTRY, 0);
if(b != nil){
delete(fs, l, b);
putbuf(b);
}
+ qlock(&fs->loctree);
}
l->cnext->cprev = l->cprev;
l->cprev->cnext = l->cnext;