hjfs: fix potential deadlock in putloc()
This commit is contained in:
parent
b9bf9f1d54
commit
84ddc4cd4b
|
@ -428,11 +428,17 @@ putloc(Fs *fs, Loc *l, int loop)
|
||||||
while(loop && l != nil && l->ref <= 1){
|
while(loop && l != nil && l->ref <= 1){
|
||||||
freeit:
|
freeit:
|
||||||
if((l->flags & LGONE) != 0){
|
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);
|
b = getbuf(fs->d, l->blk, TDENTRY, 0);
|
||||||
if(b != nil){
|
if(b != nil){
|
||||||
delete(fs, l, b);
|
delete(fs, l, b);
|
||||||
putbuf(b);
|
putbuf(b);
|
||||||
}
|
}
|
||||||
|
qlock(&fs->loctree);
|
||||||
}
|
}
|
||||||
l->cnext->cprev = l->cprev;
|
l->cnext->cprev = l->cprev;
|
||||||
l->cprev->cnext = l->cnext;
|
l->cprev->cnext = l->cnext;
|
||||||
|
|
Loading…
Reference in a new issue