exportfs -r without -B fails because it skips the initial protocol. For example, executing this one on host A % aux/listen1 -tv tcp!$addr!64470 /bin/exportfs -r /dev and executing this on host B % import -A tcp!$addr!64470 will typically either fail to read the initial string or result in a bad tree. I believe that exportfs should only skip the initial protocol with -B, -S, etc. The fix entails reading the path requested by import and discarding it. Notes: Fri May 7 12:20:27 EDT 2010 geoff I believe exportfs is working as documented. Reference: /n/sources/patch/sorry/exportfs-r-problem Date: Wed Apr 21 03:59:16 CES 2010 Signed-off-by: jrw972@gmail.com Reviewed-by: geoff --- /sys/src/cmd/exportfs/exportfs.c Wed Apr 21 03:59:12 2010 +++ /sys/src/cmd/exportfs/exportfs.c Wed Apr 21 03:59:10 2010 @@ -200,7 +200,7 @@ if(na){ if(srv == nil) - sysfatal("-B requires -s"); + sysfatal("-B requires -r"); local = "me"; remote = na; @@ -253,7 +253,7 @@ if(srvfd != -1) { /* do nothing */ } - else if(srv) { + else if(na) { chdir(srv); DEBUG(DFD, "invoked as server for %s", srv); strncpy(buf, srv, sizeof buf); @@ -269,6 +269,10 @@ exits(buf); } buf[n] = 0; + if(srv) { + /* Ignore requested tree. */ + strncpy(buf, srv, sizeof buf); + } if(chdir(buf) < 0) { errstr(ebuf, sizeof ebuf); fprint(0, "chdir(%d:\"%s\"): %s", n, buf, ebuf); @@ -282,7 +286,7 @@ DEBUG(DFD, "exportfs: %s\n", buf); - if(srv == nil && srvfd == -1 && write(0, "OK", 2) != 2) + if(na == nil && srvfd == -1 && write(0, "OK", 2) != 2) fatal("open ack write"); if (readn(netfd, &initial, sizeof(ulong)) < sizeof(ulong))