|
@@ -113,7 +113,7 @@ decref(Ref *r)
|
|
|
x = --r->ref;
|
|
|
unlock(r);
|
|
|
if(x < 0)
|
|
|
- panic("deccnt pc=0x%lux", getcallerpc(&r));
|
|
|
+ panic("decref pc=0x%lux", getcallerpc(&r));
|
|
|
|
|
|
return x;
|
|
|
}
|
|
@@ -947,7 +947,7 @@ static char Edoesnotexist[] = "does not exist";
|
|
|
int
|
|
|
walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
|
|
|
{
|
|
|
- int dev, dotdot, i, n, nhave, ntry, type;
|
|
|
+ int dev, didmount, dotdot, i, n, nhave, ntry, type;
|
|
|
Chan *c, *nc, *mtpt;
|
|
|
Path *path;
|
|
|
Mhead *mh, *nmh;
|
|
@@ -967,9 +967,13 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
|
|
|
* 3. move to the first mountpoint along the way.
|
|
|
* 4. repeat.
|
|
|
*
|
|
|
- * An invariant is that each time through the loop, c is on the undomount
|
|
|
- * side of the mount point, and c's full path is path.
|
|
|
+ * Each time through the loop:
|
|
|
+ *
|
|
|
+ * If didmount==0, c is on the undomount side of the mount point.
|
|
|
+ * If didmount==1, c is on the domount side of the mount point.
|
|
|
+ * Either way, c's full path is path.
|
|
|
*/
|
|
|
+ didmount = 0;
|
|
|
for(nhave=0; nhave<nnames; nhave+=n){
|
|
|
if((c->qid.type&QTDIR)==0){
|
|
|
if(nerror)
|
|
@@ -996,9 +1000,9 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!dotdot && !nomount)
|
|
|
+ if(!dotdot && !nomount && !didmount)
|
|
|
domount(&c, &mh, &path);
|
|
|
-
|
|
|
+
|
|
|
type = c->type;
|
|
|
dev = c->dev;
|
|
|
|
|
@@ -1029,21 +1033,26 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- nmh = nil;
|
|
|
+ didmount = 0;
|
|
|
if(dotdot){
|
|
|
assert(wq->nqid == 1);
|
|
|
assert(wq->clone != nil);
|
|
|
|
|
|
path = addelem(path, "..", nil);
|
|
|
nc = undomount(wq->clone, path);
|
|
|
+ nmh = nil;
|
|
|
n = 1;
|
|
|
}else{
|
|
|
nc = nil;
|
|
|
nmh = nil;
|
|
|
- if(!nomount)
|
|
|
- for(i=0; i<wq->nqid && i<ntry-1; i++)
|
|
|
- if(findmount(&nc, &nmh, type, dev, wq->qid[i]))
|
|
|
+ if(!nomount){
|
|
|
+ for(i=0; i<wq->nqid && i<ntry-1; i++){
|
|
|
+ if(findmount(&nc, &nmh, type, dev, wq->qid[i])){
|
|
|
+ didmount = 1;
|
|
|
break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if(nc == nil){ /* no mount points along path */
|
|
|
if(wq->clone == nil){
|
|
|
cclose(c);
|
|
@@ -1065,6 +1074,7 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
|
|
|
n = wq->nqid;
|
|
|
nc = wq->clone;
|
|
|
}else{ /* stopped early, at a mount point */
|
|
|
+ didmount = 1;
|
|
|
if(wq->clone != nil){
|
|
|
cclose(wq->clone);
|
|
|
wq->clone = nil;
|