ref: bfd636c4beff968fb3d246cf36ebb6853ef5d509
parent: 775be16fc1f2ce15cdf58c273c29cf4dba14cdad
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Nov 5 21:21:17 EDT 2022
fs: don't leak flush messages we can get multiple flushes, and we only need to respond to the most recent one.
--- a/fs.c
+++ b/fs.c
@@ -1959,12 +1959,16 @@
void
fsflush(Fmsg *m)
{
+ Fmsg *o;
Fcall r;
lock(&fs->mflushlk);
- if(fs->mflush[m->oldtag] != nil)
- fs->mflush[m->oldtag]->flush = m;
- else{
+ o = fs->mflush[m->oldtag];
+ if(o != nil){
+ if(o->flush != nil)
+ free(o->flush);
+ o->flush = m;
+ }else{
r.type = Rflush;
respond(m, &r);
}
@@ -2033,7 +2037,7 @@
/* both */
case Topen:
- if(m->mode & OTRUNC)
+ if((m->mode & OTRUNC) || (m->mode & 0xf) == OEXEC)
chsend(fs->wrchan, m);
else