summaryrefslogtreecommitdiff
path: root/sys/src/cmd/hjfs
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-11-16 19:55:58 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-11-16 19:55:58 +0100
commit84ddc4cd4b0fae049f9fa68ee586fbc53cfa2f83 (patch)
tree69478f1742dba03544ffc7ca41b8dac574764d57 /sys/src/cmd/hjfs
parentb9bf9f1d547fe819d87d7dbb2ec58bd0b53d711a (diff)
hjfs: fix potential deadlock in putloc()
Diffstat (limited to 'sys/src/cmd/hjfs')
-rw-r--r--sys/src/cmd/hjfs/fs1.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/src/cmd/hjfs/fs1.c b/sys/src/cmd/hjfs/fs1.c
index b059a39ff..e7a116ba8 100644
--- a/sys/src/cmd/hjfs/fs1.c
+++ b/sys/src/cmd/hjfs/fs1.c
@@ -428,11 +428,17 @@ putloc(Fs *fs, Loc *l, int loop)
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;