mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
9pfuse: fix memory leak, avoid memory explosion
Change is to handle FUSE_FORGET in main loop instead of separate thread for each as 10s of thousands can come in at once. Fixes issue 104. R=0intro, rsc http://codereview.appspot.com/6498081
This commit is contained in:
parent
ba31102633
commit
d4ccb0a943
2 changed files with 12 additions and 2 deletions
|
@ -35,6 +35,7 @@ Rob Kroeger <robkroeger@gmail.com>
|
|||
Rob Pike <robpike@gmail.com>
|
||||
Russ Cox <rsc@swtch.com>
|
||||
Sean McKean <smckean83@gmail.com>
|
||||
Ties Bos <gitbisector@gmail.com>
|
||||
Tim Newsham <tim.newsham@gmail.com>
|
||||
Tony Lainson <t.lainson@gmail.com>
|
||||
Venkatesh Srinivas <extrudedaluminiu@gmail.com>
|
||||
|
|
|
@ -257,6 +257,7 @@ allocfh(CFid *fid)
|
|||
{
|
||||
return _alloc(fid, 0);
|
||||
}
|
||||
|
||||
uvlong
|
||||
allocnodeid(CFid *fid)
|
||||
{
|
||||
|
@ -412,6 +413,7 @@ fuseforget(FuseMsg *m)
|
|||
fprint(2, "bad count in forget\n");
|
||||
ff->ref = 1;
|
||||
freefusefid(ff);
|
||||
freefusemsg(m);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1255,8 +1257,15 @@ fusedispatch(void *v)
|
|||
fusehandlers[fuselist[i].op] = fuselist[i].fn;
|
||||
}
|
||||
|
||||
while((m = recvp(fusechan)) != nil)
|
||||
threadcreate(fusethread, m, STACK);
|
||||
while((m = recvp(fusechan)) != nil) {
|
||||
switch(m->hdr->opcode) {
|
||||
case FUSE_FORGET:
|
||||
fusehandlers[m->hdr->opcode](m);
|
||||
break;
|
||||
default:
|
||||
threadcreate(fusethread, m, STACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
|
|
Loading…
Reference in a new issue