changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: devmnt: handle rpc buffer exhaustion on mntflushalloc()

changeset 4231: 5cc0ae0ee525
parent 4230: 772adc4423b0
child 4232: df4df0500dba
author: cinap_lenrek@felloff.net
date: Tue, 27 Jan 2015 22:14:26 +0100
files: sys/src/9/port/devmnt.c
description: devmnt: handle rpc buffer exhaustion on mntflushalloc()

this bug happens when the kernel runs out of mount rpc
buffers when allocating a flush rpc. in this case, mntflushalloc()
will errorjump out of mountio() leaving the currently in
flight rpc in the mount. the caller of mountrpc()/mountio()
frees the rpc thats still queued in the mount leaving
to interesting results.

for the fix, we add a waserror() arround mntflushalloc() and
handle the error case like a mount rpc failure which will
properly dequeue the rpc's in flight.
     1.1--- a/sys/src/9/port/devmnt.c
     1.2+++ b/sys/src/9/port/devmnt.c
     1.3@@ -774,7 +774,7 @@ mountio(Mnt *m, Mntrpc *r)
     1.4 	while(waserror()) {
     1.5 		if(m->rip == up)
     1.6 			mntgate(m);
     1.7-		if(strcmp(up->errstr, Eintr) != 0){
     1.8+		if(strcmp(up->errstr, Eintr) != 0 || waserror()){
     1.9 			r = mntflushfree(m, r);
    1.10 			switch(r->request.type){
    1.11 			case Tremove:
    1.12@@ -786,6 +786,7 @@ mountio(Mnt *m, Mntrpc *r)
    1.13 			nexterror();
    1.14 		}
    1.15 		r = mntflushalloc(r, m->msize);
    1.16+		poperror();
    1.17 	}
    1.18 
    1.19 	lock(m);