ref: 57de8f55572c5063225032f9a020fdf5df48f2de
parent: 54309f1cb25e5a65b834dab0e5ff711be3d812d1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Apr 28 02:55:06 EDT 2014
devmnt: make abandoning fid on botched clunk handle flushes make mntflushfree() return the original rpc and do the botched clunk check on the original instead of the current rpc. so if we get a botched flush of a clunk, we abandon the fid of the channel as well.
--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -58,7 +58,7 @@
Mnt* mntchk(Chan*);
void mntdirfix(uchar*, Chan*);
Mntrpc* mntflushalloc(Mntrpc*, ulong);
-void mntflushfree(Mnt*, Mntrpc*);
+Mntrpc* mntflushfree(Mnt*, Mntrpc*);
void mntfree(Mntrpc*);
void mntgate(Mnt*);
void mntqrm(Mnt*, Mntrpc*);
@@ -777,6 +777,7 @@
if(m->rip == up)
mntgate(m);
if(strcmp(up->errstr, Eintr) != 0){+ r = mntflushfree(m, r);
switch(r->request.type){case Tremove:
case Tclunk:
@@ -784,7 +785,6 @@
if(strcmp(up->errstr, Ehungup) != 0)
r->c->fid = 0;
}
- mntflushfree(m, r);
nexterror();
}
r = mntflushalloc(r, m->msize);
@@ -1007,9 +1007,9 @@
* flush and the original message from the unanswered
* request queue. Mark the original message as done
* and if it hasn't been answered set the reply to to
- * Rflush.
+ * Rflush. Return the original rpc.
*/
-void
+Mntrpc*
mntflushfree(Mnt *m, Mntrpc *r)
{Mntrpc *fr;
@@ -1020,10 +1020,12 @@
r->reply.type = Rflush;
mntqrm(m, r);
}
- if(fr)
- mntfree(r);
+ if(fr == nil)
+ break;
+ mntfree(r);
r = fr;
}
+ return r;
}
int
--
⑨