Date: Tue, 16 Aug 2011 13:12:29 +0300 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: Martin Birgmeier <Martin.Birgmeier@aon.at> Cc: freebsd-fs@FreeBSD.org Subject: Re: Does nfse support specifying multiple exports for one mount point? Message-ID: <20110816101229.GA2012@pm513-1.comsys.ntu-kpi.kiev.ua> In-Reply-To: <4E4657BD.2090803@aon.at> References: <4E4657BD.2090803@aon.at>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 13, 2011 at 12:53:49PM +0200, Martin Birgmeier wrote: > See http://www.freebsd.org/cgi/query-pr.cgi?pr=147881 - can I specify > multiple exports with nfse? > > I am using the patch proposed in PR 147881, even though I believe it is > incomplete (I read that somewhere). For me, it is working fine; for > example, I have > > [0]# zfs list -o name,sharenfs hal.1/backup/dumps > NAME SHARENFS > hal.1/backup/dumps -network 192.168.0.0 -mask 255.255.0.0;-network > fec0:0:0:4d42::/56 > [0]# > > which in /etc/zfs/exports translates to > > /z/backup/dumps -network 192.168.0.0 -mask 255.255.0.0 > /z/backup/dumps -network fec0:0:0:4d42::/56 > > How can I specify this using nfse? > PR/147881 proposes a way how to specify different options for different address specifications in one line. Eg. different -mapall options for different hosts in one line. >From the nfs.exports(5) manual page: after any address specification it is possible to use already specified option in the same line and its value will overwrite previous option's value and it will be used for next address specification. Such options are: -mapall and -maproot, -ro and -rw, -sec. It is possible to create reverse logic options for -no_* and -mnt_export_brief options as well. The ``*'' hostname represents default export and can be used in a line with other address specification. Example: % cat exports /fs -ro -mapall 1:2:3 1.1.1.1 -sec krb5 -maproot 2:3:4 * 2.2.2.2 -rw 3.3.3.3 % nfse -t exports configure: reading file exports Pathname /fs Export specifications: -rw -sec krb5 -maproot 2:3:4 -host 3.3.3.3 -ro -sec krb5 -maproot 2:3:4 -host 2.2.2.2 -ro -sec sys -mapall 1:2:3 -host 1.1.1.1 -ro -sec krb5 -maproot 2:3:4 * The exports(5) manual page says that address specifications must be specified after options. The nfs.exports(5) file format allows to use options after address specifications, so they can overwrite previously specified options. If you applied cddl.diff patch, then you can use zfs share/unshare to change ZFS NFS exports, and of course they will be changed atomically and changes will be applied only for one file system in a time. As a result if one used zfs share/unshare for ZFS file system, then exports settings from other exports files for this file system will be flushed. The -alldirs options is also supported by the "zfs share" command, but its logic does not follow logic described in nfs.exports(5). If the -alldirs options is used then nfse will create two exports: "/fs ..." and "/fs -subdir -alldirs ...". This is because of logic how zfs share/unshare works: 1. "zfs sharenfs ..." are not incremental. When we run "zfs sharenfs" for some file system it completely substitutes its settings. 2. There is no way to pass several settings for one file system at least for mountd. 3. "zfs sharenfs" does not allow to export subdirectories. If you unsure about configuration logic for nfse, then just call "nfse -t" and verify its output. At any time run "nfse -c show" and verify current NFS exports settings. If you prefer to run nfse(8) in compatible mode with mountd(8), then run it with the -C switch.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110816101229.GA2012>