From 995bfb15bd0a26b95cb56dc4dc60a8bf33c60141 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 8 Aug 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-08-08 --- port/devmnt.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/port/devmnt.c b/port/devmnt.c index dc3c9c084286bd2711c2450f44ccf583d953698f..1ac57e8880f548ce6380526548f2552697a0656b 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -79,6 +79,7 @@ Chan* mntattach(char *muxattach) { Mnt *m; + int nest; Chan *c, *mc; char buf[NAMELEN]; struct bogus{ @@ -164,6 +165,28 @@ mntattach(char *muxattach) mattach(m, c, bogus.spec); poperror(); + /* Work out how deep we are nested and reduce the blocksize + * accordingly + */ + nest = 0; + mc = m->c; + while(mc) { + if(mc->type != devno('M', 0)) + break; + nest++; + if(mc->mntptr == 0) + break; + mc = mc->mntptr->c; + } + m->blocksize -= nest * 32; + + /* + * Detect a recursive mount for a mount point served by exportfs. + * If CHDIR is clear in the returned qid the foreign server is + * requesting the mount point be folded into the connection + * to the exportfs. In this case the remote mount driver does + * the multiplexing. + */ mc = m->c; if(mc->type == devno('M', 0) && (c->qid.path&CHDIR) == 0) { mclose(m, c); @@ -280,12 +303,14 @@ mntwalk(Chan *c, char *name) c->qid = r->reply.qid; op = c->path; c->path = ptenter(&m->tree, op, name); -/* ASSERT */ + +/* ASSERT do not remove */ if(op->ref == 0) { char buf[128]; ptpath(op, buf, sizeof(buf)); print("PATH: '%s' walking %s\n", op, name); } + decref(op); poperror();