From owner-freebsd-stable@FreeBSD.ORG Thu Aug 26 19:06:16 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B9081065694 for ; Thu, 26 Aug 2010 19:06:16 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id ECED18FC18 for ; Thu, 26 Aug 2010 19:06:15 +0000 (UTC) Received: by wwb34 with SMTP id 34so374226wwb.31 for ; Thu, 26 Aug 2010 12:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=73jbsZpdNkAGEo4a3OZEgvcmJcAl81ZVHsEVSH4N5F8=; b=jhUfReTSmWMKM9UoTk+U+psKimlbPwOsolvHelyhav5/v3f6SHk7YcLy7u4rZi32P1 BLIY8WGoA2ItBi7vVAIULBcyT8puj0eX+pGwc//BtowZgHzAg7szyfBCjHaCRNO3zQaA 8Zszr7gfoyNImPtlu8FQPfAHvymSh1Netl4FA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=E2Xg517bWVQ01PakrO7/ANg475EP9H/nEpuJb09XobfQJ7Na1dllJGv17024HpfSre TR8NPSUWhaR9/0XHDe7/nlSH05Vwbs8L/D5GzShXfYpXS+6WWBMqJkv18MvTdKVKN43X VIgAmxPmxmAIIc8tlzEW/JKPyaPr5X5Z0MJsQ= Received: by 10.227.158.15 with SMTP id d15mr9431896wbx.46.1282849574981; Thu, 26 Aug 2010 12:06:14 -0700 (PDT) Received: from centel.dataix.local (adsl-99-181-132-33.dsl.klmzmi.sbcglobal.net [99.181.132.33]) by mx.google.com with ESMTPS id b23sm2544713wbb.10.2010.08.26.12.06.13 (version=SSLv3 cipher=RC4-MD5); Thu, 26 Aug 2010 12:06:13 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4C76BB23.50606@DataIX.net> Date: Thu, 26 Aug 2010 15:06:11 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100806 Lightning/1.0b1 Thunderbird MIME-Version: 1.0 To: Heinrich Rebehn References: <3D57D985-4B4D-4657-86E0-C93EFB3549CC@ant.uni-bremen.de> In-Reply-To: <3D57D985-4B4D-4657-86E0-C93EFB3549CC@ant.uni-bremen.de> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org Subject: Re: zfs sharenfs with multiple hosts/networks and options X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2010 19:06:16 -0000 On 08/25/2010 03:47, Heinrich Rebehn wrote: > Hi list, > > with traditional /etc/exports i can do > > /export/linux/root -ro xxx.xxx.xxx.0/24 > /export/linux/root -maproot=0 xxx.xxx.xxx.1 > > How can i do this using zfs's sharenfs option? > > When i try > > zfs set sharenfs="-ro -network xxx.xxx.xxx.0/24,-maproot=0 xxx.xxx.xxx.1" data/linux/root > > /var/log/messages shows "network/host conflict" and "bad exports list line. > > The general problem seems to be that with each "zfs set sharenfs" command, the corresponding in /etc/zfs/exports gets overwritten. > > Is there a workaround for this besides ignoring sharenfs and using hand edited /etc/exports? > > Thanks for any help, > Hi Heinrich, All the sharenfs property is actually doing and maybe not exactly in this order is modifying /etc/zfs/exports with the interpreted contents of the sharenfs property and using a syntax that the native mountd(8) understands or at least tries to in a very simple way. After this is all done, mountd(8) recieves a HUP signal to inform if to reread /etc/exports & /etc/zfs/exports. So traditionally everything is happening the way it always has been except for the fact your now using the zfs(1M) Sun command with our own patch on top of that to make it look like its doing what you see in *Solaris or at least the interpreted version. Currently we do not have a/the share(1M) command implemented. My suggestion would be to write a script either in Python or Perl or maybe even in C to parse your own command line arguments and adjust /etc/exports or /etc/zfs/exports accordingly depending on the type of filesystem your arguments point to and then send signal HUP to mountd(8). This will at least be a little more under your control without having to modify sources and deal with conflicts later. I would recommend that you disable using the sharenfs property at all if you choose to go this route as you may start to find inconsistencies among your shares. The reference code where this is all happening is: cddl/compat/opensolaris/misc/fsshare.c Disable handling of the sharenfs property (ZFS_PROP_SHARENFS): cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Personally I would love to see our version of the sharenfs version translated into something that is local to FreeBSD only like the org.freebsd:swap local property that we use to enable swap on zvol's. My theorized version of this would look a little like the following. zfs set \ org.freebsd:nfs='ro=@192.168.1.0/24,root=0; rw=@192.168.2.1,root=514' org.freebsd:nfs4='V4: ......' Where options are separated by commas and shares to different hosts or networks are separated by semicolons. But if you don't want to go through all this then you could always designate /etc/zfs/exports as a permanent share for users that are allowed to write and administered by the sharenfs property. And use /etc/exports as your extraneous read-only shares. Just a thought. Anyway! enough said. Good luck on your mission. Regards, -- jhell,v