@@ 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();