Plan 9 from Bell Labs’s /usr/web/sources/patch/sorry/import-z/readme

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


This patch adds a -z flag to import(4) to match the behavior of
exportfs(4) for exports made with the -r or -S flag, which bypass the
tree negotiation part of the protocol.  This solves a conflict between
exportfs(4) flags.  Currently, if an exportfs listener is using the -a
flag for authentication, the -r and -S flags to specify a subtree or
service become unusable although no error condition is reported.  It
is desirable to enable a command like this to work as intended:


	aux/listen1 tcp!*!port /bin/exportfs -a -r /usr/me/pubauth

and similarly with authenticated listeners for exportfs -S service
mounts.

The suggested patch is completely minimal and non-invasive.  It adds a
-z flag for import(4) to exist in symmetry with the -r and -S flags to
exportfs(4).  Import(4) is the intended client for exportfs(4) so the
option of skipping tree negotiation should be present for import(4) as
well.  This patch does not change any existing behaviors or currently
documented functions.  It simply makes import(4) function correctly in
combination with an exportfs(4) using -a in combination with -r or -S.

This patch does not affect the function of "backwards" mode and
requires no new logic other than a single if statement and controlling
flag.  The ability to create authenticated public exportfs(4)
listeners for a given -r subtree or -S service is useful and seems
entirely consistent with the intended functions of import/export.
Currently, non-authenticated -r or -S exports can be attached with
srv(4) and mount(1) (or used in backwards mode) but adding the -a
option makes them unmountable when acting as public listeners, unless
this patch is used.

Included are manpage adjustments for both import(4) and exportfs(4) to
explain the use of the new -z flag to import, as well as a few
additional examples of import usage.  The changes in exportfs(4) man
page explain the use of import, there is no changed code or behavior
in exportfs.

TESTING NOTES:
Current behavior:

server:

	aux/listen1 tcp!*!port /bin/exportfs -a -r /some/path

client attempts:

	import tcp!server!port /some/path /n/path
	import: bad remote tree: can't read tree

	import tcp!server!port / /n/path
	(waits and does nothing)

	srv tcp!server!port remote /n/remote
	srv tcp!server!port: mount failed: bad fversion conversion on reply

Behavior with import -z:

server (same as above):

	aux/listen1 tcp!*!port /bin/exportfs -a -r /some/path

client:

	import -z tcp!server!port anything /mount/point
	ls /mount/point

And we have a mounted fs assuming we had the right key in our
factotum(4).  It should be noted that with this modification, import
-A -z will mount non-authenticated exportfs -r and -S services in the
manner of a srv and mount sequence.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.