ref: f99b9cae6a3dc5775a83b264d6041be8d5d416d6
parent: fe393882506834722eda40d94289133366f5a210
author: cinap_lenrek <[email protected]>
date: Sun Mar 8 14:23:07 EDT 2020
devshr: unmount service on #σc/share/mount removal when the control mountpoint side gets removed, close mount channel immediately. this is usefull for implementing automatic cleanup with ORCLOSE create mode.
--- a/sys/src/9/port/devshr.c
+++ b/sys/src/9/port/devshr.c
@@ -554,6 +554,7 @@
Sch *sch;
Mpt *mpt;
Mhead *h;
+ Chan *bc;
sch = tosch(c);
if(waserror()){
@@ -593,6 +594,7 @@
qunlock(&shrslk);
break;
case Qcmpt:
+ bc = nil;
mpt = sch->mpt;
m = &mpt->m;
h = &shr->umh;
@@ -601,10 +603,14 @@
if(*ml == m){
*ml = m->next;
m->next = nil;
+ bc = m->to;
+ m->to = nil;
putmpt(mpt);
break;
}
wunlock(&h->lock);
+ if(bc != nil)
+ cclose(bc);
break;
}
poperror();